Changeset b1e6269 in mainline
- Timestamp:
- 2012-08-24T22:27:44Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20282ef3
- Parents:
- 13dbaa8c
- Location:
- kernel/generic
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/sysipc_ops.h
r13dbaa8c rb1e6269 40 40 typedef struct { 41 41 int (* request_preprocess)(call_t *, phone_t *); 42 void (* request_forget)(call_t *); 42 43 int (* request_process)(call_t *, answerbox_t *); 44 void (* answer_cleanup)(call_t *, ipc_data_t *); 43 45 int (* answer_preprocess)(call_t *, ipc_data_t *); 44 46 int (* answer_process)(call_t *); … … 48 50 49 51 extern int null_request_preprocess(call_t *, phone_t *); 52 extern void null_request_forget(call_t *); 50 53 extern int null_request_process(call_t *, answerbox_t *); 54 extern void null_answer_cleanup(call_t *, ipc_data_t *); 51 55 extern int null_answer_preprocess(call_t *, ipc_data_t *); 52 56 extern int null_answer_process(call_t *); -
kernel/generic/src/ipc/ipc.c
r13dbaa8c rb1e6269 45 45 #include <ipc/kbox.h> 46 46 #include <ipc/event.h> 47 #include <ipc/sysipc_ops.h> 47 48 #include <errno.h> 48 49 #include <mm/slab.h> … … 613 614 spinlock_unlock(&call->forget_lock); 614 615 spinlock_unlock(&TASK->active_calls_lock); 616 617 sysipc_ops_t *ops = sysipc_ops_get(call->request_method); 618 if (ops->request_forget) 619 ops->request_forget(call); 620 615 621 goto restart; 616 622 } -
kernel/generic/src/ipc/ops/clnestab.c
r13dbaa8c rb1e6269 45 45 } 46 46 47 static void answer_cleanup(call_t *answer, ipc_data_t *olddata) 48 { 49 phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata); 50 51 mutex_lock(&phone->lock); 52 if (phone->state == IPC_PHONE_CONNECTED) { 53 irq_spinlock_lock(&phone->callee->lock, true); 54 list_remove(&phone->link); 55 phone->state = IPC_PHONE_SLAMMED; 56 irq_spinlock_unlock(&phone->callee->lock, true); 57 } 58 mutex_unlock(&phone->lock); 59 } 60 47 61 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 48 62 { 49 phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata);50 63 51 64 if (IPC_GET_RETVAL(answer->data) != EOK) { … … 55 68 * connection without sending IPC_M_HUNGUP back. 56 69 */ 57 mutex_lock(&phone->lock); 58 if (phone->state == IPC_PHONE_CONNECTED) { 59 irq_spinlock_lock(&phone->callee->lock, true); 60 list_remove(&phone->link); 61 phone->state = IPC_PHONE_SLAMMED; 62 irq_spinlock_unlock(&phone->callee->lock, true); 63 } 64 mutex_unlock(&phone->lock); 70 answer_cleanup(answer, olddata); 65 71 } 66 72 … … 70 76 sysipc_ops_t ipc_m_clone_establish_ops = { 71 77 .request_preprocess = request_preprocess, 78 .request_forget = null_request_forget, 72 79 .request_process = null_request_process, 80 .answer_cleanup = answer_cleanup, 73 81 .answer_preprocess = answer_preprocess, 74 82 .answer_process = null_answer_process, -
kernel/generic/src/ipc/ops/conctmeto.c
r13dbaa8c rb1e6269 54 54 } 55 55 56 static void request_forget(call_t *call) 57 { 58 phone_dealloc(call->priv); 59 } 60 56 61 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 57 62 { … … 77 82 sysipc_ops_t ipc_m_connect_me_to_ops = { 78 83 .request_preprocess = request_preprocess, 84 .request_forget = request_forget, 79 85 .request_process = null_request_process, 86 .answer_cleanup = null_answer_cleanup, 80 87 .answer_preprocess = answer_preprocess, 81 88 .answer_process = answer_process, -
kernel/generic/src/ipc/ops/concttome.c
r13dbaa8c rb1e6269 55 55 } 56 56 57 static void answer_cleanup(call_t *answer, ipc_data_t *olddata) 58 { 59 int phoneid = (int) IPC_GET_ARG5(*olddata); 60 61 phone_dealloc(phoneid); 62 } 63 57 64 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 58 65 { … … 61 68 if (IPC_GET_RETVAL(answer->data) != EOK) { 62 69 /* The connection was not accepted */ 63 int phoneid = (int) IPC_GET_ARG5(*olddata); 64 65 phone_dealloc(phoneid); 70 answer_cleanup(answer, olddata); 66 71 } else { 67 72 /* The connection was accepted */ … … 77 82 sysipc_ops_t ipc_m_connect_to_me_ops = { 78 83 .request_preprocess = null_request_preprocess, 84 .request_forget = null_request_forget, 79 85 .request_process = request_process, 86 .answer_cleanup = answer_cleanup, 80 87 .answer_preprocess = answer_preprocess, 81 88 .answer_process = null_answer_process, -
kernel/generic/src/ipc/ops/connclone.c
r13dbaa8c rb1e6269 97 97 } 98 98 99 static void answer_cleanup(call_t *answer, ipc_data_t *olddata) 100 { 101 int phoneid = (int) IPC_GET_ARG1(*olddata); 102 phone_t *phone = &TASK->phones[phoneid]; 103 104 /* 105 * In this case, the connection was established at the request 106 * time and therefore we need to slam the phone. We don't 107 * merely hangup as that would result in sending IPC_M_HUNGUP 108 * to the third party on the other side of the cloned phone. 109 */ 110 mutex_lock(&phone->lock); 111 if (phone->state == IPC_PHONE_CONNECTED) { 112 irq_spinlock_lock(&phone->callee->lock, true); 113 list_remove(&phone->link); 114 phone->state = IPC_PHONE_SLAMMED; 115 irq_spinlock_unlock(&phone->callee->lock, true); 116 } 117 mutex_unlock(&phone->lock); 118 } 119 99 120 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 100 121 { … … 103 124 * The recipient of the cloned phone rejected the offer. 104 125 */ 105 int phoneid = (int) IPC_GET_ARG1(*olddata); 106 phone_t *phone = &TASK->phones[phoneid]; 107 108 /* 109 * In this case, the connection was established at the request 110 * time and therefore we need to slam the phone. We don't 111 * merely hangup as that would result in sending IPC_M_HUNGUP 112 * to the third party on the other side of the cloned phone. 113 */ 114 mutex_lock(&phone->lock); 115 if (phone->state == IPC_PHONE_CONNECTED) { 116 irq_spinlock_lock(&phone->callee->lock, true); 117 list_remove(&phone->link); 118 phone->state = IPC_PHONE_SLAMMED; 119 irq_spinlock_unlock(&phone->callee->lock, true); 120 } 121 mutex_unlock(&phone->lock); 126 answer_cleanup(answer, olddata); 122 127 } 123 128 … … 127 132 sysipc_ops_t ipc_m_connection_clone_ops = { 128 133 .request_preprocess = request_preprocess, 134 .request_forget = null_request_forget, 129 135 .request_process = null_request_process, 136 .answer_cleanup = answer_cleanup, 130 137 .answer_preprocess = answer_preprocess, 131 138 .answer_process = null_answer_process, -
kernel/generic/src/ipc/ops/dataread.c
r13dbaa8c rb1e6269 108 108 sysipc_ops_t ipc_m_data_read_ops = { 109 109 .request_preprocess = request_preprocess, 110 .request_forget = null_request_forget, 110 111 .request_process = null_request_process, 112 .answer_cleanup = null_answer_cleanup, 111 113 .answer_preprocess = answer_preprocess, 112 114 .answer_process = answer_process, -
kernel/generic/src/ipc/ops/datawrite.c
r13dbaa8c rb1e6269 84 84 } 85 85 } 86 free(answer->buffer);87 answer->buffer = NULL;88 86 89 87 return EOK; … … 93 91 sysipc_ops_t ipc_m_data_write_ops = { 94 92 .request_preprocess = request_preprocess, 93 .request_forget = null_request_forget, 95 94 .request_process = null_request_process, 95 .answer_cleanup = null_answer_cleanup, 96 96 .answer_preprocess = answer_preprocess, 97 97 .answer_process = null_answer_process, -
kernel/generic/src/ipc/ops/debug.c
r13dbaa8c rb1e6269 65 65 .request_preprocess = null_request_preprocess, 66 66 #endif 67 .request_forget = null_request_forget, 67 68 .request_process = request_process, 69 .answer_cleanup = null_answer_cleanup, 68 70 .answer_preprocess = null_answer_preprocess, 69 71 .answer_process = answer_process, -
kernel/generic/src/ipc/ops/sharein.c
r13dbaa8c rb1e6269 61 61 sysipc_ops_t ipc_m_share_in_ops = { 62 62 .request_preprocess = null_request_preprocess, 63 .request_forget = null_request_forget, 63 64 .request_process = null_request_process, 65 .answer_cleanup = null_answer_cleanup, 64 66 .answer_preprocess = answer_preprocess, 65 67 .answer_process = null_answer_process, -
kernel/generic/src/ipc/ops/shareout.c
r13dbaa8c rb1e6269 82 82 sysipc_ops_t ipc_m_share_out_ops = { 83 83 .request_preprocess = request_preprocess, 84 .request_forget = null_request_forget, 84 85 .request_process = null_request_process, 86 .answer_cleanup = null_answer_cleanup, 85 87 .answer_preprocess = answer_preprocess, 86 88 .answer_process = null_answer_process, -
kernel/generic/src/ipc/ops/stchngath.c
r13dbaa8c rb1e6269 118 118 sysipc_ops_t ipc_m_state_change_authorize_ops = { 119 119 .request_preprocess = request_preprocess, 120 .request_forget = null_request_forget, 120 121 .request_process = null_request_process, 122 .answer_cleanup = null_answer_cleanup, 121 123 .answer_preprocess = answer_preprocess, 122 124 .answer_process = null_answer_process, -
kernel/generic/src/ipc/sysipc.c
r13dbaa8c rb1e6269 160 160 { 161 161 int rc = EOK; 162 sysipc_ops_t *ops; 162 163 163 164 spinlock_lock(&answer->forget_lock); … … 167 168 */ 168 169 spinlock_unlock(&answer->forget_lock); 169 /* TODO: cleanup? */ 170 171 ops = sysipc_ops_get(answer->request_method); 172 if (ops->answer_cleanup) 173 ops->answer_cleanup(answer, olddata); 174 170 175 return rc; 171 176 } else { … … 198 203 199 204 200 sysipc_ops_t *ops = sysipc_ops_get(answer->request_method);205 ops = sysipc_ops_get(answer->request_method); 201 206 if (ops->answer_preprocess) 202 207 rc = ops->answer_preprocess(answer, olddata); -
kernel/generic/src/ipc/sysipc_ops.c
r13dbaa8c rb1e6269 64 64 static sysipc_ops_t null_ops = { 65 65 .request_preprocess = null_request_preprocess, 66 .request_forget = null_request_forget, 66 67 .request_process = null_request_process, 68 .answer_cleanup = null_answer_cleanup, 67 69 .answer_preprocess = null_answer_preprocess, 68 70 .answer_process = null_answer_process, … … 74 76 } 75 77 78 void null_request_forget(call_t *call) 79 { 80 } 81 76 82 int null_request_process(call_t *call, answerbox_t *box) 77 83 { 78 84 return EOK; 85 } 86 87 void null_answer_cleanup(call_t *call, ipc_data_t *data) 88 { 79 89 } 80 90
Note:
See TracChangeset
for help on using the changeset viewer.