Changeset f9b2cb4c in mainline for uspace/srv


Ignore:
Timestamp:
2015-08-23T12:50:23Z (10 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
Location:
uspace/srv
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/part/guid_part/guid_part.c

    r0dd16778 rf9b2cb4c  
    339339
    340340        /* Get the device handle. */
    341         dh = IPC_GET_ARG1(*icall);
    342 
    343         /* 
     341        dh = IPC_GET_ARG2(*icall);
     342
     343        /*
    344344         * Determine which partition device is the client connecting to.
    345345         * A linear search is not terribly fast, but we only do this
  • uspace/srv/bd/part/mbr_part/mbr_part.c

    r0dd16778 rf9b2cb4c  
    416416
    417417        /* Get the device handle. */
    418         dh = IPC_GET_ARG1(*icall);
    419 
    420         /* 
     418        dh = IPC_GET_ARG2(*icall);
     419
     420        /*
    421421         * Determine which partition device is the client connecting to.
    422422         * A linear search is not terribly fast, but we only do this
  • uspace/srv/bd/sata_bd/sata_bd.c

    r0dd16778 rf9b2cb4c  
    172172
    173173        /* Get the device service ID. */
    174         dsid = IPC_GET_ARG1(*icall);
     174        dsid = IPC_GET_ARG2(*icall);
    175175
    176176        /* Determine which disk device is the client connecting to. */
  • uspace/srv/devman/client_conn.c

    r0dd16778 rf9b2cb4c  
    726726
    727727/** Function for handling connections from a client to the device manager. */
    728 void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall)
     728void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    729729{
    730730        /* Accept connection. */
  • uspace/srv/devman/client_conn.h

    r0dd16778 rf9b2cb4c  
    3636#include "devman.h"
    3737
    38 extern void devman_connection_client(ipc_callid_t, ipc_call_t *);
     38extern void devman_connection_client(ipc_callid_t, ipc_call_t *, void *);
    3939
    4040#endif
  • uspace/srv/devman/driver.c

    r0dd16778 rf9b2cb4c  
    3636#include <sys/stat.h>
    3737#include <io/log.h>
    38 #include <ipc/driver.h>
    3938#include <loc.h>
    4039#include <str_error.h>
     
    573572       
    574573        if (rc != EOK) {
    575                 /* TODO handle error */
    576         }
    577 
    578         /* Wait for answer from the driver. */
    579         async_wait_for(req, &rc);
    580 
    581         switch(rc) {
     574                async_forget(req);
     575        } else {
     576                /* Wait for answer from the driver. */
     577                async_wait_for(req, &rc);
     578        }
     579
     580        switch (rc) {
    582581        case EOK:
    583582                dev->state = DEVICE_USABLE;
     
    592591       
    593592        dev->passed_to_driver = true;
    594 
    595         return;
    596593}
    597594
  • uspace/srv/devman/drv_conn.c

    r0dd16778 rf9b2cb4c  
    4949#include <io/log.h>
    5050#include <ipc/devman.h>
    51 #include <ipc/driver.h>
    5251#include <loc.h>
    5352
     
    131130        }
    132131        /* FIXME: Work around problem with callback sessions */
    133         async_sess_args_set(driver->sess, DRIVER_DEVMAN, 0, 0);
     132        async_sess_args_set(driver->sess, INTERFACE_DDF_DEVMAN, 0, 0);
    134133       
    135134        log_msg(LOG_DEFAULT, LVL_NOTE,
     
    587586
    588587/** Function for handling connections from a driver to the device manager. */
    589 void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall)
     588void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    590589{
    591590        client_t *client;
  • uspace/srv/devman/drv_conn.h

    r0dd16778 rf9b2cb4c  
    3737#include "devman.h"
    3838
    39 extern void devman_connection_driver(ipc_callid_t, ipc_call_t *);
     39extern void devman_connection_driver(ipc_callid_t, ipc_call_t *, void *);
    4040
    4141#endif
  • uspace/srv/devman/loc.c

    r0dd16778 rf9b2cb4c  
    5959        }
    6060       
    61         loc_service_register_with_iface(loc_pathname,
    62             &fun->service_id, INTERFACE_DDF_CLIENT);
     61        loc_service_register(loc_pathname, &fun->service_id);
    6362       
    6463        tree_add_loc_function(tree, fun);
  • uspace/srv/devman/main.c

    r0dd16778 rf9b2cb4c  
    4949#include <io/log.h>
    5050#include <ipc/devman.h>
    51 #include <ipc/driver.h>
    5251#include <loc.h>
    5352
     
    6665dev_tree_t device_tree;
    6766
    68 static void devman_forward(ipc_callid_t iid, ipc_call_t *icall,
    69     bool drv_to_parent)
     67static void devman_connection_device(ipc_callid_t iid, ipc_call_t *icall,
     68    void *arg)
    7069{
    7170        devman_handle_t handle = IPC_GET_ARG2(*icall);
    72         devman_handle_t fwd_h;
    73         fun_node_t *fun = NULL;
    7471        dev_node_t *dev = NULL;
    7572       
    76         fun = find_fun_node(&device_tree, handle);
    77         if (fun == NULL)
     73        fun_node_t *fun = find_fun_node(&device_tree, handle);
     74        if (fun == NULL) {
    7875                dev = find_dev_node(&device_tree, handle);
    79         else {
     76        } else {
    8077                fibril_rwlock_read_lock(&device_tree.rwlock);
     78               
    8179                dev = fun->dev;
    8280                if (dev != NULL)
    8381                        dev_add_ref(dev);
     82               
    8483                fibril_rwlock_read_unlock(&device_tree.rwlock);
    8584        }
    86 
     85       
    8786        /*
    8887         * For a valid function to connect to we need a device. The root
     
    9796                goto cleanup;
    9897        }
    99 
    100         if (fun == NULL && !drv_to_parent) {
     98       
     99        if (fun == NULL) {
    101100                log_msg(LOG_DEFAULT, LVL_ERROR, NAME ": devman_forward error - cannot "
    102101                    "connect to handle %" PRIun ", refers to a device.",
     
    106105        }
    107106       
    108         driver_t *driver = NULL;
    109        
    110107        fibril_rwlock_read_lock(&device_tree.rwlock);
    111108       
    112         if (drv_to_parent) {
    113                 /* Connect to parent function of a device (or device function). */
    114                 if (dev->pfun->dev != NULL)
    115                         driver = dev->pfun->dev->drv;
    116                
    117                 fwd_h = dev->pfun->handle;
    118         } else {
    119                 /* Connect to the specified function */
    120                 driver = dev->drv;
    121                 fwd_h = handle;
    122         }
     109        /* Connect to the specified function */
     110        driver_t *driver = dev->drv;
    123111       
    124112        fibril_rwlock_read_unlock(&device_tree.rwlock);
     
    130118                goto cleanup;
    131119        }
    132        
    133         int method;
    134         if (drv_to_parent)
    135                 method = DRIVER_DRIVER;
    136         else
    137                 method = DRIVER_CLIENT;
    138120       
    139121        if (!driver->sess) {
     
    143125                goto cleanup;
    144126        }
    145 
     127       
    146128        if (fun != NULL) {
    147129                log_msg(LOG_DEFAULT, LVL_DEBUG,
     
    155137       
    156138        async_exch_t *exch = async_exchange_begin(driver->sess);
    157         async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE);
     139        async_forward_fast(iid, exch, INTERFACE_DDF_CLIENT, handle, 0, IPC_FF_NONE);
    158140        async_exchange_end(exch);
    159141       
     
    166148}
    167149
    168 /** Function for handling connections from a client forwarded by the location
    169  * service to the device manager. */
    170 static void devman_connection_loc(ipc_callid_t iid, ipc_call_t *icall)
    171 {
     150static void devman_connection_parent(ipc_callid_t iid, ipc_call_t *icall,
     151    void *arg)
     152{
     153        devman_handle_t handle = IPC_GET_ARG2(*icall);
     154        dev_node_t *dev = NULL;
     155       
     156        fun_node_t *fun = find_fun_node(&device_tree, handle);
     157        if (fun == NULL) {
     158                dev = find_dev_node(&device_tree, handle);
     159        } else {
     160                fibril_rwlock_read_lock(&device_tree.rwlock);
     161               
     162                dev = fun->dev;
     163                if (dev != NULL)
     164                        dev_add_ref(dev);
     165               
     166                fibril_rwlock_read_unlock(&device_tree.rwlock);
     167        }
     168       
     169        /*
     170         * For a valid function to connect to we need a device. The root
     171         * function, for example, has no device and cannot be connected to.
     172         * This means @c dev needs to be valid regardless whether we are
     173         * connecting to a device or to a function.
     174         */
     175        if (dev == NULL) {
     176                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or "
     177                    "function with handle %" PRIun " was found.", handle);
     178                async_answer_0(iid, ENOENT);
     179                goto cleanup;
     180        }
     181       
     182        driver_t *driver = NULL;
     183       
     184        fibril_rwlock_read_lock(&device_tree.rwlock);
     185       
     186        /* Connect to parent function of a device (or device function). */
     187        if (dev->pfun->dev != NULL)
     188                driver = dev->pfun->dev->drv;
     189       
     190        devman_handle_t fun_handle = dev->pfun->handle;
     191       
     192        fibril_rwlock_read_unlock(&device_tree.rwlock);
     193       
     194        if (driver == NULL) {
     195                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - " \
     196                    "the device %" PRIun " is not in usable state.", handle);
     197                async_answer_0(iid, ENOENT);
     198                goto cleanup;
     199        }
     200       
     201        if (!driver->sess) {
     202                log_msg(LOG_DEFAULT, LVL_ERROR,
     203                    "Could not forward to driver `%s'.", driver->name);
     204                async_answer_0(iid, EINVAL);
     205                goto cleanup;
     206        }
     207       
     208        if (fun != NULL) {
     209                log_msg(LOG_DEFAULT, LVL_DEBUG,
     210                    "Forwarding request for `%s' function to driver `%s'.",
     211                    fun->pathname, driver->name);
     212        } else {
     213                log_msg(LOG_DEFAULT, LVL_DEBUG,
     214                    "Forwarding request for `%s' device to driver `%s'.",
     215                    dev->pfun->pathname, driver->name);
     216        }
     217       
     218        async_exch_t *exch = async_exchange_begin(driver->sess);
     219        async_forward_fast(iid, exch, INTERFACE_DDF_DRIVER, fun_handle, 0, IPC_FF_NONE);
     220        async_exchange_end(exch);
     221       
     222cleanup:
     223        if (dev != NULL)
     224                dev_del_ref(dev);
     225       
     226        if (fun != NULL)
     227                fun_del_ref(fun);
     228}
     229
     230static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     231{
     232        iface_t iface = IPC_GET_ARG1(*icall);
    172233        service_id_t service_id = IPC_GET_ARG2(*icall);
    173         fun_node_t *fun;
    174         dev_node_t *dev;
    175         devman_handle_t handle;
    176         driver_t *driver;
    177 
    178         fun = find_loc_tree_function(&device_tree, service_id);
     234       
     235        fun_node_t *fun = find_loc_tree_function(&device_tree, service_id);
    179236       
    180237        fibril_rwlock_read_lock(&device_tree.rwlock);
    181238       
    182         if (fun == NULL || fun->dev == NULL || fun->dev->drv == NULL) {
    183                 log_msg(LOG_DEFAULT, LVL_WARN, "devman_connection_loc(): function "
     239        if ((fun == NULL) || (fun->dev == NULL) || (fun->dev->drv == NULL)) {
     240                log_msg(LOG_DEFAULT, LVL_WARN, "devman_forward(): function "
    184241                    "not found.\n");
    185242                fibril_rwlock_read_unlock(&device_tree.rwlock);
     
    188245        }
    189246       
    190         dev = fun->dev;
    191         driver = dev->drv;
    192         handle = fun->handle;
     247        dev_node_t *dev = fun->dev;
     248        driver_t *driver = dev->drv;
     249        devman_handle_t handle = fun->handle;
    193250       
    194251        fibril_rwlock_read_unlock(&device_tree.rwlock);
    195252       
    196253        async_exch_t *exch = async_exchange_begin(driver->sess);
    197         async_forward_fast(iid, exch, DRIVER_CLIENT, handle, 0,
    198             IPC_FF_NONE);
     254        async_forward_fast(iid, exch, iface, handle, 0, IPC_FF_NONE);
    199255        async_exchange_end(exch);
    200256       
    201257        log_msg(LOG_DEFAULT, LVL_DEBUG,
    202             "Forwarding loc service request for `%s' function to driver `%s'.",
     258            "Forwarding service request for `%s' function to driver `%s'.",
    203259            fun->pathname, driver->name);
    204 
     260       
    205261        fun_del_ref(fun);
    206 }
    207 
    208 /** Function for handling connections to device manager. */
    209 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    210 {
    211         /* Select port. */
    212         switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
    213         case DEVMAN_DRIVER:
    214                 devman_connection_driver(iid, icall);
    215                 break;
    216         case DEVMAN_CLIENT:
    217                 devman_connection_client(iid, icall);
    218                 break;
    219         case DEVMAN_CONNECT_TO_DEVICE:
    220                 /* Connect client to selected device. */
    221                 devman_forward(iid, icall, false);
    222                 break;
    223         case INTERFACE_DDF_CLIENT:
    224                 /* Someone connected through loc node. */
    225                 devman_connection_loc(iid, icall);
    226                 break;
    227         case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
    228                 /* Connect client to selected device. */
    229                 devman_forward(iid, icall, true);
    230                 break;
    231         default:
    232                 /* No such interface */
    233                 async_answer_0(iid, ENOENT);
    234         }
    235262}
    236263
     
    298325        async_set_client_data_constructor(devman_client_data_create);
    299326        async_set_client_data_destructor(devman_client_data_destroy);
    300         async_set_fallback_port_handler(devman_connection, NULL);
     327       
     328        port_id_t port;
     329        rc = async_create_port(INTERFACE_DDF_DRIVER,
     330            devman_connection_driver, NULL, &port);
     331        if (rc != EOK)
     332                return rc;
     333       
     334        rc = async_create_port(INTERFACE_DDF_CLIENT,
     335            devman_connection_client, NULL, &port);
     336        if (rc != EOK)
     337                return rc;
     338       
     339        rc = async_create_port(INTERFACE_DEVMAN_DEVICE,
     340            devman_connection_device, NULL, &port);
     341        if (rc != EOK)
     342                return rc;
     343       
     344        rc = async_create_port(INTERFACE_DEVMAN_PARENT,
     345            devman_connection_parent, NULL, &port);
     346        if (rc != EOK)
     347                return rc;
     348       
     349        async_set_fallback_port_handler(devman_forward, NULL);
    301350       
    302351        if (!devman_init()) {
  • uspace/srv/fs/cdfs/cdfs.c

    r0dd16778 rf9b2cb4c  
    7373        }
    7474       
    75         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    76             SERVICE_VFS, 0);
     75        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     76            INTERFACE_VFS_DRIVER, 0);
    7777        if (!vfs_sess) {
    7878                printf("%s: Unable to connect to VFS\n", NAME);
  • uspace/srv/fs/exfat/exfat.c

    r0dd16778 rf9b2cb4c  
    7575                goto err;
    7676
    77         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    78             SERVICE_VFS, 0);
     77        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     78            INTERFACE_VFS_DRIVER, 0);
    7979        if (!vfs_sess) {
    8080                printf(NAME ": failed to connect to VFS\n");
  • uspace/srv/fs/ext4fs/ext4fs.c

    r0dd16778 rf9b2cb4c  
    6565        }
    6666       
    67         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    68             SERVICE_VFS, 0);
     67        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     68            INTERFACE_VFS_DRIVER, 0);
    6969        if (!vfs_sess) {
    7070                printf("%s: Failed to connect to VFS\n", NAME);
  • uspace/srv/fs/fat/fat.c

    r0dd16778 rf9b2cb4c  
    7575                goto err;
    7676       
    77         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    78             SERVICE_VFS, 0);
     77        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     78            INTERFACE_VFS_DRIVER, 0);
    7979        if (!vfs_sess) {
    8080                printf(NAME ": failed to connect to VFS\n");
  • uspace/srv/fs/locfs/locfs.c

    r0dd16778 rf9b2cb4c  
    7777        }
    7878       
    79         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    80             SERVICE_VFS, 0);
     79        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     80            INTERFACE_VFS_DRIVER, 0);
    8181        if (!vfs_sess) {
    8282                printf("%s: Unable to connect to VFS\n", NAME);
  • uspace/srv/fs/locfs/locfs_ops.c

    r0dd16778 rf9b2cb4c  
    264264                        fibril_mutex_unlock(&services_mutex);
    265265                       
    266                         async_sess_t *sess = loc_service_connect(
    267                             EXCHANGE_SERIALIZE, node->service_id, 0);
     266                        async_sess_t *sess = loc_service_connect(node->service_id,
     267                            INTERFACE_FS, 0);
    268268                       
    269269                        fibril_mutex_lock(&services_mutex);
  • uspace/srv/fs/mfs/mfs.c

    r0dd16778 rf9b2cb4c  
    7373        }
    7474
    75         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    76             SERVICE_VFS, 0);
     75        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     76            INTERFACE_VFS_DRIVER, 0);
    7777
    7878        if (!vfs_sess) {
  • uspace/srv/fs/tmpfs/tmpfs.c

    r0dd16778 rf9b2cb4c  
    8080        }
    8181       
    82         async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    83             SERVICE_VFS, 0);
     82        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
     83            INTERFACE_VFS_DRIVER, 0);
    8484        if (!vfs_sess) {
    8585                printf(NAME ": Unable to connect to VFS\n");
  • uspace/srv/fs/udf/udf.c

    r0dd16778 rf9b2cb4c  
    7474       
    7575        async_sess_t *vfs_sess =
    76             service_connect_blocking(EXCHANGE_SERIALIZE, SERVICE_VFS, 0);
     76            service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0);
    7777        if (!vfs_sess) {
    7878                log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS");
  • uspace/srv/hid/compositor/compositor.c

    r0dd16778 rf9b2cb4c  
    896896        ipc_call_t call;
    897897        ipc_callid_t callid;
    898         service_id_t service_id = (service_id_t) IPC_GET_ARG1(*icall);
     898        service_id_t service_id = (service_id_t) IPC_GET_ARG2(*icall);
    899899
    900900        /* Allocate resources for new window and register it to the location service. */
     
    11751175        async_sess_t *sess;
    11761176
    1177         sess = loc_service_connect(EXCHANGE_SERIALIZE, sid, 0);
     1177        sess = loc_service_connect(sid, INTERFACE_DDF, 0);
    11781178        if (sess == NULL) {
    11791179                printf("%s: Unable to connect to visualizer %s\n", NAME, svc);
     
    11821182
    11831183        async_exch_t *exch = async_exchange_begin(sess);
    1184         rc = async_connect_to_me(exch, sid, 0, 0, vsl_notifications, NULL);
     1184       
     1185        port_id_t port;
     1186        rc = async_create_callback_port(exch, INTERFACE_VISUALIZER_CB, 0, 0,
     1187            vsl_notifications, NULL, &port);
     1188       
    11851189        async_exchange_end(exch);
    11861190
     
    21452149        }
    21462150
    2147         sess = loc_service_connect(EXCHANGE_ATOMIC, dsid, 0);
     2151        sess = loc_service_connect(dsid, INTERFACE_INPUT, 0);
    21482152        if (sess == NULL) {
    21492153                printf("%s: Unable to connect to input service %s\n", NAME,
  • uspace/srv/hid/console/console.c

    r0dd16778 rf9b2cb4c  
    508508       
    509509        for (size_t i = 0; i < CONSOLE_COUNT; i++) {
    510                 if (consoles[i].dsid == (service_id_t) IPC_GET_ARG1(*icall)) {
     510                if (consoles[i].dsid == (service_id_t) IPC_GET_ARG2(*icall)) {
    511511                        cons = &consoles[i];
    512512                        break;
     
    536536        }
    537537
    538         sess = loc_service_connect(EXCHANGE_ATOMIC, dsid, 0);
     538        sess = loc_service_connect(dsid, INTERFACE_INPUT, 0);
    539539        if (sess == NULL) {
    540540                printf("%s: Unable to connect to input service %s\n", NAME,
     
    561561        int rc = loc_service_get_id(svc, &dsid, 0);
    562562        if (rc == EOK) {
    563                 sess = loc_service_connect(EXCHANGE_SERIALIZE, dsid, 0);
     563                sess = loc_service_connect(dsid, INTERFACE_OUTPUT, 0);
    564564                if (sess == NULL) {
    565565                        printf("%s: Unable to connect to output service %s\n",
  • uspace/srv/hid/input/ctl/kbdev.c

    r0dd16778 rf9b2cb4c  
    9494static int kbdev_ctl_init(kbd_dev_t *kdev)
    9595{
    96         async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE,
    97             kdev->svc_id, 0);
     96        async_sess_t *sess = loc_service_connect(kdev->svc_id,
     97            INTERFACE_DDF, 0);
    9898        if (sess == NULL) {
    9999                printf("%s: Failed starting session with '%s.'\n", NAME,
     
    120120        }
    121121       
    122         int rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev);
     122        port_id_t port;
     123        int rc = async_create_callback_port(exch, INTERFACE_KBD_CB, 0, 0,
     124            kbdev_callback_conn, kbdev, &port);
     125       
    123126        if (rc != EOK) {
    124127                printf("%s: Failed creating callback connection from '%s'.\n",
  • uspace/srv/hid/input/input.c

    r0dd16778 rf9b2cb4c  
    745745        if (irc_service) {
    746746                while (irc_sess == NULL)
    747                         irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    748                             SERVICE_IRC, 0);
     747                        irc_sess = service_connect_blocking(SERVICE_IRC,
     748                            INTERFACE_IRC, 0);
    749749        }
    750750       
  • uspace/srv/hid/input/port/adb.c

    r0dd16778 rf9b2cb4c  
    6969                return rc;
    7070       
    71         dev_sess = loc_service_connect(EXCHANGE_ATOMIC, service_id, 0);
     71        dev_sess = loc_service_connect(service_id, INTERFACE_DDF, 0);
    7272        if (dev_sess == NULL) {
    7373                printf("%s: Failed to connect to device\n", NAME);
     
    8282        }
    8383       
    84         rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
     84        port_id_t port;
     85        rc = async_create_callback_port(exch, INTERFACE_ADB_CB, 0, 0,
     86            kbd_port_events, NULL, &port);
     87       
    8588        async_exchange_end(exch);
    8689        if (rc != EOK) {
  • uspace/srv/hid/input/port/adb_mouse.c

    r0dd16778 rf9b2cb4c  
    8484                return rc;
    8585       
    86         dev_sess = loc_service_connect(EXCHANGE_ATOMIC, service_id, 0);
     86        dev_sess = loc_service_connect(service_id, INTERFACE_DDF, 0);
    8787        if (dev_sess == NULL) {
    8888                printf("%s: Failed to connect to device\n", NAME);
     
    9898       
    9999        /* NB: The callback connection is slotted for removal */
    100         rc = async_connect_to_me(exch, 0, 0, 0, mouse_port_events, NULL);
     100        port_id_t port;
     101        rc = async_create_callback_port(exch, INTERFACE_ADB_CB, 0, 0,
     102            mouse_port_events, NULL, &port);
     103       
    101104        async_exchange_end(exch);
    102105        if (rc != EOK) {
  • uspace/srv/hid/input/port/chardev.c

    r0dd16778 rf9b2cb4c  
    8484        }
    8585       
    86         dev_sess = loc_service_connect(EXCHANGE_ATOMIC, service_id,
     86        dev_sess = loc_service_connect(service_id, INTERFACE_DDF,
    8787            IPC_FLAG_BLOCKING);
    8888        if (dev_sess == NULL) {
     
    9898        }
    9999       
    100         /* NB: The callback connection is slotted for removal */
    101         rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
     100        port_id_t port;
     101        rc = async_create_callback_port(exch, INTERFACE_CHAR_CB, 0, 0,
     102            kbd_port_events, NULL, &port);
     103       
    102104        async_exchange_end(exch);
    103105       
  • uspace/srv/hid/input/proto/mousedev.c

    r0dd16778 rf9b2cb4c  
    118118static int mousedev_proto_init(mouse_dev_t *mdev)
    119119{
    120         async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE,
    121             mdev->svc_id, 0);
     120        async_sess_t *sess = loc_service_connect(mdev->svc_id, INTERFACE_DDF, 0);
    122121        if (sess == NULL) {
    123122                printf("%s: Failed starting session with '%s'\n", NAME,
     
    143142        }
    144143       
    145         int rc = async_connect_to_me(exch, 0, 0, 0, mousedev_callback_conn, mousedev);
     144        port_id_t port;
     145        int rc = async_create_callback_port(exch, INTERFACE_MOUSE_CB, 0, 0,
     146            mousedev_callback_conn, mousedev, &port);
     147       
    146148        async_exchange_end(exch);
    147149        async_hangup(sess);
  • uspace/srv/hid/isdv4_tablet/main.c

    r0dd16778 rf9b2cb4c  
    6969        async_sess_t *sess =
    7070            async_callback_receive(EXCHANGE_SERIALIZE);
     71       
    7172        fibril_mutex_lock(&client_mutex);
    72                 if (client_sess == NULL) {
    73                         client_sess = sess;
    74                 }
     73       
     74        if (client_sess == NULL)
     75                client_sess = sess;
     76       
    7577        fibril_mutex_unlock(&client_mutex);
    7678
     
    262264        printf(NAME ": Using serial port %s\n", serial_port_name);
    263265
    264         async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
     266        async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF,
    265267            IPC_FLAG_BLOCKING);
    266268        if (!sess) {
  • uspace/srv/hid/remcons/remcons.c

    r0dd16778 rf9b2cb4c  
    217217{
    218218        /* Find the user. */
    219         telnet_user_t *user = telnet_user_get_for_client_connection(IPC_GET_ARG1(*icall));
     219        telnet_user_t *user = telnet_user_get_for_client_connection(IPC_GET_ARG2(*icall));
    220220        if (user == NULL) {
    221221                async_answer_0(iid, ENOENT);
  • uspace/srv/hw/bus/cuda_adb/cuda_adb.c

    r0dd16778 rf9b2cb4c  
    214214
    215215        /* Get the device handle. */
    216         dsid = IPC_GET_ARG1(*icall);
     216        dsid = IPC_GET_ARG2(*icall);
    217217
    218218        /* Determine which disk device is the client connecting to. */
  • uspace/srv/locsrv/locsrv.c

    r0dd16778 rf9b2cb4c  
    467467        }
    468468       
    469         /* Set the interface, if any. */
    470         service->forward_interface = IPC_GET_ARG1(*icall);
    471 
    472469        /* Get fqsn */
    473470        char *fqsn;
     
    702699 *
    703700 */
    704 static void loc_forward(ipc_callid_t callid, ipc_call_t *call)
     701static void loc_forward(ipc_callid_t callid, ipc_call_t *call, void *arg)
    705702{
    706703        fibril_mutex_lock(&services_list_mutex);
     
    709706         * Get ID from request
    710707         */
     708        iface_t iface = IPC_GET_ARG1(*call);
    711709        service_id_t id = IPC_GET_ARG2(*call);
    712710        loc_service_t *svc = loc_service_find_id(id);
     
    719717       
    720718        async_exch_t *exch = async_exchange_begin(svc->server->sess);
    721        
    722         if (svc->forward_interface == 0)
    723                 async_forward_fast(callid, exch, svc->id, 0, 0, IPC_FF_NONE);
    724         else
    725                 async_forward_fast(callid, exch, svc->forward_interface,
    726                     svc->id, 0, IPC_FF_NONE);
    727        
     719        async_forward_fast(callid, exch, iface, svc->id, 0, IPC_FF_NONE);
    728720        async_exchange_end(exch);
    729721       
     
    13761368 *
    13771369 */
    1378 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall)
     1370static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    13791371{
    13801372        /* Accept connection */
     
    14341426 *
    14351427 */
    1436 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall)
     1428static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    14371429{
    14381430        /* Accept connection */
     
    15011493}
    15021494
    1503 /** Function for handling connections to location service
    1504  *
    1505  */
    1506 static void loc_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    1507 {
    1508         /* Select interface */
    1509         switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
    1510         case LOC_PORT_SUPPLIER:
    1511                 loc_connection_supplier(iid, icall);
    1512                 break;
    1513         case LOC_PORT_CONSUMER:
    1514                 loc_connection_consumer(iid, icall);
    1515                 break;
    1516         case LOC_CONNECT_TO_SERVICE:
    1517                 /* Connect client to selected service */
    1518                 loc_forward(iid, icall);
    1519                 break;
    1520         default:
    1521                 /* No such interface */
    1522                 async_answer_0(iid, ENOENT);
    1523         }
    1524 }
    1525 
    15261495/**
    15271496 *
     
    15361505        }
    15371506       
    1538         /* Set a handler of incomming connections */
    1539         async_set_fallback_port_handler(loc_connection, NULL);
    1540        
    1541         /* Register location service at naming service */
    1542         int rc = service_register(SERVICE_LOC);
     1507        port_id_t port;
     1508        int rc = async_create_port(INTERFACE_LOC_SUPPLIER,
     1509            loc_connection_supplier, NULL, &port);
    15431510        if (rc != EOK)
    15441511                return rc;
    15451512       
     1513        rc = async_create_port(INTERFACE_LOC_CONSUMER,
     1514            loc_connection_consumer, NULL, &port);
     1515        if (rc != EOK)
     1516                return rc;
     1517       
     1518        /* Set a handler of incomming connections */
     1519        async_set_fallback_port_handler(loc_forward, NULL);
     1520       
     1521        /* Register location service at naming service */
     1522        rc = service_register(SERVICE_LOC);
     1523        if (rc != EOK)
     1524                return rc;
     1525       
    15461526        printf("%s: Accepting connections\n", NAME);
    15471527        async_manager();
  • uspace/srv/locsrv/locsrv.h

    r0dd16778 rf9b2cb4c  
    107107        /** Supplier of this service */
    108108        loc_server_t *server;
    109        
    110         /** Use this interface when forwarding to server. */
    111         sysarg_t forward_interface;
    112109} loc_service_t;
    113110
  • uspace/srv/logger/main.c

    r0dd16778 rf9b2cb4c  
    4848#include "logger.h"
    4949
    50 static void connection_handler(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     50static void connection_handler_control(ipc_callid_t iid, ipc_call_t *icall,
     51    void *arg)
    5152{
    52         logger_interface_t iface = IPC_GET_ARG1(*icall);
     53        logger_connection_handler_control(iid);
     54}
    5355
    54         switch (iface) {
    55         case LOGGER_INTERFACE_CONTROL:
    56                 logger_connection_handler_control(iid);
    57                 break;
    58         case LOGGER_INTERFACE_WRITER:
    59                 logger_connection_handler_writer(iid);
    60                 break;
    61         default:
    62                 async_answer_0(iid, EINVAL);
    63                 break;
    64         }
     56static void connection_handler_writer(ipc_callid_t iid, ipc_call_t *icall,
     57    void *arg)
     58{
     59        logger_connection_handler_writer(iid);
    6560}
    6661
     
    7368                parse_level_settings(argv[i]);
    7469        }
    75 
    76         async_set_fallback_port_handler(connection_handler, NULL);
    7770       
    78         int rc = service_register(SERVICE_LOGGER);
     71        port_id_t port;
     72        int rc = async_create_port(INTERFACE_LOGGER_CONTROL,
     73            connection_handler_control, NULL, &port);
     74        if (rc != EOK)
     75                return rc;
     76       
     77        rc = async_create_port(INTERFACE_LOGGER_WRITER,
     78            connection_handler_writer, NULL, &port);
     79        if (rc != EOK)
     80                return rc;
     81       
     82        rc = service_register(SERVICE_LOGGER);
    7983        if (rc != EOK) {
    8084                printf(NAME ": failed to register: %s.\n", str_error(rc));
  • uspace/srv/net/ethip/ethip.c

    r0dd16778 rf9b2cb4c  
    147147        service_id_t sid;
    148148
    149         sid = (service_id_t)IPC_GET_ARG1(*icall);
     149        sid = (service_id_t) IPC_GET_ARG2(*icall);
    150150        log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_client_conn(%u)", (unsigned)sid);
    151151        nic = ethip_nic_find_by_iplink_sid(sid);
  • uspace/srv/net/ethip/ethip_nic.c

    r0dd16778 rf9b2cb4c  
    162162        }
    163163       
    164         nic->sess = loc_service_connect(EXCHANGE_SERIALIZE, sid, 0);
     164        nic->sess = loc_service_connect(sid, INTERFACE_DDF, 0);
    165165        if (nic->sess == NULL) {
    166166                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", nic->svc_name);
  • uspace/srv/net/inetsrv/inet_link.c

    r0dd16778 rf9b2cb4c  
    177177        }
    178178
    179         ilink->sess = loc_service_connect(EXCHANGE_SERIALIZE, sid, 0);
     179        ilink->sess = loc_service_connect(sid, INTERFACE_IPLINK, 0);
    180180        if (ilink->sess == NULL) {
    181181                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", ilink->svc_name);
  • uspace/srv/net/inetsrv/inetsrv.c

    r0dd16778 rf9b2cb4c  
    7777};
    7878
    79 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    80 
    8179static FIBRIL_MUTEX_INITIALIZE(client_list_lock);
    8280static LIST_INITIALIZE(client_list);
    8381
     82static void inet_default_conn(ipc_callid_t, ipc_call_t *, void *);
     83
    8484static int inet_init(void)
    8585{
    8686        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_init()");
    8787       
    88         async_set_fallback_port_handler(inet_client_conn, NULL);
    89        
    90         int rc = loc_server_register(NAME);
     88        port_id_t port;
     89        int rc = async_create_port(INTERFACE_INET,
     90            inet_default_conn, NULL, &port);
     91        if (rc != EOK)
     92                return rc;
     93       
     94        rc = async_create_port(INTERFACE_INETCFG,
     95            inet_cfg_conn, NULL, &port);
     96        if (rc != EOK)
     97                return rc;
     98       
     99        rc = async_create_port(INTERFACE_INETPING,
     100            inetping_conn, NULL, &port);
     101        if (rc != EOK)
     102                return rc;
     103       
     104        rc = loc_server_register(NAME);
    91105        if (rc != EOK) {
    92106                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
     
    95109       
    96110        service_id_t sid;
    97         rc = loc_service_register_with_iface(SERVICE_NAME_INET, &sid,
    98             INET_PORT_DEFAULT);
    99         if (rc != EOK) {
    100                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
    101                 return EEXIST;
    102         }
    103        
    104         rc = loc_service_register_with_iface(SERVICE_NAME_INETCFG, &sid,
    105             INET_PORT_CFG);
    106         if (rc != EOK) {
    107                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
    108                 return EEXIST;
    109         }
    110        
    111         rc = loc_service_register_with_iface(SERVICE_NAME_INETPING, &sid,
    112             INET_PORT_PING);
     111        rc = loc_service_register(SERVICE_NAME_INET, &sid);
    113112        if (rc != EOK) {
    114113                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
     
    429428}
    430429
    431 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    432 {
    433         sysarg_t port;
    434 
    435         port = IPC_GET_ARG1(*icall);
    436 
    437         switch (port) {
    438         case INET_PORT_DEFAULT:
    439                 inet_default_conn(iid, icall, arg);
    440                 break;
    441         case INET_PORT_CFG:
    442                 inet_cfg_conn(iid, icall, arg);
    443                 break;
    444         case INET_PORT_PING:
    445                 inetping_conn(iid, icall, arg);
    446                 break;
    447         default:
    448                 async_answer_0(iid, ENOTSUP);
    449                 break;
    450         }
    451 }
    452 
    453430static inet_client_t *inet_client_find(uint8_t proto)
    454431{
  • uspace/srv/net/slip/slip.c

    r0dd16778 rf9b2cb4c  
    328328         * char_dev at the same time.
    329329         */
    330         sess_out = loc_service_connect(EXCHANGE_SERIALIZE, svcid, 0);
     330        sess_out = loc_service_connect(svcid, INTERFACE_DDF, 0);
    331331        if (!sess_out) {
    332332                log_msg(LOG_DEFAULT, LVL_ERROR,
     
    337337        slip_iplink.arg = sess_out;
    338338
    339         sess_in = loc_service_connect(EXCHANGE_SERIALIZE, svcid, 0);
     339        sess_in = loc_service_connect(svcid, INTERFACE_DDF, 0);
    340340        if (!sess_in) {
    341341                log_msg(LOG_DEFAULT, LVL_ERROR,
Note: See TracChangeset for help on using the changeset viewer.