Changeset 3ca3430 in mainline


Ignore:
Timestamp:
2010-12-17T23:32:02Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6e50466
Parents:
7551706b
Message:

Bugfix in hash table usage in devman

The hash table with device class must use different comparing due to
different backend structures.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/devman.c

    r7551706b r3ca3430  
    6262}
    6363
     64static 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
    6474static void devices_remove_callback(link_t *item)
    6575{
     
    7585        .hash = devices_hash,
    7686        .compare = devmap_devices_compare,
     87        .remove_callback = devices_remove_callback
     88};
     89
     90static hash_table_operations_t devmap_devices_class_ops = {
     91        .hash = devices_hash,
     92        .compare = devmap_devices_class_compare,
    7793        .remove_callback = devices_remove_callback
    7894};
     
    10431059       
    10441060        info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
    1045         if (info != NULL)
     1061        if (info != NULL) {
    10461062                memset(info, 0, sizeof(dev_class_info_t));
     1063                list_initialize(&info->dev_classes);
     1064                list_initialize(&info->devmap_link);
     1065                list_initialize(&info->link);
     1066        }
    10471067       
    10481068        return info;
     
    11681188        fibril_rwlock_initialize(&class_list->rwlock);
    11691189        hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
    1170             &devmap_devices_ops);
     1190            &devmap_devices_class_ops);
    11711191}
    11721192
     
    12161236        hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
    12171237        fibril_rwlock_write_unlock(&class_list->rwlock);
     1238
     1239        assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
    12181240}
    12191241
Note: See TracChangeset for help on using the changeset viewer.