Changeset ff381a7 in mainline for uspace/srv/locsrv/locsrv.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/srv/locsrv/locsrv.c

    r3feeab2 rff381a7  
    412412{
    413413        if (server == NULL)
    414                 return EEXISTS;
     414                return EEXIST;
    415415       
    416416        fibril_mutex_lock(&servers_list_mutex);
     
    467467        }
    468468       
    469         /* Set the interface, if any. */
    470         service->forward_interface = IPC_GET_ARG1(*icall);
    471 
    472469        /* Get fqsn */
    473470        char *fqsn;
     
    514511                free(service->name);
    515512                free(service);
    516                 async_answer_0(iid, EEXISTS);
     513                async_answer_0(iid, EEXIST);
    517514                return;
    518515        }
     
    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       
     
    959951            loc_namespace_find_id(IPC_GET_ARG1(*icall));
    960952        if (namespace == NULL)
    961                 async_answer_0(iid, EEXISTS);
     953                async_answer_0(iid, EEXIST);
    962954        else
    963955                async_answer_1(iid, EOK, namespace->refcnt);
     
    13821374 *
    13831375 */
    1384 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall)
     1376static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    13851377{
    13861378        /* Accept connection */
     
    14401432 *
    14411433 */
    1442 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall)
     1434static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    14431435{
    14441436        /* Accept connection */
     
    15071499}
    15081500
    1509 /** Function for handling connections to location service
    1510  *
    1511  */
    1512 static void loc_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    1513 {
    1514         /* Select interface */
    1515         switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
    1516         case LOC_PORT_SUPPLIER:
    1517                 loc_connection_supplier(iid, icall);
    1518                 break;
    1519         case LOC_PORT_CONSUMER:
    1520                 loc_connection_consumer(iid, icall);
    1521                 break;
    1522         case LOC_CONNECT_TO_SERVICE:
    1523                 /* Connect client to selected service */
    1524                 loc_forward(iid, icall);
    1525                 break;
    1526         default:
    1527                 /* No such interface */
    1528                 async_answer_0(iid, ENOENT);
    1529         }
    1530 }
    1531 
    15321501/**
    15331502 *
     
    15421511        }
    15431512       
    1544         /* Set a handler of incomming connections */
    1545         async_set_client_connection(loc_connection);
    1546        
    1547         /* Register location service at naming service */
    1548         int rc = service_register(SERVICE_LOC);
     1513        port_id_t port;
     1514        int rc = async_create_port(INTERFACE_LOC_SUPPLIER,
     1515            loc_connection_supplier, NULL, &port);
    15491516        if (rc != EOK)
    15501517                return rc;
    15511518       
     1519        rc = async_create_port(INTERFACE_LOC_CONSUMER,
     1520            loc_connection_consumer, NULL, &port);
     1521        if (rc != EOK)
     1522                return rc;
     1523       
     1524        /* Set a handler of incomming connections */
     1525        async_set_fallback_port_handler(loc_forward, NULL);
     1526       
     1527        /* Register location service at naming service */
     1528        rc = service_register(SERVICE_LOC);
     1529        if (rc != EOK)
     1530                return rc;
     1531       
    15521532        printf("%s: Accepting connections\n", NAME);
    15531533        async_manager();
Note: See TracChangeset for help on using the changeset viewer.