Changeset 1affcdf3 in mainline for uspace/srv/devmap/devmap.c


Ignore:
Timestamp:
2011-06-10T19:33:41Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1878386
Parents:
13ecdac9 (diff), 79a141a (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

File:
1 edited

Legend:

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

    r13ecdac9 r1affcdf3  
    3737
    3838#include <ipc/services.h>
    39 #include <ipc/ns.h>
     39#include <ns.h>
    4040#include <async.h>
    4141#include <stdio.h>
     
    5959        /** Pointers to previous and next drivers in linked list */
    6060        link_t drivers;
     61       
    6162        /** Pointer to the linked list of devices controlled by this driver */
    6263        link_t devices;
    63         /** Phone asociated with this driver */
    64         sysarg_t phone;
     64       
     65        /** Session asociated with this driver */
     66        async_sess_t *sess;
     67       
    6568        /** Device driver name */
    6669        char *name;
     70       
    6771        /** Fibril mutex for list of devices owned by this driver */
    6872        fibril_mutex_t devices_mutex;
     
    7579        /** Pointer to the previous and next device in the list of all namespaces */
    7680        link_t namespaces;
     81       
    7782        /** Unique namespace identifier */
    7883        devmap_handle_t handle;
     84       
    7985        /** Namespace name */
    8086        char *name;
     87       
    8188        /** Reference count */
    8289        size_t refcnt;
     
    405412         * Create connection to the driver
    406413         */
    407         ipc_call_t call;
    408         ipc_callid_t callid = async_get_call(&call);
    409        
    410         if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
     414        driver->sess = async_callback_receive(EXCHANGE_SERIALIZE);
     415        if (!driver->sess) {
    411416                free(driver->name);
    412417                free(driver);
    413                 async_answer_0(callid, ENOTSUP);
    414418                async_answer_0(iid, ENOTSUP);
    415419                return NULL;
    416420        }
    417        
    418         driver->phone = IPC_GET_ARG5(call);
    419         async_answer_0(callid, EOK);
    420421       
    421422        /*
     
    462463        fibril_mutex_lock(&drivers_list_mutex);
    463464       
    464         if (driver->phone != 0)
    465                 async_hangup(driver->phone);
     465        if (driver->sess)
     466                async_hangup(driver->sess);
    466467       
    467468        /* Remove it from list of drivers */
     
    607608        devmap_device_t *dev = devmap_device_find_handle(handle);
    608609       
    609         if ((dev == NULL) || (dev->driver == NULL) || (dev->driver->phone == 0)) {
     610        if ((dev == NULL) || (dev->driver == NULL) || (!dev->driver->sess)) {
    610611                fibril_mutex_unlock(&devices_list_mutex);
    611612                async_answer_0(callid, ENOENT);
     
    613614        }
    614615       
    615         if (dev->forward_interface == 0) {
    616                 async_forward_fast(callid, dev->driver->phone,
    617                     dev->handle, 0, 0,
    618                     IPC_FF_NONE);
    619         } else {
    620                 async_forward_fast(callid, dev->driver->phone,
    621                     dev->forward_interface, dev->handle, 0,
    622                     IPC_FF_NONE);
    623         }
     616        async_exch_t *exch = async_exchange_begin(dev->driver->sess);
     617       
     618        if (dev->forward_interface == 0)
     619                async_forward_fast(callid, exch, dev->handle, 0, 0, IPC_FF_NONE);
     620        else
     621                async_forward_fast(callid, exch, dev->forward_interface,
     622                    dev->handle, 0, IPC_FF_NONE);
     623       
     624        async_exchange_end(exch);
    624625       
    625626        fibril_mutex_unlock(&devices_list_mutex);
     
    10291030                return;
    10301031       
    1031         bool cont = true;
    1032         while (cont) {
     1032        while (true) {
    10331033                ipc_call_t call;
    10341034                ipc_callid_t callid = async_get_call(&call);
    10351035               
     1036                if (!IPC_GET_IMETHOD(call))
     1037                        break;
     1038               
    10361039                switch (IPC_GET_IMETHOD(call)) {
    1037                 case IPC_M_PHONE_HUNGUP:
    1038                         cont = false;
    1039                         continue;
    10401040                case DEVMAP_DRIVER_UNREGISTER:
    10411041                        if (NULL == driver)
     
    10801080        async_answer_0(iid, EOK);
    10811081       
    1082         bool cont = true;
    1083         while (cont) {
     1082        while (true) {
    10841083                ipc_call_t call;
    10851084                ipc_callid_t callid = async_get_call(&call);
    10861085               
     1086                if (!IPC_GET_IMETHOD(call))
     1087                        break;
     1088               
    10871089                switch (IPC_GET_IMETHOD(call)) {
    1088                 case IPC_M_PHONE_HUNGUP:
    1089                         cont = false;
    1090                         continue;
    10911090                case DEVMAP_DEVICE_GET_HANDLE:
    10921091                        devmap_device_get_handle(callid, &call);
Note: See TracChangeset for help on using the changeset viewer.