Changes in kernel/generic/src/ipc/ipc.c [d51a0d6:c1f68b0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ipc.c
rd51a0d6 rc1f68b0 87 87 } 88 88 89 static void call_destroy(void *arg) 90 { 91 call_t *call = (call_t *) arg; 92 93 if (call->buffer) 94 free(call->buffer); 95 if (call->caller_phone) 96 kobject_put(call->caller_phone->kobject); 97 slab_free(call_slab, call); 98 } 99 100 static kobject_ops_t call_kobject_ops = { 101 .destroy = call_destroy 102 }; 89 void ipc_call_hold(call_t *call) 90 { 91 atomic_inc(&call->refcnt); 92 } 93 94 void ipc_call_release(call_t *call) 95 { 96 if (atomic_predec(&call->refcnt) == 0) { 97 if (call->buffer) 98 free(call->buffer); 99 if (call->caller_phone) 100 kobject_put(call->caller_phone->kobject); 101 slab_free(call_slab, call); 102 } 103 } 103 104 104 105 /** Allocate and initialize a call structure. … … 116 117 { 117 118 call_t *call = slab_alloc(call_slab, flags); 118 if (!call) 119 return NULL; 120 kobject_t *kobj = (kobject_t *) malloc(sizeof(kobject_t), flags); 121 if (!kobj) { 122 slab_free(call_slab, call); 123 return NULL; 124 } 125 126 _ipc_call_init(call); 127 kobject_initialize(kobj, KOBJECT_TYPE_CALL, call, &call_kobject_ops); 128 call->kobject = kobj; 119 if (call) { 120 _ipc_call_init(call); 121 ipc_call_hold(call); 122 } 129 123 130 124 return call; 125 } 126 127 /** Deallocate a call structure. 128 * 129 * @param call Call structure to be freed. 130 * 131 */ 132 void ipc_call_free(call_t *call) 133 { 134 ipc_call_release(call); 131 135 } 132 136 … … 286 290 /* This is a forgotten call and call->sender is not valid. */ 287 291 spinlock_unlock(&call->forget_lock); 288 kobject_put(call->kobject);292 ipc_call_free(call); 289 293 return; 290 294 } else { … … 701 705 * must hold a reference to it. 702 706 */ 703 kobject_add_ref(call->kobject);707 ipc_call_hold(call); 704 708 705 709 spinlock_unlock(&call->forget_lock); … … 710 714 SYSIPC_OP(request_forget, call); 711 715 712 kobject_put(call->kobject);716 ipc_call_release(call); 713 717 } 714 718 … … 818 822 SYSIPC_OP(answer_process, call); 819 823 820 kobject_put(call->kobject);824 ipc_call_free(call); 821 825 goto restart; 822 826 }
Note:
See TracChangeset
for help on using the changeset viewer.