Changeset 984a9ba in mainline for uspace/srv/ns
- Timestamp:
- 2018-07-05T09:34:09Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63d46341
- Parents:
- 76f566d
- Location:
- uspace/srv/ns
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/ns/clonable.c
r76f566d r984a9ba 48 48 service_t service; 49 49 iface_t iface; 50 cap_call_handle_t chandle; 51 sysarg_t arg3; 50 ipc_call_t call; 52 51 } cs_req_t; 53 52 … … 74 73 * 75 74 */ 76 void register_clonable(service_t service, sysarg_t phone, ipc_call_t *call, 77 cap_call_handle_t chandle) 75 void register_clonable(service_t service, sysarg_t phone, ipc_call_t *call) 78 76 { 79 77 link_t *req_link = list_first(&cs_req); … … 81 79 /* There was no pending connection request. */ 82 80 printf("%s: Unexpected clonable server.\n", NAME); 83 async_answer_0(c handle, EBUSY);81 async_answer_0(call, EBUSY); 84 82 return; 85 83 } … … 91 89 assert(csr->service == SERVICE_LOADER); 92 90 93 async_answer_0(c handle, EOK);91 async_answer_0(call, EOK); 94 92 95 93 async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE); 96 94 if (sess == NULL) 97 async_answer_0(c handle, EIO);95 async_answer_0(call, EIO); 98 96 99 97 async_exch_t *exch = async_exchange_begin(sess); 100 async_forward_fast( csr->chandle, exch, csr->iface, csr->arg3, 0,101 IPC_ FF_NONE);98 async_forward_fast(&csr->call, exch, csr->iface, 99 IPC_GET_ARG3(csr->call), 0, IPC_FF_NONE); 102 100 async_exchange_end(exch); 103 101 … … 108 106 /** Connect client to clonable service. 109 107 * 110 * @param service Service to be connected to. 111 * @param iface Interface to be connected to. 112 * @param call Pointer to call structure. 113 * @param chandle Call handle of the request. 108 * @param service Service to be connected to. 109 * @param iface Interface to be connected to. 110 * @param call Pointer to call structure. 114 111 * 115 112 * @return Zero on success or a value from @ref errno.h. 116 113 * 117 114 */ 118 void connect_to_clonable(service_t service, iface_t iface, ipc_call_t *call, 119 cap_call_handle_t chandle) 115 void connect_to_clonable(service_t service, iface_t iface, ipc_call_t *call) 120 116 { 121 117 assert(service == SERVICE_LOADER); … … 123 119 cs_req_t *csr = malloc(sizeof(cs_req_t)); 124 120 if (csr == NULL) { 125 async_answer_0(c handle, ENOMEM);121 async_answer_0(call, ENOMEM); 126 122 return; 127 123 } … … 132 128 if (rc != EOK) { 133 129 free(csr); 134 async_answer_0(c handle, rc);130 async_answer_0(call, rc); 135 131 return; 136 132 } … … 139 135 csr->service = service; 140 136 csr->iface = iface; 141 csr->chandle = chandle; 142 csr->arg3 = IPC_GET_ARG3(*call); 137 csr->call = *call; 143 138 144 139 /* -
uspace/srv/ns/clonable.h
r76f566d r984a9ba 42 42 43 43 extern bool service_clonable(service_t); 44 extern void register_clonable(service_t, sysarg_t, ipc_call_t *, 45 cap_call_handle_t); 46 extern void connect_to_clonable(service_t, iface_t, ipc_call_t *, cap_call_handle_t); 44 extern void register_clonable(service_t, sysarg_t, ipc_call_t *); 45 extern void connect_to_clonable(service_t, iface_t, ipc_call_t *); 47 46 48 47 #endif -
uspace/srv/ns/ns.c
r76f566d r984a9ba 49 49 #include "task.h" 50 50 51 static void ns_connection( cap_call_handle_t icall_handle,ipc_call_t *icall, void *arg)51 static void ns_connection(ipc_call_t *icall, void *arg) 52 52 { 53 53 ipc_call_t call; 54 cap_call_handle_t chandle;55 54 iface_t iface; 56 55 service_t service; … … 63 62 */ 64 63 if (service_clonable(service)) { 65 connect_to_clonable(service, iface, icall , icall_handle);64 connect_to_clonable(service, iface, icall); 66 65 } else { 67 connect_to_service(service, iface, icall , icall_handle);66 connect_to_service(service, iface, icall); 68 67 } 69 68 return; 70 69 } 71 70 72 async_answer_0(icall _handle, EOK);71 async_answer_0(icall, EOK); 73 72 74 73 while (true) { 75 74 process_pending_conn(); 76 75 77 chandle =async_get_call(&call);76 async_get_call(&call); 78 77 if (!IPC_GET_IMETHOD(call)) 79 78 break; … … 94 93 */ 95 94 if (service_clonable(service)) { 96 register_clonable(service, phone, &call , chandle);95 register_clonable(service, phone, &call); 97 96 continue; 98 97 } else { … … 107 106 id = (task_id_t) 108 107 MERGE_LOUP32(IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 109 wait_for_task(id, &call , chandle);108 wait_for_task(id, &call); 110 109 continue; 111 110 case NS_ID_INTRO: … … 121 120 } 122 121 123 async_answer_0( chandle, retval);122 async_answer_0(&call, retval); 124 123 } 125 124 -
uspace/srv/ns/service.c
r76f566d r984a9ba 89 89 service_t service; /**< Service ID */ 90 90 iface_t iface; /**< Interface ID */ 91 cap_call_handle_t chandle; /**< Call handle waiting for the connection */ 92 sysarg_t arg3; /**< Third argument */ 91 ipc_call_t call; /**< Call waiting for the connection */ 93 92 } pending_conn_t; 94 93 … … 119 118 hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link); 120 119 async_exch_t *exch = async_exchange_begin(hashed_service->sess); 121 async_forward_fast( pending->chandle, exch, pending->iface,122 pending->arg3, 0, IPC_FF_NONE);120 async_forward_fast(&pending->call, exch, pending->iface, 121 IPC_GET_ARG3(pending->call), 0, IPC_FF_NONE); 123 122 async_exchange_end(exch); 124 123 … … 163 162 * @param iface Interface to be connected to. 164 163 * @param call Pointer to call structure. 165 * @param chandle Call handle of the request.166 164 * 167 165 * @return Zero on success or a value from @ref errno.h. 168 166 * 169 167 */ 170 void connect_to_service(service_t service, iface_t iface, ipc_call_t *call, 171 cap_call_handle_t chandle) 172 { 173 sysarg_t arg3 = IPC_GET_ARG3(*call); 168 void connect_to_service(service_t service, iface_t iface, ipc_call_t *call) 169 { 174 170 sysarg_t flags = IPC_GET_ARG4(*call); 175 171 errno_t retval; … … 189 185 pending->service = service; 190 186 pending->iface = iface; 191 pending->chandle = chandle; 192 pending->arg3 = arg3; 187 pending->call = *call; 193 188 194 189 list_append(&pending->link, &pending_conn); … … 202 197 hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link); 203 198 async_exch_t *exch = async_exchange_begin(hashed_service->sess); 204 async_forward_fast(c handle, exch, iface, arg3, 0, IPC_FF_NONE);199 async_forward_fast(call, exch, iface, IPC_GET_ARG3(*call), 0, IPC_FF_NONE); 205 200 async_exchange_end(exch); 206 201 return; 207 202 208 203 out: 209 async_answer_0(c handle, retval);204 async_answer_0(call, retval); 210 205 } 211 206 -
uspace/srv/ns/service.h
r76f566d r984a9ba 42 42 43 43 extern errno_t register_service(service_t, sysarg_t, ipc_call_t *); 44 extern void connect_to_service(service_t, iface_t, ipc_call_t * , cap_call_handle_t);44 extern void connect_to_service(service_t, iface_t, ipc_call_t *); 45 45 46 46 #endif -
uspace/srv/ns/task.c
r76f566d r984a9ba 145 145 typedef struct { 146 146 link_t link; 147 task_id_t id; ///< Task ID148 cap_call_handle_t chandle; ///< Call handle waiting for the connection147 task_id_t id; /**< Task ID */ 148 ipc_call_t call; /**< Call waiting for the connection */ 149 149 } pending_wait_t; 150 150 … … 184 184 texit = ht->have_rval ? TASK_EXIT_NORMAL : 185 185 TASK_EXIT_UNEXPECTED; 186 async_answer_2( pr->chandle, EOK, texit, ht->retval);186 async_answer_2(&pr->call, EOK, texit, ht->retval); 187 187 188 188 list_remove(&pr->link); … … 192 192 } 193 193 194 void wait_for_task(task_id_t id, ipc_call_t *call , cap_call_handle_t chandle)194 void wait_for_task(task_id_t id, ipc_call_t *call) 195 195 { 196 196 ht_link_t *link = hash_table_find(&task_hash_table, &id); … … 200 200 if (ht == NULL) { 201 201 /* No such task exists. */ 202 async_answer_0(c handle, ENOENT);202 async_answer_0(call, ENOENT); 203 203 return; 204 204 } … … 207 207 task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL : 208 208 TASK_EXIT_UNEXPECTED; 209 async_answer_2(c handle, EOK, texit, ht->retval);209 async_answer_2(call, EOK, texit, ht->retval); 210 210 return; 211 211 } … … 215 215 (pending_wait_t *) malloc(sizeof(pending_wait_t)); 216 216 if (!pr) { 217 async_answer_0(c handle, ENOMEM);217 async_answer_0(call, ENOMEM); 218 218 return; 219 219 } … … 221 221 link_initialize(&pr->link); 222 222 pr->id = id; 223 pr->c handle = chandle;223 pr->call = *call; 224 224 list_append(&pr->link, &pending_wait); 225 225 } -
uspace/srv/ns/task.h
r76f566d r984a9ba 40 40 extern void process_pending_wait(void); 41 41 42 extern void wait_for_task(task_id_t, ipc_call_t * , cap_call_handle_t);42 extern void wait_for_task(task_id_t, ipc_call_t *); 43 43 44 44 extern errno_t ns_task_id_intro(ipc_call_t *); 45 45 extern errno_t ns_task_disconnect(ipc_call_t *); 46 46 extern errno_t ns_task_retval(ipc_call_t *); 47 48 47 49 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
