Changes in uspace/srv/devman/main.c [9934f7d:cc574511] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r9934f7d rcc574511 56 56 #include <ipc/driver.h> 57 57 #include <thread.h> 58 #include < devmap.h>58 #include <loc.h> 59 59 60 60 #include "devman.h" … … 326 326 } 327 327 } else { 328 devmap_register_tree_function(fun, tree);328 loc_register_tree_function(fun, tree); 329 329 } 330 330 … … 333 333 } 334 334 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)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) 343 343 return; 344 344 345 345 /* 346 * Register the device by the device mapper and remember its devmap347 * handle.346 * Register the device with location service and remember its 347 * service ID. 348 348 */ 349 devmap_device_register_with_iface(devmap_pathname,350 &cli-> devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);349 loc_service_register_with_iface(loc_pathname, 350 &cli->service_id, DEVMAN_CONNECT_FROM_LOC); 351 351 352 352 /* 353 * Add device to the hash map of class devices registered by device354 * mapper.353 * Add device to the hash map of class devices registered with 354 * location service. 355 355 */ 356 class_add_ devmap_function(&class_list, cli);357 358 free( devmap_pathname);356 class_add_loc_function(&class_list, cli); 357 358 free(loc_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; 364 366 365 367 /* Get class name. */ 366 368 char *class_name; 367 intrc = async_data_write_accept((void **) &class_name, true,369 rc = async_data_write_accept((void **) &class_name, true, 368 370 0, 0, 0, 0); 369 371 if (rc != EOK) { … … 381 383 dev_class_info_t *class_info = add_function_to_class(fun, cl, NULL); 382 384 383 /* Register the device's class alias by devmapper. */ 384 devmap_register_class_dev(class_info); 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 } 385 395 386 396 log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.", … … 659 669 } 660 670 661 /** Function for handling connections from a client forwarded by the device662 * mapperto 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);671 /** Function for handling connections from a client forwarded by the location 672 * service to 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); 666 676 fun_node_t *fun; 667 677 dev_node_t *dev; 668 678 669 fun = find_ devmap_tree_function(&device_tree, devmap_handle);679 fun = find_loc_tree_function(&device_tree, service_id); 670 680 if (fun == NULL) 671 fun = find_ devmap_class_function(&class_list, devmap_handle);681 fun = find_loc_class_function(&class_list, service_id); 672 682 673 683 if (fun == NULL || fun->dev->drv == NULL) { … … 689 699 690 700 log_msg(LVL_DEBUG, 691 "Forwarding devmapperrequest for `%s' function to driver `%s'.",701 "Forwarding loc service request for `%s' function to driver `%s'.", 692 702 fun->pathname, dev->drv->name); 693 703 } … … 708 718 devman_forward(iid, icall, false); 709 719 break; 710 case DEVMAN_CONNECT_FROM_ DEVMAP:711 /* Someone connected through devmapnode. */712 devman_connection_ devmapper(iid, icall);720 case DEVMAN_CONNECT_FROM_LOC: 721 /* Someone connected through loc node. */ 722 devman_connection_loc(iid, icall); 713 723 break; 714 724 case DEVMAN_CONNECT_TO_PARENTS_DEVICE: … … 746 756 747 757 /* 748 * !!! devman_connection ... as the device manager is not a real devmap758 * !!! devman_connection ... as the device manager is not a real loc 749 759 * driver (it uses a completely different ipc protocol than an ordinary 750 * devmapdriver) forwarding a connection from client to the devman by751 * devmapperwould not work.760 * loc driver) forwarding a connection from client to the devman by 761 * location service would not work. 752 762 */ 753 devmap_driver_register(NAME, devman_connection);763 loc_server_register(NAME, devman_connection); 754 764 755 765 return true; … … 760 770 printf(NAME ": HelenOS Device Manager\n"); 761 771 762 if (log_init(NAME, LVL_ ERROR) != EOK) {772 if (log_init(NAME, LVL_WARN) != EOK) { 763 773 printf(NAME ": Error initializing logging subsystem.\n"); 764 774 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.