Changeset f5837524 in mainline for kernel/generic/src/ipc/ops/conctmeto.c
- Timestamp:
- 2018-10-29T17:15:02Z (5 years ago)
- Children:
- eec201d
- Parents:
- 184f2f8a
- git-author:
- Jakub Jermar <jakub@…> (2018-10-28 12:42:35)
- git-committer:
- Jakub Jermar <jakub@…> (2018-10-29 17:15:02)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ops/conctmeto.c
r184f2f8a rf5837524 46 46 * That will be done once the phone is connected. 47 47 */ 48 cap_phone_handle_t ph one_handle;49 kobject_t *p hone_obj;50 errno_t rc = phone_alloc(TASK, false, &ph one_handle, &phone_obj);48 cap_phone_handle_t phandle; 49 kobject_t *pobj; 50 errno_t rc = phone_alloc(TASK, false, &phandle, &pobj); 51 51 if (rc != EOK) { 52 call->priv = -1;52 call->priv = 0; 53 53 return rc; 54 54 } 55 55 56 /* Hand over phone_obj's reference to ARG5 */ 57 IPC_SET_ARG5(call->data, (sysarg_t) phone_obj->phone); 56 /* Move pobj's reference to call->priv */ 57 call->priv = (sysarg_t) pobj; 58 pobj = NULL; 58 59 59 60 /* Remember the handle */ 60 call->priv = CAP_HANDLE_RAW(phone_handle);61 IPC_SET_ARG5(call->data, (sysarg_t) phandle); 61 62 62 63 return EOK; … … 65 66 static errno_t request_forget(call_t *call) 66 67 { 67 cap_phone_handle_t ph one_handle = (cap_handle_t) call->priv;68 cap_phone_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(call->data); 68 69 69 if (CAP_HANDLE_RAW(ph one_handle) < 0)70 if (CAP_HANDLE_RAW(phandle) < 0) 70 71 return EOK; 71 72 72 /* Hand over reference from ARG5 to phone->kobject */ 73 phone_t *phone = (phone_t *) IPC_GET_ARG5(call->data); 74 /* Drop phone->kobject's reference */ 75 kobject_put(phone->kobject); 76 cap_free(TASK, phone_handle); 73 /* Move reference from call->priv to pobj */ 74 kobject_t *pobj = (kobject_t *) call->priv; 75 call->priv = 0; 76 /* Drop pobj's reference */ 77 kobject_put(pobj); 78 cap_free(TASK, phandle); 77 79 78 80 return EOK; … … 81 83 static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata) 82 84 { 83 /* Hand over reference from ARG5 to phone */ 84 phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata); 85 /* Get an extra reference for phone */ 86 kobject_t *pobj = (kobject_t *) answer->priv; 87 kobject_add_ref(pobj); 85 88 86 /* 87 * Get an extra reference and pass it in the answer data.88 */ 89 kobject_add_ref(phone->kobject);90 IPC_SET_ARG5(answer->data, (sysarg_t) phone);89 /* Set the recipient-assigned label */ 90 pobj->phone->label = IPC_GET_ARG5(answer->data); 91 92 /* Restore phone handle in answer's ARG5 */ 93 IPC_SET_ARG5(answer->data, IPC_GET_ARG5(*olddata)); 91 94 92 95 /* If the user accepted the call, connect */ 93 96 if (IPC_GET_RETVAL(answer->data) == EOK) { 94 /* Hand over reference from p honeto the answerbox */95 (void) ipc_phone_connect(p hone, &TASK->answerbox);97 /* Hand over reference from pobj to the answerbox */ 98 (void) ipc_phone_connect(pobj->phone, &TASK->answerbox); 96 99 } else { 97 kobject_put(phone->kobject); 100 /* Drop the extra reference */ 101 kobject_put(pobj); 98 102 } 99 103 … … 103 107 static errno_t answer_process(call_t *answer) 104 108 { 105 cap_phone_handle_t phone_handle = (cap_handle_t) answer->priv; 106 phone_t *phone = (phone_t *) IPC_GET_ARG5(answer->data); 109 cap_phone_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(answer->data); 110 /* Move the reference from answer->priv to pobj */ 111 kobject_t *pobj = (kobject_t *) answer->priv; 112 answer->priv = 0; 107 113 108 114 if (IPC_GET_RETVAL(answer->data)) { 109 if (CAP_HANDLE_RAW(ph one_handle) >= 0) {115 if (CAP_HANDLE_RAW(phandle) >= 0) { 110 116 /* 111 117 * Cleanup the unpublished capability and drop 112 118 * phone->kobject's reference. 113 119 */ 114 kobject_put(p hone->kobject);115 cap_free(TASK, ph one_handle);120 kobject_put(pobj); 121 cap_free(TASK, phandle); 116 122 } 117 123 } else { … … 121 127 * capability for each phone that wasn't hung up by the user. 122 128 */ 123 cap_publish(TASK, phone_handle, phone->kobject); 124 125 IPC_SET_ARG5(answer->data, CAP_HANDLE_RAW(phone_handle)); 129 cap_publish(TASK, phandle, pobj); 126 130 } 127 131
Note:
See TracChangeset
for help on using the changeset viewer.