Ignore:
File:
1 edited

Legend:

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

    rf9b2cb4c r3e6a98c5  
    107107        if (!loc_callback_created) {
    108108                async_exch_t *exch =
    109                     loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     109                    loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    110110               
    111111                ipc_call_t answer;
    112112                aid_t req = async_send_0(exch, LOC_CALLBACK_CREATE, &answer);
    113                
    114                 port_id_t port;
    115                 int rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0,
    116                     loc_cb_conn, NULL, &port);
    117                
     113                int rc = async_connect_to_me(exch, 0, 0, 0, loc_cb_conn, NULL);
    118114                loc_exchange_end(exch);
    119115               
     
    139135 *
    140136 */
    141 async_exch_t *loc_exchange_begin_blocking(iface_t iface)
     137async_exch_t *loc_exchange_begin_blocking(loc_interface_t iface)
    142138{
    143139        switch (iface) {
    144         case INTERFACE_LOC_SUPPLIER:
     140        case LOC_PORT_SUPPLIER:
    145141                fibril_mutex_lock(&loc_supp_block_mutex);
    146142               
     
    151147                        if (loc_supp_block_sess == NULL)
    152148                                loc_supp_block_sess =
    153                                     service_connect_blocking(SERVICE_LOC,
    154                                     INTERFACE_LOC_SUPPLIER, 0);
     149                                    service_connect_blocking(EXCHANGE_SERIALIZE,
     150                                    SERVICE_LOC, LOC_PORT_SUPPLIER, 0);
    155151                }
    156152               
     
    161157               
    162158                return async_exchange_begin(loc_supp_block_sess);
    163         case INTERFACE_LOC_CONSUMER:
     159        case LOC_PORT_CONSUMER:
    164160                fibril_mutex_lock(&loc_cons_block_mutex);
    165161               
     
    170166                        if (loc_cons_block_sess == NULL)
    171167                                loc_cons_block_sess =
    172                                     service_connect_blocking(SERVICE_LOC,
    173                                     INTERFACE_LOC_CONSUMER, 0);
     168                                    service_connect_blocking(EXCHANGE_SERIALIZE,
     169                                    SERVICE_LOC, LOC_PORT_CONSUMER, 0);
    174170                }
    175171               
     
    192188 *
    193189 */
    194 async_exch_t *loc_exchange_begin(iface_t iface)
     190async_exch_t *loc_exchange_begin(loc_interface_t iface)
    195191{
    196192        switch (iface) {
    197         case INTERFACE_LOC_SUPPLIER:
     193        case LOC_PORT_SUPPLIER:
    198194                fibril_mutex_lock(&loc_supplier_mutex);
    199195               
    200196                if (loc_supplier_sess == NULL)
    201197                        loc_supplier_sess =
    202                             service_connect(SERVICE_LOC,
    203                             INTERFACE_LOC_SUPPLIER, 0);
     198                            service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC,
     199                            LOC_PORT_SUPPLIER, 0);
    204200               
    205201                fibril_mutex_unlock(&loc_supplier_mutex);
     
    209205               
    210206                return async_exchange_begin(loc_supplier_sess);
    211         case INTERFACE_LOC_CONSUMER:
     207        case LOC_PORT_CONSUMER:
    212208                fibril_mutex_lock(&loc_consumer_mutex);
    213209               
    214210                if (loc_consumer_sess == NULL)
    215211                        loc_consumer_sess =
    216                             service_connect(SERVICE_LOC,
    217                             INTERFACE_LOC_CONSUMER, 0);
     212                            service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC,
     213                            LOC_PORT_CONSUMER, 0);
    218214               
    219215                fibril_mutex_unlock(&loc_consumer_mutex);
     
    241237int loc_server_register(const char *name)
    242238{
    243         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
     239        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
    244240       
    245241        ipc_call_t answer;
     
    254250        }
    255251       
    256         exch = loc_exchange_begin(INTERFACE_LOC_SUPPLIER);
    257         async_connect_to_me(exch, 0, 0, 0);
     252        exch = loc_exchange_begin(LOC_PORT_SUPPLIER);
     253        async_connect_to_me(exch, 0, 0, 0, NULL, NULL);
    258254        loc_exchange_end(exch);
    259255       
     
    264260/** Register new service.
    265261 *
    266  * @param      fqsn  Fully qualified service name
    267  * @param[out] sid   Service ID of new service
    268  *
    269  */
    270 int loc_service_register(const char *fqsn, service_id_t *sid)
    271 {
    272         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
     262 * The @p interface is used when forwarding connection to the server.
     263 * If not 0, the first argument is the interface and the second argument
     264 * is the service ID.
     265 *
     266 * When the interface is zero (default), the first argument is directly
     267 * the handle (to ensure backward compatibility).
     268 *
     269 * @param      fqsn      Fully qualified service name
     270 * @param[out] sid       Service ID of new service
     271 * @param      interface Interface when forwarding
     272 *
     273 */
     274int loc_service_register_with_iface(const char *fqsn,
     275    service_id_t *sid, sysarg_t interface)
     276{
     277        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
    273278       
    274279        ipc_call_t answer;
    275         aid_t req = async_send_0(exch, LOC_SERVICE_REGISTER, &answer);
     280        aid_t req = async_send_2(exch, LOC_SERVICE_REGISTER, interface, 0,
     281            &answer);
    276282        sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));
    277283       
     
    298304}
    299305
     306/** Register new service.
     307 *
     308 * @param fqsn Fully qualified service name
     309 * @param sid  Output: ID of new service
     310 *
     311 */
     312int loc_service_register(const char *fqdn, service_id_t *sid)
     313{
     314        return loc_service_register_with_iface(fqdn, sid, 0);
     315}
     316
    300317/** Unregister service.
    301318 *
     
    307324        sysarg_t retval;
    308325       
    309         exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
     326        exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
    310327        retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid);
    311328        loc_exchange_end(exch);
     
    320337       
    321338        if (flags & IPC_FLAG_BLOCKING)
    322                 exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     339                exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    323340        else {
    324                 exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
     341                exch = loc_exchange_begin(LOC_PORT_CONSUMER);
    325342                if (exch == NULL)
    326343                        return errno;
     
    373390       
    374391        *name = NULL;
    375         exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     392        exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    376393       
    377394        ipc_call_t answer;
     
    453470       
    454471        if (flags & IPC_FLAG_BLOCKING)
    455                 exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     472                exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    456473        else {
    457                 exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
     474                exch = loc_exchange_begin(LOC_PORT_CONSUMER);
    458475                if (exch == NULL)
    459476                        return errno;
     
    502519       
    503520        if (flags & IPC_FLAG_BLOCKING)
    504                 exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     521                exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    505522        else {
    506                 exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
     523                exch = loc_exchange_begin(LOC_PORT_CONSUMER);
    507524                if (exch == NULL)
    508525                        return errno;
     
    539556loc_object_type_t loc_id_probe(service_id_t handle)
    540557{
    541         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     558        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    542559       
    543560        sysarg_t type;
     
    552569}
    553570
    554 async_sess_t *loc_service_connect(service_id_t handle, iface_t iface,
     571async_sess_t *loc_service_connect(exch_mgmt_t mgmt, service_id_t handle,
    555572    unsigned int flags)
    556573{
     
    558575       
    559576        if (flags & IPC_FLAG_BLOCKING)
    560                 sess = service_connect_blocking(SERVICE_LOC, iface, handle);
     577                sess = service_connect_blocking(mgmt, SERVICE_LOC,
     578                    LOC_CONNECT_TO_SERVICE, handle);
    561579        else
    562                 sess = service_connect(SERVICE_LOC, iface, handle);
     580                sess = service_connect(mgmt, SERVICE_LOC,
     581                    LOC_CONNECT_TO_SERVICE, handle);
    563582       
    564583        return sess;
     
    567586int loc_null_create(void)
    568587{
    569         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     588        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    570589       
    571590        sysarg_t null_id;
     
    582601void loc_null_destroy(int null_id)
    583602{
    584         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     603        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    585604        async_req_1_0(exch, LOC_NULL_DESTROY, (sysarg_t) null_id);
    586605        loc_exchange_end(exch);
     
    608627        sysarg_t retval;
    609628       
    610         exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
     629        exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
    611630        retval = async_req_2_0(exch, LOC_SERVICE_ADD_TO_CAT, svc_id, cat_id);
    612631        loc_exchange_end(exch);
     
    629648size_t loc_count_namespaces(void)
    630649{
    631         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     650        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    632651        size_t size = loc_count_namespaces_internal(exch);
    633652        loc_exchange_end(exch);
     
    638657size_t loc_count_services(service_id_t ns_handle)
    639658{
    640         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     659        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    641660        size_t size = loc_count_services_internal(exch, ns_handle);
    642661        loc_exchange_end(exch);
     
    649668        /* Loop until read is succesful */
    650669        while (true) {
    651                 async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     670                async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    652671                size_t count = loc_count_namespaces_internal(exch);
    653672                loc_exchange_end(exch);
     
    660679                        return 0;
    661680               
    662                 exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
     681                exch = loc_exchange_begin(LOC_PORT_CONSUMER);
    663682               
    664683                ipc_call_t answer;
     
    698717        /* Loop until read is succesful */
    699718        while (true) {
    700                 async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     719                async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    701720                size_t count = loc_count_services_internal(exch, ns_handle);
    702721                loc_exchange_end(exch);
     
    709728                        return 0;
    710729               
    711                 exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
     730                exch = loc_exchange_begin(LOC_PORT_CONSUMER);
    712731               
    713732                ipc_call_t answer;
     
    746765    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
    747766{
    748         async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
     767        async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    749768
    750769        ipc_call_t answer;
Note: See TracChangeset for help on using the changeset viewer.