Changeset 91b60499 in mainline for kernel/generic/src/ipc/ops/conctmeto.c
- Timestamp:
- 2017-09-30T06:29:42Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 300f4c4
- Parents:
- d076f16 (diff), 6636fb19 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ops/conctmeto.c
rd076f16 r91b60499 1 1 /* 2 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2012 Jakub Jermar 3 * Copyright (c) 2012 Jakub Jermar 4 4 * All rights reserved. 5 5 * … … 42 42 static int request_preprocess(call_t *call, phone_t *phone) 43 43 { 44 int newphid= phone_alloc(TASK);44 cap_handle_t phone_handle = phone_alloc(TASK); 45 45 46 /* Remember the phone idor the error. */47 call->priv = newphid;48 if ( newphid< 0)49 return ELIMIT;50 46 /* Remember the phone capability or the error. */ 47 call->priv = phone_handle; 48 if (phone_handle < 0) 49 return phone_handle; 50 51 51 /* Set arg5 for server */ 52 IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]); 52 kobject_t *phone_obj = kobject_get(TASK, phone_handle, 53 KOBJECT_TYPE_PHONE); 54 /* Hand over phone_obj's reference to ARG5 */ 55 IPC_SET_ARG5(call->data, (sysarg_t) phone_obj->phone); 53 56 54 57 return EOK; … … 57 60 static int request_forget(call_t *call) 58 61 { 59 phone_dealloc(call->priv); 62 cap_handle_t phone_handle = (cap_handle_t) call->priv; 63 phone_dealloc(phone_handle); 64 /* Hand over reference from ARG5 to phone->kobject */ 65 phone_t *phone = (phone_t *) IPC_GET_ARG5(call->data); 66 /* Drop phone_obj's reference */ 67 kobject_put(phone->kobject); 60 68 return EOK; 61 69 } … … 63 71 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 64 72 { 73 /* Hand over reference from ARG5 to phone */ 65 74 phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata); 66 75 67 76 /* If the user accepted call, connect */ 68 if (IPC_GET_RETVAL(answer->data) == EOK) 77 if (IPC_GET_RETVAL(answer->data) == EOK) { 78 /* Hand over reference from phone to the answerbox */ 69 79 (void) ipc_phone_connect(phone, &TASK->answerbox); 80 } else { 81 kobject_put(phone->kobject); 82 } 70 83 71 84 return EOK; … … 74 87 static int answer_process(call_t *answer) 75 88 { 76 int newphid = (int) answer->priv;89 cap_handle_t phone_handle = (cap_handle_t) answer->priv; 77 90 78 91 if (IPC_GET_RETVAL(answer->data)) { 79 if ( newphid>= 0) {92 if (phone_handle >= 0) { 80 93 /* 81 94 * The phone was indeed allocated and now needs 82 95 * to be deallocated. 83 96 */ 84 phone_dealloc( newphid);97 phone_dealloc(phone_handle); 85 98 } 86 99 } else { 87 IPC_SET_ARG5(answer->data, newphid);100 IPC_SET_ARG5(answer->data, phone_handle); 88 101 } 89 102
Note:
See TracChangeset
for help on using the changeset viewer.