Changeset f9b2cb4c in mainline for uspace/srv/locsrv/locsrv.c


Ignore:
Timestamp:
2015-08-23T12:50:23Z (9 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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();
Note: See TracChangeset for help on using the changeset viewer.