Changeset ff381a7 in mainline for uspace/lib/c/generic/loc.c


Ignore:
Timestamp:
2015-11-02T20:54:19Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d8513177
Parents:
3feeab2 (diff), 5265eea4 (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/lib/c/generic/loc.c

    r3feeab2 rff381a7  
    107107        if (!loc_callback_created) {
    108108                async_exch_t *exch =
    109                     loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     109                    loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    110110               
    111111                ipc_call_t answer;
    112112                aid_t req = async_send_0(exch, LOC_CALLBACK_CREATE, &answer);
    113                 int rc = async_connect_to_me(exch, 0, 0, 0, loc_cb_conn, NULL);
     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               
    114118                loc_exchange_end(exch);
    115119               
     
    135139 *
    136140 */
    137 async_exch_t *loc_exchange_begin_blocking(loc_interface_t iface)
     141async_exch_t *loc_exchange_begin_blocking(iface_t iface)
    138142{
    139143        switch (iface) {
    140         case LOC_PORT_SUPPLIER:
     144        case INTERFACE_LOC_SUPPLIER:
    141145                fibril_mutex_lock(&loc_supp_block_mutex);
    142146               
     
    147151                        if (loc_supp_block_sess == NULL)
    148152                                loc_supp_block_sess =
    149                                     service_connect_blocking(EXCHANGE_SERIALIZE,
    150                                     SERVICE_LOC, LOC_PORT_SUPPLIER, 0);
     153                                    service_connect_blocking(SERVICE_LOC,
     154                                    INTERFACE_LOC_SUPPLIER, 0);
    151155                }
    152156               
     
    157161               
    158162                return async_exchange_begin(loc_supp_block_sess);
    159         case LOC_PORT_CONSUMER:
     163        case INTERFACE_LOC_CONSUMER:
    160164                fibril_mutex_lock(&loc_cons_block_mutex);
    161165               
     
    166170                        if (loc_cons_block_sess == NULL)
    167171                                loc_cons_block_sess =
    168                                     service_connect_blocking(EXCHANGE_SERIALIZE,
    169                                     SERVICE_LOC, LOC_PORT_CONSUMER, 0);
     172                                    service_connect_blocking(SERVICE_LOC,
     173                                    INTERFACE_LOC_CONSUMER, 0);
    170174                }
    171175               
     
    188192 *
    189193 */
    190 async_exch_t *loc_exchange_begin(loc_interface_t iface)
     194async_exch_t *loc_exchange_begin(iface_t iface)
    191195{
    192196        switch (iface) {
    193         case LOC_PORT_SUPPLIER:
     197        case INTERFACE_LOC_SUPPLIER:
    194198                fibril_mutex_lock(&loc_supplier_mutex);
    195199               
    196200                if (loc_supplier_sess == NULL)
    197201                        loc_supplier_sess =
    198                             service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC,
    199                             LOC_PORT_SUPPLIER, 0);
     202                            service_connect(SERVICE_LOC,
     203                            INTERFACE_LOC_SUPPLIER, 0);
    200204               
    201205                fibril_mutex_unlock(&loc_supplier_mutex);
     
    205209               
    206210                return async_exchange_begin(loc_supplier_sess);
    207         case LOC_PORT_CONSUMER:
     211        case INTERFACE_LOC_CONSUMER:
    208212                fibril_mutex_lock(&loc_consumer_mutex);
    209213               
    210214                if (loc_consumer_sess == NULL)
    211215                        loc_consumer_sess =
    212                             service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC,
    213                             LOC_PORT_CONSUMER, 0);
     216                            service_connect(SERVICE_LOC,
     217                            INTERFACE_LOC_CONSUMER, 0);
    214218               
    215219                fibril_mutex_unlock(&loc_consumer_mutex);
     
    237241int loc_server_register(const char *name)
    238242{
    239         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
     243        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
    240244       
    241245        ipc_call_t answer;
     
    250254        }
    251255       
    252         exch = loc_exchange_begin(LOC_PORT_SUPPLIER);
    253         async_connect_to_me(exch, 0, 0, 0, NULL, NULL);
     256        exch = loc_exchange_begin(INTERFACE_LOC_SUPPLIER);
     257        async_connect_to_me(exch, 0, 0, 0);
    254258        loc_exchange_end(exch);
    255259       
     
    260264/** Register new service.
    261265 *
    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  */
    274 int 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);
     266 * @param      fqsn  Fully qualified service name
     267 * @param[out] sid   Service ID of new service
     268 *
     269 */
     270int loc_service_register(const char *fqsn, service_id_t *sid)
     271{
     272        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
    278273       
    279274        ipc_call_t answer;
    280         aid_t req = async_send_2(exch, LOC_SERVICE_REGISTER, interface, 0,
    281             &answer);
     275        aid_t req = async_send_0(exch, LOC_SERVICE_REGISTER, &answer);
    282276        sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));
    283277       
     
    304298}
    305299
    306 /** Register new service.
    307  *
    308  * @param fqsn Fully qualified service name
    309  * @param sid  Output: ID of new service
    310  *
    311  */
    312 int loc_service_register(const char *fqdn, service_id_t *sid)
    313 {
    314         return loc_service_register_with_iface(fqdn, sid, 0);
    315 }
    316 
    317300/** Unregister service.
    318301 *
     
    324307        sysarg_t retval;
    325308       
    326         exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
     309        exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
    327310        retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid);
    328311        loc_exchange_end(exch);
     
    337320       
    338321        if (flags & IPC_FLAG_BLOCKING)
    339                 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     322                exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    340323        else {
    341                 exch = loc_exchange_begin(LOC_PORT_CONSUMER);
     324                exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
    342325                if (exch == NULL)
    343326                        return errno;
     
    390373       
    391374        *name = NULL;
    392         exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     375        exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    393376       
    394377        ipc_call_t answer;
     
    470453       
    471454        if (flags & IPC_FLAG_BLOCKING)
    472                 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     455                exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    473456        else {
    474                 exch = loc_exchange_begin(LOC_PORT_CONSUMER);
     457                exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
    475458                if (exch == NULL)
    476459                        return errno;
     
    519502       
    520503        if (flags & IPC_FLAG_BLOCKING)
    521                 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     504                exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    522505        else {
    523                 exch = loc_exchange_begin(LOC_PORT_CONSUMER);
     506                exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
    524507                if (exch == NULL)
    525508                        return errno;
     
    556539loc_object_type_t loc_id_probe(service_id_t handle)
    557540{
    558         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     541        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    559542       
    560543        sysarg_t type;
     
    569552}
    570553
    571 async_sess_t *loc_service_connect(exch_mgmt_t mgmt, service_id_t handle,
     554async_sess_t *loc_service_connect(service_id_t handle, iface_t iface,
    572555    unsigned int flags)
    573556{
     
    575558       
    576559        if (flags & IPC_FLAG_BLOCKING)
    577                 sess = service_connect_blocking(mgmt, SERVICE_LOC,
    578                     LOC_CONNECT_TO_SERVICE, handle);
     560                sess = service_connect_blocking(SERVICE_LOC, iface, handle);
    579561        else
    580                 sess = service_connect(mgmt, SERVICE_LOC,
    581                     LOC_CONNECT_TO_SERVICE, handle);
     562                sess = service_connect(SERVICE_LOC, iface, handle);
    582563       
    583564        return sess;
     
    586567int loc_null_create(void)
    587568{
    588         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     569        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    589570       
    590571        sysarg_t null_id;
     
    601582void loc_null_destroy(int null_id)
    602583{
    603         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     584        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    604585        async_req_1_0(exch, LOC_NULL_DESTROY, (sysarg_t) null_id);
    605586        loc_exchange_end(exch);
     
    627608        sysarg_t retval;
    628609       
    629         exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER);
     610        exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
    630611        retval = async_req_2_0(exch, LOC_SERVICE_ADD_TO_CAT, svc_id, cat_id);
    631612        loc_exchange_end(exch);
     
    648629size_t loc_count_namespaces(void)
    649630{
    650         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     631        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    651632        size_t size = loc_count_namespaces_internal(exch);
    652633        loc_exchange_end(exch);
     
    657638size_t loc_count_services(service_id_t ns_handle)
    658639{
    659         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     640        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    660641        size_t size = loc_count_services_internal(exch, ns_handle);
    661642        loc_exchange_end(exch);
     
    668649        /* Loop until read is succesful */
    669650        while (true) {
    670                 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     651                async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    671652                size_t count = loc_count_namespaces_internal(exch);
    672653                loc_exchange_end(exch);
     
    679660                        return 0;
    680661               
    681                 exch = loc_exchange_begin(LOC_PORT_CONSUMER);
     662                exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
    682663               
    683664                ipc_call_t answer;
     
    717698        /* Loop until read is succesful */
    718699        while (true) {
    719                 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     700                async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    720701                size_t count = loc_count_services_internal(exch, ns_handle);
    721702                loc_exchange_end(exch);
     
    728709                        return 0;
    729710               
    730                 exch = loc_exchange_begin(LOC_PORT_CONSUMER);
     711                exch = loc_exchange_begin(INTERFACE_LOC_CONSUMER);
    731712               
    732713                ipc_call_t answer;
     
    765746    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
    766747{
    767         async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
     748        async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_CONSUMER);
    768749
    769750        ipc_call_t answer;
Note: See TracChangeset for help on using the changeset viewer.