Changeset f9b2cb4c in mainline for uspace/lib/c/generic/devman.c


Ignore:
Timestamp:
2015-08-23T12:50:23Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ef495f
Parents:
0dd16778
Message:

unify interface API

  • introduce new interfaces
  • unify location service clients to always expect service ID as the second argument
  • remove obsolete methods that take explicit exchange management arguments (first phase)
  • use interfaces in device drivers, devman, location service, logger, inet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/devman.c

    r0dd16778 rf9b2cb4c  
    7777 *
    7878 */
    79 async_exch_t *devman_exchange_begin_blocking(devman_interface_t iface)
     79async_exch_t *devman_exchange_begin_blocking(iface_t iface)
    8080{
    8181        switch (iface) {
    82         case DEVMAN_DRIVER:
     82        case INTERFACE_DDF_DRIVER:
    8383                fibril_mutex_lock(&devman_driver_block_mutex);
    8484               
     
    8989                        if (devman_driver_block_sess == NULL)
    9090                                devman_driver_block_sess =
    91                                     service_connect_blocking_iface(EXCHANGE_PARALLEL,
    92                                     DEVMAN_DRIVER, SERVICE_DEVMAN, 0);
     91                                    service_connect_blocking(SERVICE_DEVMAN,
     92                                    INTERFACE_DDF_DRIVER, 0);
    9393                }
    9494               
     
    9999               
    100100                return async_exchange_begin(devman_driver_block_sess);
    101         case DEVMAN_CLIENT:
     101        case INTERFACE_DDF_CLIENT:
    102102                fibril_mutex_lock(&devman_client_block_mutex);
    103103               
     
    108108                        if (devman_client_block_sess == NULL)
    109109                                devman_client_block_sess =
    110                                     service_connect_blocking_iface(EXCHANGE_SERIALIZE,
    111                                     DEVMAN_CLIENT, SERVICE_DEVMAN, 0);
     110                                    service_connect_blocking(SERVICE_DEVMAN,
     111                                    INTERFACE_DDF_CLIENT, 0);
    112112                }
    113113               
     
    130130 *
    131131 */
    132 async_exch_t *devman_exchange_begin(devman_interface_t iface)
     132async_exch_t *devman_exchange_begin(iface_t iface)
    133133{
    134134        switch (iface) {
    135         case DEVMAN_DRIVER:
     135        case INTERFACE_DDF_DRIVER:
    136136                fibril_mutex_lock(&devman_driver_mutex);
    137137               
    138138                if (devman_driver_sess == NULL)
    139139                        devman_driver_sess =
    140                             service_connect_iface(EXCHANGE_PARALLEL, DEVMAN_DRIVER,
    141                             SERVICE_DEVMAN, 0);
     140                            service_connect(SERVICE_DEVMAN,
     141                            INTERFACE_DDF_DRIVER, 0);
    142142               
    143143                fibril_mutex_unlock(&devman_driver_mutex);
     
    147147               
    148148                return async_exchange_begin(devman_driver_sess);
    149         case DEVMAN_CLIENT:
     149        case INTERFACE_DDF_CLIENT:
    150150                fibril_mutex_lock(&devman_client_mutex);
    151151               
    152152                if (devman_client_sess == NULL)
    153153                        devman_client_sess =
    154                             service_connect_iface(EXCHANGE_SERIALIZE, DEVMAN_CLIENT,
    155                             SERVICE_DEVMAN, 0);
     154                            service_connect(SERVICE_DEVMAN,
     155                            INTERFACE_DDF_CLIENT, 0);
    156156               
    157157                fibril_mutex_unlock(&devman_client_mutex);
     
    179179int devman_driver_register(const char *name)
    180180{
    181         async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
     181        async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
    182182       
    183183        ipc_call_t answer;
     
    192192        }
    193193       
    194         exch = devman_exchange_begin(DEVMAN_DRIVER);
    195         async_connect_to_me(exch, 0, 0, 0, NULL, NULL);
     194        exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
     195        async_connect_to_me(exch, 0, 0, 0);
    196196        devman_exchange_end(exch);
    197197       
     
    218218{
    219219        int match_count = list_count(&match_ids->ids);
    220         async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
     220        async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
    221221       
    222222        ipc_call_t answer;
     
    268268    const char *cat_name)
    269269{
    270         async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
     270        async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
    271271       
    272272        ipc_call_t answer;
     
    287287}
    288288
    289 async_sess_t *devman_device_connect(exch_mgmt_t mgmt, devman_handle_t handle,
    290     unsigned int flags)
     289async_sess_t *devman_device_connect(devman_handle_t handle, unsigned int flags)
    291290{
    292291        async_sess_t *sess;
    293292       
    294293        if (flags & IPC_FLAG_BLOCKING)
    295                 sess = service_connect_blocking_iface(mgmt, DEVMAN_CONNECT_TO_DEVICE,
    296                     SERVICE_DEVMAN, handle);
     294                sess = service_connect_blocking(SERVICE_DEVMAN,
     295                    INTERFACE_DEVMAN_DEVICE, handle);
    297296        else
    298                 sess = service_connect_iface(mgmt, DEVMAN_CONNECT_TO_DEVICE,
    299                     SERVICE_DEVMAN, handle);
     297                sess = service_connect(SERVICE_DEVMAN,
     298                    INTERFACE_DEVMAN_DEVICE, handle);
    300299       
    301300        return sess;
     
    314313        sysarg_t retval;
    315314       
    316         exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
     315        exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
    317316        retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh);
    318317        devman_exchange_end(exch);
     
    323322int devman_drv_fun_online(devman_handle_t funh)
    324323{
    325         async_exch_t *exch = devman_exchange_begin(DEVMAN_DRIVER);
     324        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
    326325        if (exch == NULL)
    327326                return ENOMEM;
     
    335334int devman_drv_fun_offline(devman_handle_t funh)
    336335{
    337         async_exch_t *exch = devman_exchange_begin(DEVMAN_DRIVER);
     336        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
    338337        if (exch == NULL)
    339338                return ENOMEM;
     
    345344}
    346345
    347 async_sess_t *devman_parent_device_connect(exch_mgmt_t mgmt,
    348     devman_handle_t handle, unsigned int flags)
     346async_sess_t *devman_parent_device_connect(devman_handle_t handle,
     347    unsigned int flags)
    349348{
    350349        async_sess_t *sess;
    351350       
    352351        if (flags & IPC_FLAG_BLOCKING)
    353                 sess = service_connect_blocking_iface(mgmt,
    354                             DEVMAN_CONNECT_TO_PARENTS_DEVICE, SERVICE_DEVMAN, handle);
     352                sess = service_connect_blocking(SERVICE_DEVMAN,
     353                    INTERFACE_DEVMAN_PARENT, handle);
    355354        else
    356                 sess = service_connect_iface(mgmt,
    357                             DEVMAN_CONNECT_TO_PARENTS_DEVICE, SERVICE_DEVMAN, handle);
     355                sess = service_connect_blocking(SERVICE_DEVMAN,
     356                    INTERFACE_DEVMAN_PARENT, handle);
    358357       
    359358        return sess;
     
    366365       
    367366        if (flags & IPC_FLAG_BLOCKING)
    368                 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
     367                exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
    369368        else {
    370                 exch = devman_exchange_begin(DEVMAN_CLIENT);
     369                exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    371370                if (exch == NULL)
    372371                        return ENOMEM;
     
    409408        sysarg_t dretval;
    410409       
    411         exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
     410        exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
    412411       
    413412        ipc_call_t answer;
     
    474473int devman_fun_online(devman_handle_t funh)
    475474{
    476         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     475        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    477476        if (exch == NULL)
    478477                return ENOMEM;
     
    486485int devman_fun_offline(devman_handle_t funh)
    487486{
    488         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     487        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    489488        if (exch == NULL)
    490489                return ENOMEM;
     
    499498    devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
    500499{
    501         async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
     500        async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
    502501
    503502        ipc_call_t answer;
     
    578577int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
    579578{
    580         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     579        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    581580        if (exch == NULL)
    582581                return ENOMEM;
     
    598597int devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)
    599598{
    600         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     599        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    601600        if (exch == NULL)
    602601                return ENOMEM;
     
    611610int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
    612611{
    613         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     612        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    614613        if (exch == NULL)
    615614                return ENOMEM;
     
    639638        async_exch_t *exch;
    640639
    641         exch = devman_exchange_begin(DEVMAN_CLIENT);
     640        exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    642641        if (exch == NULL)
    643642                return ENOMEM;
     
    694693{
    695694        sysarg_t state;
    696         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     695        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    697696        if (exch == NULL)
    698697                return ENOMEM;
     
    711710int devman_driver_load(devman_handle_t drvh)
    712711{
    713         async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     712        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
    714713        if (exch == NULL)
    715714                return ENOMEM;
Note: See TracChangeset for help on using the changeset viewer.