Changeset 47a7174f in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2010-12-17T22:03:15Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7551706b
Parents:
0bff73a
Message:

Devmap drivers can customize forwarded connections

It is possible to set an extra parameter for forwarded connections through
devmap. The change shall ensure backward compatibility and allows to connect
to devman-style drivers through their devmap path.

File:
1 edited

Legend:

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

    r0bff73a r47a7174f  
    486486static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
    487487{
    488         devmap_handle_t devmap_handle = IPC_GET_IMETHOD(*icall);
     488        devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall);
    489489        node_t *dev;
    490490
     
    503503        }
    504504       
    505         printf(NAME ": devman_connection_devmapper: forward connection to "
    506             "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    507505        ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
    508506            IPC_FF_NONE);
     507        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     508            "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    509509}
    510510
     
    512512static void devman_connection(ipc_callid_t iid, ipc_call_t *icall)
    513513{
    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        
    532514        /* Select interface. */
    533515        switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     
    542524                devman_forward(iid, icall, false);
    543525                break;
     526        case DEVMAN_CONNECT_FROM_DEVMAP:
     527                /* Someone connected through devmap node. */
     528                devman_connection_devmapper(iid, icall);
     529                break;
    544530        case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
    545531                /* Connect client to selected device. */
Note: See TracChangeset for help on using the changeset viewer.