Changes in uspace/srv/devman/main.c [6e50466:7e752b2] in mainline
- File:
-
- 1 edited
-
uspace/srv/devman/main.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r6e50466 r7e752b2 74 74 75 75 iid = async_get_call(&icall); 76 if (IPC_GET_ IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) {76 if (IPC_GET_METHOD(icall) != DEVMAN_DRIVER_REGISTER) { 77 77 ipc_answer_0(iid, EREFUSED); 78 78 return NULL; … … 109 109 ipc_call_t call; 110 110 ipc_callid_t callid = async_get_call(&call); 111 if (IPC_GET_ IMETHOD(call) != IPC_M_CONNECT_TO_ME) {111 if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) { 112 112 ipc_answer_0(callid, ENOTSUP); 113 113 ipc_answer_0(iid, ENOTSUP); … … 141 141 142 142 callid = async_get_call(&call); 143 if (DEVMAN_ADD_MATCH_ID != IPC_GET_ IMETHOD(call)) {143 if (DEVMAN_ADD_MATCH_ID != IPC_GET_METHOD(call)) { 144 144 printf(NAME ": ERROR: devman_receive_match_id - invalid " 145 145 "protocol.\n"); … … 184 184 * @return Zero on success, negative error code otherwise. 185 185 */ 186 static int devman_receive_match_ids( sysarg_t match_count,186 static int devman_receive_match_ids(ipcarg_t match_count, 187 187 match_id_list_t *match_ids) 188 188 { … … 197 197 } 198 198 199 static int assign_driver_fibril(void *arg)200 {201 node_t *node = (node_t *) arg;202 assign_driver(node, &drivers_list, &device_tree);203 return EOK;204 }205 206 199 /** Handle child device registration. 207 200 * … … 211 204 { 212 205 devman_handle_t parent_handle = IPC_GET_ARG1(*call); 213 sysarg_t match_count = IPC_GET_ARG2(*call);206 ipcarg_t match_count = IPC_GET_ARG2(*call); 214 207 dev_tree_t *tree = &device_tree; 215 208 … … 244 237 245 238 devman_receive_match_ids(match_count, &node->match_ids); 246 247 /* 248 * Try to find a suitable driver and assign it to the device. We do 249 * not want to block the current fibril that is used for processing 250 * incoming calls: we will launch a separate fibril to handle the 251 * driver assigning. That is because assign_driver can actually include 252 * task spawning which could take some time. 253 */ 254 fid_t assign_fibril = fibril_create(assign_driver_fibril, node); 255 if (assign_fibril == 0) { 256 /* 257 * Fallback in case we are out of memory. 258 * Probably not needed as we will die soon anyway ;-). 259 */ 260 (void) assign_driver_fibril(node); 261 } else { 262 fibril_add_ready(assign_fibril); 263 } 264 239 265 240 /* Return device handle to parent's driver. */ 266 241 ipc_answer_1(callid, EOK, node->handle); 242 243 /* Try to find suitable driver and assign it to the device. */ 244 assign_driver(node, &drivers_list, &device_tree); 267 245 } 268 246 … … 281 259 * handle. 282 260 */ 283 devmap_device_register_with_iface(devmap_pathname, 284 &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP); 261 devmap_device_register(devmap_pathname, &cli->devmap_handle); 285 262 286 263 /* … … 320 297 printf(NAME ": device '%s' added to class '%s', class name '%s' was " 321 298 "asigned to it\n", dev->pathname, class_name, class_info->dev_name); 322 299 323 300 ipc_answer_0(callid, EOK); 324 301 } … … 368 345 callid = async_get_call(&call); 369 346 370 switch (IPC_GET_ IMETHOD(call)) {347 switch (IPC_GET_METHOD(call)) { 371 348 case IPC_M_PHONE_HUNGUP: 372 349 cont = false; … … 421 398 ipc_callid_t callid = async_get_call(&call); 422 399 423 switch (IPC_GET_ IMETHOD(call)) {400 switch (IPC_GET_METHOD(call)) { 424 401 case IPC_M_PHONE_HUNGUP: 425 402 cont = false; … … 487 464 static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall) 488 465 { 489 devmap_handle_t devmap_handle = IPC_GET_ ARG2(*icall);466 devmap_handle_t devmap_handle = IPC_GET_METHOD(*icall); 490 467 node_t *dev; 491 468 … … 504 481 } 505 482 483 printf(NAME ": devman_connection_devmapper: forward connection to " 484 "device %s to driver %s.\n", dev->pathname, dev->drv->name); 506 485 ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0, 507 486 IPC_FF_NONE); 508 printf(NAME ": devman_connection_devmapper: forwarded connection to "509 "device %s to driver %s.\n", dev->pathname, dev->drv->name);510 487 } 511 488 … … 513 490 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall) 514 491 { 492 /* 493 * Silly hack to enable the device manager to register as a driver by 494 * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this 495 * is not the forwarded connection from naming service, so it must be a 496 * connection from the devmapper which thinks this is a devmapper-style 497 * driver. So pretend this is a devmapper-style driver. (This does not 498 * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper 499 * passes device handle to the driver as an ipc method.) 500 */ 501 if (IPC_GET_METHOD(*icall) != IPC_M_CONNECT_ME_TO) 502 devman_connection_devmapper(iid, icall); 503 504 /* 505 * ipc method is IPC_M_CONNECT_ME_TO, so this is forwarded connection 506 * from naming service by which we registered as device manager, so be 507 * device manager. 508 */ 509 515 510 /* Select interface. */ 516 switch (( sysarg_t) (IPC_GET_ARG1(*icall))) {511 switch ((ipcarg_t) (IPC_GET_ARG1(*icall))) { 517 512 case DEVMAN_DRIVER: 518 513 devman_connection_driver(iid, icall); … … 525 520 devman_forward(iid, icall, false); 526 521 break; 527 case DEVMAN_CONNECT_FROM_DEVMAP:528 /* Someone connected through devmap node. */529 devman_connection_devmapper(iid, icall);530 break;531 522 case DEVMAN_CONNECT_TO_PARENTS_DEVICE: 532 523 /* Connect client to selected device. */ … … 586 577 587 578 /* Register device manager at naming service. */ 588 sysarg_t phonead;579 ipcarg_t phonead; 589 580 if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAN, 0, 0, &phonead) != 0) 590 581 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.
