Changeset 2133e02 in mainline


Ignore:
Timestamp:
2015-08-18T20:14:05Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1a522e5
Parents:
84dc30c
Message:

canonically reserve the first argument of IPC_M_CONNECT_ME_TO for interface type
naming service: service handle in IPC_M_CONNECT_ME_TO needs to be shifted to the second argument
service connections that use the untyped (fallback) port can only provide one additional argument now

Location:
uspace
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/trace/ipcp.c

    r84dc30c r2133e02  
    303303            (retval == 0)) {
    304304                /* Connected to a service (through NS) */
    305                 service = IPC_GET_ARG1(pcall->question);
     305                service = IPC_GET_ARG2(pcall->question);
    306306                proto = proto_get_by_srv(service);
    307307                if (proto == NULL)
  • uspace/lib/c/generic/clipboard.c

    r84dc30c r2133e02  
    6262        while (clip_sess == NULL)
    6363                clip_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    64                     SERVICE_CLIPBOARD, 0, 0);
     64                    SERVICE_CLIPBOARD, 0);
    6565       
    6666        fibril_mutex_unlock(&clip_mutex);
  • uspace/lib/c/generic/devman.c

    r84dc30c r2133e02  
    8989                        if (devman_driver_block_sess == NULL)
    9090                                devman_driver_block_sess =
    91                                     service_connect_blocking(EXCHANGE_PARALLEL,
    92                                     SERVICE_DEVMAN, DEVMAN_DRIVER, 0);
     91                                    service_connect_blocking_iface(EXCHANGE_PARALLEL,
     92                                    DEVMAN_DRIVER, SERVICE_DEVMAN, 0);
    9393                }
    9494               
     
    108108                        if (devman_client_block_sess == NULL)
    109109                                devman_client_block_sess =
    110                                     service_connect_blocking(EXCHANGE_SERIALIZE,
    111                                     SERVICE_DEVMAN, DEVMAN_CLIENT, 0);
     110                                    service_connect_blocking_iface(EXCHANGE_SERIALIZE,
     111                                    DEVMAN_CLIENT, SERVICE_DEVMAN, 0);
    112112                }
    113113               
     
    138138                if (devman_driver_sess == NULL)
    139139                        devman_driver_sess =
    140                             service_connect(EXCHANGE_PARALLEL, SERVICE_DEVMAN,
    141                             DEVMAN_DRIVER, 0);
     140                            service_connect_iface(EXCHANGE_PARALLEL, DEVMAN_DRIVER,
     141                            SERVICE_DEVMAN, 0);
    142142               
    143143                fibril_mutex_unlock(&devman_driver_mutex);
     
    152152                if (devman_client_sess == NULL)
    153153                        devman_client_sess =
    154                             service_connect(EXCHANGE_SERIALIZE, SERVICE_DEVMAN,
    155                             DEVMAN_CLIENT, 0);
     154                            service_connect_iface(EXCHANGE_SERIALIZE, DEVMAN_CLIENT,
     155                            SERVICE_DEVMAN, 0);
    156156               
    157157                fibril_mutex_unlock(&devman_client_mutex);
     
    293293       
    294294        if (flags & IPC_FLAG_BLOCKING)
    295                 sess = service_connect_blocking(mgmt, SERVICE_DEVMAN,
    296                             DEVMAN_CONNECT_TO_DEVICE, handle);
     295                sess = service_connect_blocking_iface(mgmt, DEVMAN_CONNECT_TO_DEVICE,
     296                    SERVICE_DEVMAN, handle);
    297297        else
    298                 sess = service_connect(mgmt, SERVICE_DEVMAN,
    299                             DEVMAN_CONNECT_TO_DEVICE, handle);
     298                sess = service_connect_iface(mgmt, DEVMAN_CONNECT_TO_DEVICE,
     299                    SERVICE_DEVMAN, handle);
    300300       
    301301        return sess;
     
    351351       
    352352        if (flags & IPC_FLAG_BLOCKING)
    353                 sess = service_connect_blocking(mgmt, SERVICE_DEVMAN,
    354                             DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle);
     353                sess = service_connect_blocking_iface(mgmt,
     354                            DEVMAN_CONNECT_TO_PARENTS_DEVICE, SERVICE_DEVMAN, handle);
    355355        else
    356                 sess = service_connect(mgmt, SERVICE_DEVMAN,
    357                             DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle);
     356                sess = service_connect_iface(mgmt,
     357                            DEVMAN_CONNECT_TO_PARENTS_DEVICE, SERVICE_DEVMAN, handle);
    358358       
    359359        return sess;
  • uspace/lib/c/generic/io/log.c

    r84dc30c r2133e02  
    166166                return ENOMEM;
    167167
    168         logger_session = service_connect_blocking(EXCHANGE_SERIALIZE, SERVICE_LOGGER, LOGGER_INTERFACE_WRITER, 0);
     168        logger_session = service_connect_blocking_iface(EXCHANGE_SERIALIZE,
     169            LOGGER_INTERFACE_WRITER, SERVICE_LOGGER, 0);
    169170        if (logger_session == NULL) {
    170171                return ENOMEM;
  • uspace/lib/c/generic/io/logctl.c

    r84dc30c r2133e02  
    4848
    4949        if (logger_session == NULL) {
    50                 logger_session = service_connect_blocking(EXCHANGE_SERIALIZE,
    51                     SERVICE_LOGGER, LOGGER_INTERFACE_CONTROL, 0);
     50                logger_session = service_connect_blocking_iface(EXCHANGE_SERIALIZE,
     51                    LOGGER_INTERFACE_CONTROL, SERVICE_LOGGER, 0);
    5252                if (logger_session == NULL)
    5353                        return ENOMEM;
  • uspace/lib/c/generic/irc.c

    r84dc30c r2133e02  
    5252
    5353        irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    54             SERVICE_IRC, 0, 0);
     54            SERVICE_IRC, 0);
    5555
    5656        if (irc_sess == NULL)
  • uspace/lib/c/generic/loader.c

    r84dc30c r2133e02  
    6969       
    7070        async_sess_t *sess =
    71             service_connect_blocking(EXCHANGE_SERIALIZE, SERVICE_LOAD, 0, 0);
     71            service_connect_blocking(EXCHANGE_SERIALIZE, SERVICE_LOAD, 0);
    7272        if (sess == NULL) {
    7373                free(ldr);
  • uspace/lib/c/generic/loc.c

    r84dc30c r2133e02  
    147147                        if (loc_supp_block_sess == NULL)
    148148                                loc_supp_block_sess =
    149                                     service_connect_blocking(EXCHANGE_SERIALIZE,
    150                                     SERVICE_LOC, LOC_PORT_SUPPLIER, 0);
     149                                    service_connect_blocking_iface(EXCHANGE_SERIALIZE,
     150                                    LOC_PORT_SUPPLIER, SERVICE_LOC, 0);
    151151                }
    152152               
     
    166166                        if (loc_cons_block_sess == NULL)
    167167                                loc_cons_block_sess =
    168                                     service_connect_blocking(EXCHANGE_SERIALIZE,
    169                                     SERVICE_LOC, LOC_PORT_CONSUMER, 0);
     168                                    service_connect_blocking_iface(EXCHANGE_SERIALIZE,
     169                                    LOC_PORT_CONSUMER, SERVICE_LOC, 0);
    170170                }
    171171               
     
    196196                if (loc_supplier_sess == NULL)
    197197                        loc_supplier_sess =
    198                             service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC,
    199                             LOC_PORT_SUPPLIER, 0);
     198                            service_connect_iface(EXCHANGE_SERIALIZE, LOC_PORT_SUPPLIER,
     199                            SERVICE_LOC, 0);
    200200               
    201201                fibril_mutex_unlock(&loc_supplier_mutex);
     
    210210                if (loc_consumer_sess == NULL)
    211211                        loc_consumer_sess =
    212                             service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC,
    213                             LOC_PORT_CONSUMER, 0);
     212                            service_connect_iface(EXCHANGE_SERIALIZE, LOC_PORT_CONSUMER,
     213                            SERVICE_LOC, 0);
    214214               
    215215                fibril_mutex_unlock(&loc_consumer_mutex);
     
    575575       
    576576        if (flags & IPC_FLAG_BLOCKING)
    577                 sess = service_connect_blocking(mgmt, SERVICE_LOC,
    578                     LOC_CONNECT_TO_SERVICE, handle);
     577                sess = service_connect_blocking_iface(mgmt, LOC_CONNECT_TO_SERVICE,
     578                    SERVICE_LOC, handle);
    579579        else
    580                 sess = service_connect(mgmt, SERVICE_LOC,
    581                     LOC_CONNECT_TO_SERVICE, handle);
     580                sess = service_connect_iface(mgmt, LOC_CONNECT_TO_SERVICE,
     581                    SERVICE_LOC, handle);
    582582       
    583583        return sess;
  • uspace/lib/c/generic/ns.c

    r84dc30c r2133e02  
    4343{
    4444        async_exch_t *exch = async_exchange_begin(session_ns);
    45         int rc = async_connect_to_me(exch, service, 0, 0, NULL, NULL);
     45        int rc = async_connect_to_me(exch, 0, service, 0, NULL, NULL);
    4646        async_exchange_end(exch);
    4747       
     
    4949}
    5050
    51 async_sess_t *service_connect(exch_mgmt_t mgmt, service_t service, sysarg_t arg2,
    52     sysarg_t arg3)
     51async_sess_t *service_connect_iface(exch_mgmt_t mgmt, sysarg_t iface,
     52    service_t service, sysarg_t arg3)
    5353{
    5454        async_exch_t *exch = async_exchange_begin(session_ns);
     
    5757       
    5858        async_sess_t *sess =
    59             async_connect_me_to(mgmt, exch, service, arg2, arg3);
     59            async_connect_me_to(mgmt, exch, iface, service, arg3);
    6060        async_exchange_end(exch);
    6161       
     
    6868         * first argument for non-initial connections.
    6969         */
    70         async_sess_args_set(sess, arg2, arg3, 0);
     70        async_sess_args_set(sess, iface, arg3, 0);
    7171       
    7272        return sess;
    7373}
    7474
    75 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, service_t service,
    76     sysarg_t arg2, sysarg_t arg3)
     75async_sess_t *service_connect(exch_mgmt_t mgmt, service_t service, sysarg_t arg3)
    7776{
    7877        async_exch_t *exch = async_exchange_begin(session_ns);
    7978        if (!exch)
    8079                return NULL;
     80       
    8181        async_sess_t *sess =
    82             async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
     82            async_connect_me_to(mgmt, exch, 0, service, arg3);
    8383        async_exchange_end(exch);
    8484       
     
    9191         * first argument for non-initial connections.
    9292         */
    93         async_sess_args_set(sess, arg2, arg3, 0);
     93        async_sess_args_set(sess, 0, arg3, 0);
     94       
     95        return sess;
     96}
     97
     98async_sess_t *service_connect_blocking_iface(exch_mgmt_t mgmt, sysarg_t iface,
     99    service_t service, sysarg_t arg3)
     100{
     101        async_exch_t *exch = async_exchange_begin(session_ns);
     102        if (!exch)
     103                return NULL;
     104        async_sess_t *sess =
     105            async_connect_me_to_blocking(mgmt, exch, iface, service, arg3);
     106        async_exchange_end(exch);
     107       
     108        if (!sess)
     109                return NULL;
     110       
     111        /*
     112         * FIXME Ugly hack to work around limitation of implementing
     113         * parallel exchanges using multiple connections. Shift out
     114         * first argument for non-initial connections.
     115         */
     116        async_sess_args_set(sess, iface, arg3, 0);
     117       
     118        return sess;
     119}
     120
     121async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, service_t service,
     122    sysarg_t arg3)
     123{
     124        async_exch_t *exch = async_exchange_begin(session_ns);
     125        if (!exch)
     126                return NULL;
     127        async_sess_t *sess =
     128            async_connect_me_to_blocking(mgmt, exch, 0, service, arg3);
     129        async_exchange_end(exch);
     130       
     131        if (!sess)
     132                return NULL;
     133       
     134        /*
     135         * FIXME Ugly hack to work around limitation of implementing
     136         * parallel exchanges using multiple connections. Shift out
     137         * first argument for non-initial connections.
     138         */
     139        async_sess_args_set(sess, 0, arg3, 0);
    94140       
    95141        return sess;
     
    113159        /* Connect to the needed service */
    114160        async_sess_t *sess =
    115             service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0);
     161            service_connect_blocking(EXCHANGE_SERIALIZE, service, 0);
    116162        if (sess != NULL) {
    117163                /* Request callback connection */
  • uspace/lib/c/generic/vfs/vfs.c

    r84dc30c r2133e02  
    7676        while (vfs_sess == NULL)
    7777                vfs_sess = service_connect_blocking(EXCHANGE_PARALLEL, SERVICE_VFS,
    78                     0, 0);
     78                    0);
    7979       
    8080        fibril_mutex_unlock(&vfs_mutex);
  • uspace/lib/c/include/ns.h

    r84dc30c r2133e02  
    4242
    4343extern int service_register(sysarg_t);
    44 extern async_sess_t *service_connect(exch_mgmt_t, service_t, sysarg_t, sysarg_t);
    45 extern async_sess_t *service_connect_blocking(exch_mgmt_t, service_t, sysarg_t,
     44extern async_sess_t *service_connect(exch_mgmt_t, service_t, sysarg_t);
     45extern async_sess_t *service_connect_iface(exch_mgmt_t, sysarg_t, service_t, sysarg_t);
     46extern async_sess_t *service_connect_blocking(exch_mgmt_t, service_t, sysarg_t);
     47extern async_sess_t *service_connect_blocking_iface(exch_mgmt_t, sysarg_t, service_t,
    4648    sysarg_t);
    4749extern async_sess_t *service_bind(service_t, sysarg_t, sysarg_t, sysarg_t,
  • uspace/srv/fs/cdfs/cdfs.c

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

    r84dc30c r2133e02  
    7676
    7777        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    78             SERVICE_VFS, 0, 0);
     78            SERVICE_VFS, 0);
    7979        if (!vfs_sess) {
    8080                printf(NAME ": failed to connect to VFS\n");
  • uspace/srv/fs/ext4fs/ext4fs.c

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

    r84dc30c r2133e02  
    7676       
    7777        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    78             SERVICE_VFS, 0, 0);
     78            SERVICE_VFS, 0);
    7979        if (!vfs_sess) {
    8080                printf(NAME ": failed to connect to VFS\n");
  • uspace/srv/fs/locfs/locfs.c

    r84dc30c r2133e02  
    7878       
    7979        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    80             SERVICE_VFS, 0, 0);
     80            SERVICE_VFS, 0);
    8181        if (!vfs_sess) {
    8282                printf("%s: Unable to connect to VFS\n", NAME);
  • uspace/srv/fs/mfs/mfs.c

    r84dc30c r2133e02  
    7474
    7575        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    76             SERVICE_VFS, 0, 0);
     76            SERVICE_VFS, 0);
    7777
    7878        if (!vfs_sess) {
  • uspace/srv/fs/tmpfs/tmpfs.c

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

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

    r84dc30c r2133e02  
    746746                while (irc_sess == NULL)
    747747                        irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
    748                             SERVICE_IRC, 0, 0);
     748                            SERVICE_IRC, 0);
    749749        }
    750750       
  • uspace/srv/ns/clonable.c

    r84dc30c r2133e02  
    9494        ipc_answer_0(callid, EOK);
    9595       
    96         ipc_forward_fast(csr->callid, phone, IPC_GET_ARG2(csr->call),
     96        ipc_forward_fast(csr->callid, phone, IPC_GET_ARG1(csr->call),
    9797            IPC_GET_ARG3(csr->call), 0, IPC_FF_NONE);
    9898       
  • uspace/srv/ns/ns.c

    r84dc30c r2133e02  
    3939#include <ipc/ns.h>
    4040#include <ipc/services.h>
     41#include <abi/ipc/interfaces.h>
    4142#include <stdio.h>
    4243#include <errno.h>
     
    7475                sysarg_t retval;
    7576               
     77                iface_t iface;
    7678                service_t service;
    7779                sysarg_t phone;
     
    8284                        break;
    8385                case IPC_M_CONNECT_TO_ME:
    84                         service = IPC_GET_ARG1(call);
     86                        iface = IPC_GET_ARG1(call);
     87                        service = IPC_GET_ARG2(call);
    8588                        phone = IPC_GET_ARG5(call);
     89                       
     90                        (void) iface;
    8691                       
    8792                        /*
     
    96101                        break;
    97102                case IPC_M_CONNECT_ME_TO:
    98                         service = IPC_GET_ARG1(call);
     103                        iface = IPC_GET_ARG1(call);
     104                        service = IPC_GET_ARG2(call);
     105                       
     106                        (void) iface;
    99107                       
    100108                        /*
  • uspace/srv/ns/service.c

    r84dc30c r2133e02  
    3939#include "service.h"
    4040#include "ns.h"
    41 
    4241
    4342/** Service hash table item. */
     
    8483        sysarg_t service;        /**< Number of the service. */
    8584        ipc_callid_t callid;     /**< Call ID waiting for the connection */
    86         sysarg_t arg2;           /**< Second argument */
     85        sysarg_t iface;          /**< Interface argument */
    8786        sysarg_t arg3;           /**< Third argument */
    8887} pending_conn_t;
     
    112111               
    113112                hashed_service_t *hs = hash_table_get_inst(link, hashed_service_t, link);
    114                 (void) ipc_forward_fast(pr->callid, hs->phone, pr->arg2,
    115                     pr->arg3, 0, IPC_FF_NONE);
     113                (void) ipc_forward_fast(pr->callid, hs->phone, pr->iface, pr->arg3, 0,
     114                    IPC_FF_NONE);
    116115               
    117116                list_remove(&pr->link);
     
    174173                        pr->service = service;
    175174                        pr->callid = callid;
    176                         pr->arg2 = IPC_GET_ARG2(*call);
     175                        pr->iface = IPC_GET_ARG1(*call);
    177176                        pr->arg3 = IPC_GET_ARG3(*call);
    178177                        list_append(&pr->link, &pending_conn);
    179178                        return;
    180179                }
     180               
    181181                retval = ENOENT;
    182182                goto out;
     
    184184       
    185185        hashed_service_t *hs = hash_table_get_inst(link, hashed_service_t, link);
    186         (void) ipc_forward_fast(callid, hs->phone, IPC_GET_ARG2(*call),
     186        (void) ipc_forward_fast(callid, hs->phone, IPC_GET_ARG1(*call),
    187187            IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
    188188        return;
Note: See TracChangeset for help on using the changeset viewer.