Changes in uspace/srv/devman/devman.c [01b87dc5:96b02eb9] in mainline
- File:
-
- 1 edited
-
uspace/srv/devman/devman.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r01b87dc5 r96b02eb9 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_info68 = 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 74 64 static void devices_remove_callback(link_t *item) 75 65 { … … 85 75 .hash = devices_hash, 86 76 .compare = devmap_devices_compare, 87 .remove_callback = devices_remove_callback88 };89 90 static hash_table_operations_t devmap_devices_class_ops = {91 .hash = devices_hash,92 .compare = devmap_devices_class_compare,93 77 .remove_callback = devices_remove_callback 94 78 }; … … 384 368 printf(NAME ": create_root_node\n"); 385 369 386 fibril_rwlock_write_lock(&tree->rwlock);387 370 node = create_dev_node(); 388 371 if (node != NULL) { … … 394 377 tree->root_node = node; 395 378 } 396 fibril_rwlock_write_unlock(&tree->rwlock);397 379 398 380 return node != NULL; … … 457 439 /** Start a driver 458 440 * 441 * The driver's mutex is assumed to be locked. 442 * 459 443 * @param drv The driver's structure. 460 444 * @return True if the driver's task is successfully spawned, false … … 465 449 int rc; 466 450 467 assert(fibril_mutex_is_locked(&drv->driver_mutex));468 469 451 printf(NAME ": start_driver '%s'\n", drv->name); 470 452 … … 688 670 } 689 671 690 devmap_device_register_with_iface(devmap_pathname, 691 &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP); 672 devmap_device_register(devmap_pathname, &node->devmap_handle); 692 673 693 674 tree_add_devmap_device(tree, node); … … 861 842 /** Find the device node structure of the device witch has the specified handle. 862 843 * 844 * Device tree's rwlock should be held at least for reading. 845 * 863 846 * @param tree The device tree where we look for the device node. 864 847 * @param handle The handle of the device. … … 868 851 { 869 852 unsigned long key = handle; 870 link_t *link; 871 872 assert(fibril_rwlock_is_locked(&tree->rwlock)); 873 874 link = hash_table_find(&tree->devman_devices, &key); 853 link_t *link = hash_table_find(&tree->devman_devices, &key); 875 854 return hash_table_get_instance(link, node_t, devman_link); 876 855 } … … 928 907 /** Insert new device into device tree. 929 908 * 909 * The device tree's rwlock should be already held exclusively when calling this 910 * function. 911 * 930 912 * @param tree The device tree. 931 913 * @param node The newly added device node. … … 942 924 assert(tree != NULL); 943 925 assert(dev_name != NULL); 944 assert(fibril_rwlock_is_write_locked(&tree->rwlock));945 926 946 927 node->name = dev_name; … … 1061 1042 1062 1043 info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t)); 1063 if (info != NULL) {1044 if (info != NULL) 1064 1045 memset(info, 0, sizeof(dev_class_info_t)); 1065 list_initialize(&info->dev_classes);1066 list_initialize(&info->devmap_link);1067 list_initialize(&info->link);1068 }1069 1046 1070 1047 return info; … … 1190 1167 fibril_rwlock_initialize(&class_list->rwlock); 1191 1168 hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1, 1192 &devmap_devices_ class_ops);1169 &devmap_devices_ops); 1193 1170 } 1194 1171 … … 1238 1215 hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link); 1239 1216 fibril_rwlock_write_unlock(&class_list->rwlock); 1240 1241 assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);1242 1217 } 1243 1218
Note:
See TracChangeset
for help on using the changeset viewer.
