Changeset 557c7d0 in mainline for uspace/srv/devman
- Timestamp:
- 2010-12-19T10:12:49Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8dd039a, f568ee7
- Parents:
- 11658b64 (diff), 40dc422 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/srv/devman
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r11658b64 r557c7d0 62 62 } 63 63 64 static int devmap_devices_class_compare(unsigned long key[], hash_count_t keys, 65 link_t *item) 66 { 67 dev_class_info_t *class_info 68 = hash_table_get_instance(item, dev_class_info_t, devmap_link); 69 assert(class_info != NULL); 70 71 return (class_info->devmap_handle == (devmap_handle_t) key[0]); 72 } 73 64 74 static void devices_remove_callback(link_t *item) 65 75 { … … 75 85 .hash = devices_hash, 76 86 .compare = devmap_devices_compare, 87 .remove_callback = devices_remove_callback 88 }; 89 90 static hash_table_operations_t devmap_devices_class_ops = { 91 .hash = devices_hash, 92 .compare = devmap_devices_class_compare, 77 93 .remove_callback = devices_remove_callback 78 94 }; … … 678 694 } 679 695 680 devmap_device_register(devmap_pathname, &node->devmap_handle); 696 devmap_device_register_with_iface(devmap_pathname, 697 &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP); 681 698 682 699 tree_add_devmap_device(tree, node); … … 1050 1067 1051 1068 info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t)); 1052 if (info != NULL) 1069 if (info != NULL) { 1053 1070 memset(info, 0, sizeof(dev_class_info_t)); 1071 list_initialize(&info->dev_classes); 1072 list_initialize(&info->devmap_link); 1073 list_initialize(&info->link); 1074 } 1054 1075 1055 1076 return info; … … 1175 1196 fibril_rwlock_initialize(&class_list->rwlock); 1176 1197 hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1, 1177 &devmap_devices_ ops);1198 &devmap_devices_class_ops); 1178 1199 } 1179 1200 … … 1223 1244 hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link); 1224 1245 fibril_rwlock_write_unlock(&class_list->rwlock); 1246 1247 assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL); 1225 1248 } 1226 1249 -
uspace/srv/devman/main.c
r11658b64 r557c7d0 281 281 * handle. 282 282 */ 283 devmap_device_register(devmap_pathname, &cli->devmap_handle); 283 devmap_device_register_with_iface(devmap_pathname, 284 &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP); 284 285 285 286 /* … … 486 487 static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall) 487 488 { 488 devmap_handle_t devmap_handle = IPC_GET_ IMETHOD(*icall);489 devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall); 489 490 node_t *dev; 490 491 … … 503 504 } 504 505 505 printf(NAME ": devman_connection_devmapper: forward connection to "506 "device %s to driver %s.\n", dev->pathname, dev->drv->name);507 506 ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0, 508 507 IPC_FF_NONE); 508 printf(NAME ": devman_connection_devmapper: forwarded connection to " 509 "device %s to driver %s.\n", dev->pathname, dev->drv->name); 509 510 } 510 511 … … 512 513 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall) 513 514 { 514 /*515 * Silly hack to enable the device manager to register as a driver by516 * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this517 * is not the forwarded connection from naming service, so it must be a518 * connection from the devmapper which thinks this is a devmapper-style519 * driver. So pretend this is a devmapper-style driver. (This does not520 * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper521 * passes device handle to the driver as an ipc method.)522 */523 if (IPC_GET_IMETHOD(*icall) != IPC_M_CONNECT_ME_TO)524 devman_connection_devmapper(iid, icall);525 526 /*527 * ipc method is IPC_M_CONNECT_ME_TO, so this is forwarded connection528 * from naming service by which we registered as device manager, so be529 * device manager.530 */531 532 515 /* Select interface. */ 533 516 switch ((sysarg_t) (IPC_GET_ARG1(*icall))) { … … 542 525 devman_forward(iid, icall, false); 543 526 break; 527 case DEVMAN_CONNECT_FROM_DEVMAP: 528 /* Someone connected through devmap node. */ 529 devman_connection_devmapper(iid, icall); 530 break; 544 531 case DEVMAN_CONNECT_TO_PARENTS_DEVICE: 545 532 /* Connect client to selected device. */
Note:
See TracChangeset
for help on using the changeset viewer.