Changes in uspace/srv/devman/main.c [cc574511:9934f7d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rcc574511 r9934f7d 56 56 #include <ipc/driver.h> 57 57 #include <thread.h> 58 #include < loc.h>58 #include <devmap.h> 59 59 60 60 #include "devman.h" … … 326 326 } 327 327 } else { 328 loc_register_tree_function(fun, tree);328 devmap_register_tree_function(fun, tree); 329 329 } 330 330 … … 333 333 } 334 334 335 static void loc_register_class_dev(dev_class_info_t *cli)336 { 337 /* Create loc path and name for the service. */338 char * loc_pathname = NULL;339 340 asprintf(& loc_pathname, "%s/%s%c%s", LOC_CLASS_NAMESPACE,341 cli->dev_class->name, LOC_SEPARATOR, cli->dev_name);342 if ( loc_pathname == NULL)335 static void devmap_register_class_dev(dev_class_info_t *cli) 336 { 337 /* Create devmap path and name for the device. */ 338 char *devmap_pathname = NULL; 339 340 asprintf(&devmap_pathname, "%s/%s%c%s", DEVMAP_CLASS_NAMESPACE, 341 cli->dev_class->name, DEVMAP_SEPARATOR, cli->dev_name); 342 if (devmap_pathname == NULL) 343 343 return; 344 344 345 345 /* 346 * Register the device with location service and remember its347 * service ID.346 * Register the device by the device mapper and remember its devmap 347 * handle. 348 348 */ 349 loc_service_register_with_iface(loc_pathname,350 &cli-> service_id, DEVMAN_CONNECT_FROM_LOC);349 devmap_device_register_with_iface(devmap_pathname, 350 &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP); 351 351 352 352 /* 353 * Add device to the hash map of class devices registered with354 * location service.353 * Add device to the hash map of class devices registered by device 354 * mapper. 355 355 */ 356 class_add_ loc_function(&class_list, cli);357 358 free( loc_pathname);356 class_add_devmap_function(&class_list, cli); 357 358 free(devmap_pathname); 359 359 } 360 360 … … 362 362 { 363 363 devman_handle_t handle = IPC_GET_ARG1(*call); 364 category_id_t cat_id;365 int rc;366 364 367 365 /* Get class name. */ 368 366 char *class_name; 369 rc = async_data_write_accept((void **) &class_name, true,367 int rc = async_data_write_accept((void **) &class_name, true, 370 368 0, 0, 0, 0); 371 369 if (rc != EOK) { … … 383 381 dev_class_info_t *class_info = add_function_to_class(fun, cl, NULL); 384 382 385 /* Register the device's class alias with location service. */ 386 loc_register_class_dev(class_info); 387 388 rc = loc_category_get_id(class_name, &cat_id, IPC_FLAG_BLOCKING); 389 if (rc == EOK) { 390 loc_service_add_to_cat(fun->service_id, cat_id); 391 } else { 392 log_msg(LVL_ERROR, "Failed adding function `%s' to category " 393 "`%s'.", fun->pathname, class_name); 394 } 383 /* Register the device's class alias by devmapper. */ 384 devmap_register_class_dev(class_info); 395 385 396 386 log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.", … … 669 659 } 670 660 671 /** Function for handling connections from a client forwarded by the location672 * serviceto the device manager. */673 static void devman_connection_ loc(ipc_callid_t iid, ipc_call_t *icall)674 { 675 service_id_t service_id= IPC_GET_ARG2(*icall);661 /** Function for handling connections from a client forwarded by the device 662 * mapper to the device manager. */ 663 static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall) 664 { 665 devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall); 676 666 fun_node_t *fun; 677 667 dev_node_t *dev; 678 668 679 fun = find_ loc_tree_function(&device_tree, service_id);669 fun = find_devmap_tree_function(&device_tree, devmap_handle); 680 670 if (fun == NULL) 681 fun = find_ loc_class_function(&class_list, service_id);671 fun = find_devmap_class_function(&class_list, devmap_handle); 682 672 683 673 if (fun == NULL || fun->dev->drv == NULL) { … … 699 689 700 690 log_msg(LVL_DEBUG, 701 "Forwarding loc servicerequest for `%s' function to driver `%s'.",691 "Forwarding devmapper request for `%s' function to driver `%s'.", 702 692 fun->pathname, dev->drv->name); 703 693 } … … 718 708 devman_forward(iid, icall, false); 719 709 break; 720 case DEVMAN_CONNECT_FROM_ LOC:721 /* Someone connected through locnode. */722 devman_connection_ loc(iid, icall);710 case DEVMAN_CONNECT_FROM_DEVMAP: 711 /* Someone connected through devmap node. */ 712 devman_connection_devmapper(iid, icall); 723 713 break; 724 714 case DEVMAN_CONNECT_TO_PARENTS_DEVICE: … … 756 746 757 747 /* 758 * !!! devman_connection ... as the device manager is not a real loc748 * !!! devman_connection ... as the device manager is not a real devmap 759 749 * driver (it uses a completely different ipc protocol than an ordinary 760 * locdriver) forwarding a connection from client to the devman by761 * location servicewould not work.750 * devmap driver) forwarding a connection from client to the devman by 751 * devmapper would not work. 762 752 */ 763 loc_server_register(NAME, devman_connection);753 devmap_driver_register(NAME, devman_connection); 764 754 765 755 return true; … … 770 760 printf(NAME ": HelenOS Device Manager\n"); 771 761 772 if (log_init(NAME, LVL_ WARN) != EOK) {762 if (log_init(NAME, LVL_ERROR) != EOK) { 773 763 printf(NAME ": Error initializing logging subsystem.\n"); 774 764 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.