Changeset fc0de8c in mainline
- Timestamp:
- 2019-10-14T15:30:30Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46a8c3cd
- Parents:
- f1cd4b0
- git-author:
- Jakub Jermar <jakub@…> (2019-10-14 15:27:34)
- git-committer:
- Jakub Jermar <jakub@…> (2019-10-14 15:30:30)
- Location:
- kernel/generic
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cap/cap.h
rf1cd4b0 rfc0de8c 70 70 } kobject_ops_t; 71 71 72 extern kobject_ops_t *kobject_ops[]; 73 74 #define KOBJECT_OP(k) kobject_ops[(k)->type] 75 72 76 /* 73 77 * Everything in kobject_t except for the atomic reference count, the capability … … 82 86 /** List of published capabilities associated with the kobject */ 83 87 list_t caps_list; 84 85 kobject_ops_t *ops;86 88 87 89 union { … … 139 141 extern kobject_t *kobject_alloc(unsigned int); 140 142 extern void kobject_free(kobject_t *); 141 extern void kobject_initialize(kobject_t *, kobject_type_t, void *, 142 kobject_ops_t *); 143 extern void kobject_initialize(kobject_t *, kobject_type_t, void *); 143 144 extern kobject_t *kobject_get(struct task *, cap_handle_t, kobject_type_t); 144 145 extern void kobject_add_ref(kobject_t *); -
kernel/generic/include/ipc/ipc.h
rf1cd4b0 rfc0de8c 172 172 extern answerbox_t *ipc_box_0; 173 173 174 extern kobject_ops_t call_kobject_ops; 175 174 176 extern void ipc_init(void); 175 177 -
kernel/generic/include/ipc/ipcrsc.h
rf1cd4b0 rfc0de8c 40 40 #include <cap/cap.h> 41 41 42 extern kobject_ops_t phone_kobject_ops; 43 42 44 extern errno_t phone_alloc(task_t *, bool, cap_phone_handle_t *, kobject_t **); 43 45 extern void phone_dealloc(cap_phone_handle_t); -
kernel/generic/include/ipc/irq.h
rf1cd4b0 rfc0de8c 46 46 #include <typedefs.h> 47 47 #include <adt/list.h> 48 #include <cap/cap.h> 49 50 extern kobject_ops_t irq_kobject_ops; 48 51 49 52 extern irq_ownership_t ipc_irq_top_half_claim(irq_t *); -
kernel/generic/include/synch/syswaitq.h
rf1cd4b0 rfc0de8c 38 38 #include <typedefs.h> 39 39 #include <abi/cap.h> 40 #include <cap/cap.h> 41 42 extern kobject_ops_t waitq_kobject_ops; 40 43 41 44 extern void sys_waitq_init(void); -
kernel/generic/src/cap/cap.c
rf1cd4b0 rfc0de8c 83 83 #include <mm/slab.h> 84 84 #include <adt/list.h> 85 #include <synch/syswaitq.h> 86 #include <ipc/ipcrsc.h> 87 #include <ipc/ipc.h> 88 #include <ipc/irq.h> 85 89 86 90 #include <limits.h> … … 94 98 static slab_cache_t *cap_cache; 95 99 static slab_cache_t *kobject_cache; 100 101 kobject_ops_t *kobject_ops[KOBJECT_TYPE_MAX] = { 102 [KOBJECT_TYPE_CALL] = &call_kobject_ops, 103 [KOBJECT_TYPE_IRQ] = &irq_kobject_ops, 104 [KOBJECT_TYPE_PHONE] = &phone_kobject_ops, 105 [KOBJECT_TYPE_WAITQ] = &waitq_kobject_ops 106 }; 96 107 97 108 static size_t caps_hash(const ht_link_t *item) … … 412 423 * @param type Type of the kernel object. 413 424 * @param raw Raw pointer to the encapsulated object. 414 * @param ops Pointer to kernel object operations for the respective type. 415 */ 416 void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw, 417 kobject_ops_t *ops) 425 */ 426 void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw) 418 427 { 419 428 atomic_store(&kobj->refcnt, 1); … … 424 433 kobj->type = type; 425 434 kobj->raw = raw; 426 kobj->ops = ops;427 435 } 428 436 … … 474 482 { 475 483 if (atomic_postdec(&kobj->refcnt) == 1) { 476 kobj->ops->destroy(kobj->raw);484 KOBJECT_OP(kobj)->destroy(kobj->raw); 477 485 kobject_free(kobj); 478 486 } -
kernel/generic/src/ipc/ipc.c
rf1cd4b0 rfc0de8c 100 100 } 101 101 102 statickobject_ops_t call_kobject_ops = {102 kobject_ops_t call_kobject_ops = { 103 103 .destroy = call_destroy 104 104 }; … … 127 127 128 128 _ipc_call_init(call); 129 kobject_initialize(kobj, KOBJECT_TYPE_CALL, call , &call_kobject_ops);129 kobject_initialize(kobj, KOBJECT_TYPE_CALL, call); 130 130 call->kobject = kobj; 131 131 -
kernel/generic/src/ipc/ipcrsc.c
rf1cd4b0 rfc0de8c 52 52 } 53 53 54 statickobject_ops_t phone_kobject_ops = {54 kobject_ops_t phone_kobject_ops = { 55 55 .destroy = phone_destroy 56 56 }; … … 94 94 phone->hangup_call = hcall; 95 95 96 kobject_initialize(kobj, KOBJECT_TYPE_PHONE, phone, 97 &phone_kobject_ops); 96 kobject_initialize(kobj, KOBJECT_TYPE_PHONE, phone); 98 97 phone->kobject = kobj; 99 98 -
kernel/generic/src/ipc/irq.c
rf1cd4b0 rfc0de8c 306 306 } 307 307 308 statickobject_ops_t irq_kobject_ops = {308 kobject_ops_t irq_kobject_ops = { 309 309 .destroy = irq_destroy 310 310 }; … … 385 385 irq_spinlock_unlock(&irq_uspace_hash_table_lock, true); 386 386 387 kobject_initialize(kobject, KOBJECT_TYPE_IRQ, irq , &irq_kobject_ops);387 kobject_initialize(kobject, KOBJECT_TYPE_IRQ, irq); 388 388 cap_publish(TASK, handle, kobject); 389 389 -
kernel/generic/src/synch/syswaitq.c
rf1cd4b0 rfc0de8c 54 54 } 55 55 56 statickobject_ops_t waitq_kobject_ops = {56 kobject_ops_t waitq_kobject_ops = { 57 57 .destroy = waitq_destroy 58 58 }; … … 100 100 return (sys_errno_t) ENOMEM; 101 101 } 102 kobject_initialize(kobj, KOBJECT_TYPE_WAITQ, wq , &waitq_kobject_ops);102 kobject_initialize(kobj, KOBJECT_TYPE_WAITQ, wq); 103 103 104 104 cap_handle_t handle;
Note:
See TracChangeset
for help on using the changeset viewer.