Changeset 557c7d0 in mainline for uspace/srv/devman


Ignore:
Timestamp:
2010-12-19T10:12:49Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
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.
Message:

Merge mainline changes

Location:
uspace/srv/devman
Files:
2 edited

Legend:

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

    r11658b64 r557c7d0  
    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};
     
    678694        }
    679695       
    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);
    681698       
    682699        tree_add_devmap_device(tree, node);
     
    10501067       
    10511068        info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
    1052         if (info != NULL)
     1069        if (info != NULL) {
    10531070                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        }
    10541075       
    10551076        return info;
     
    11751196        fibril_rwlock_initialize(&class_list->rwlock);
    11761197        hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
    1177             &devmap_devices_ops);
     1198            &devmap_devices_class_ops);
    11781199}
    11791200
     
    12231244        hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
    12241245        fibril_rwlock_write_unlock(&class_list->rwlock);
     1246
     1247        assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
    12251248}
    12261249
  • uspace/srv/devman/main.c

    r11658b64 r557c7d0  
    281281         * handle.
    282282         */
    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);
    284285       
    285286        /*
     
    486487static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
    487488{
    488         devmap_handle_t devmap_handle = IPC_GET_IMETHOD(*icall);
     489        devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall);
    489490        node_t *dev;
    490491
     
    503504        }
    504505       
    505         printf(NAME ": devman_connection_devmapper: forward connection to "
    506             "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    507506        ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
    508507            IPC_FF_NONE);
     508        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     509            "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    509510}
    510511
     
    512513static void devman_connection(ipc_callid_t iid, ipc_call_t *icall)
    513514{
    514         /*
    515          * Silly hack to enable the device manager to register as a driver by
    516          * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this
    517          * is not the forwarded connection from naming service, so it must be a
    518          * connection from the devmapper which thinks this is a devmapper-style
    519          * driver. So pretend this is a devmapper-style driver. (This does not
    520          * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper
    521          * 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 connection
    528          * from naming service by which we registered as device manager, so be
    529          * device manager.
    530          */
    531        
    532515        /* Select interface. */
    533516        switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     
    542525                devman_forward(iid, icall, false);
    543526                break;
     527        case DEVMAN_CONNECT_FROM_DEVMAP:
     528                /* Someone connected through devmap node. */
     529                devman_connection_devmapper(iid, icall);
     530                break;
    544531        case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
    545532                /* Connect client to selected device. */
Note: See TracChangeset for help on using the changeset viewer.