Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/locsrv/locsrv.c

    r864762a r3a9cf35  
    412412{
    413413        if (server == NULL)
    414                 return EEXISTS;
     414                return EEXIST;
    415415       
    416416        fibril_mutex_lock(&servers_list_mutex);
     
    445445        free(server);
    446446       
     447        loc_category_change_event();
    447448        return EOK;
    448449}
     
    467468        }
    468469       
    469         /* Set the interface, if any. */
    470         service->forward_interface = IPC_GET_ARG1(*icall);
    471 
    472470        /* Get fqsn */
    473471        char *fqsn;
     
    514512                free(service->name);
    515513                free(service);
    516                 async_answer_0(iid, EEXISTS);
     514                async_answer_0(iid, EEXIST);
    517515                return;
    518516        }
     
    560558        fibril_mutex_unlock(&services_list_mutex);
    561559        async_answer_0(iid, EOK);
     560
     561        loc_category_change_event();
    562562}
    563563
     
    702702 *
    703703 */
    704 static void loc_forward(ipc_callid_t callid, ipc_call_t *call)
     704static void loc_forward(ipc_callid_t callid, ipc_call_t *call, void *arg)
    705705{
    706706        fibril_mutex_lock(&services_list_mutex);
     
    709709         * Get ID from request
    710710         */
     711        iface_t iface = IPC_GET_ARG1(*call);
    711712        service_id_t id = IPC_GET_ARG2(*call);
    712713        loc_service_t *svc = loc_service_find_id(id);
     
    719720       
    720721        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        
     722        async_forward_fast(callid, exch, iface, svc->id, 0, IPC_FF_NONE);
    728723        async_exchange_end(exch);
    729724       
     
    959954            loc_namespace_find_id(IPC_GET_ARG1(*icall));
    960955        if (namespace == NULL)
    961                 async_answer_0(iid, EEXISTS);
     956                async_answer_0(iid, EEXIST);
    962957        else
    963958                async_answer_1(iid, EOK, namespace->refcnt);
     
    13221317        categ_dir_init(&cdir);
    13231318
    1324         cat = category_new("bd");
     1319        cat = category_new("disk");
     1320        categ_dir_add_cat(&cdir, cat);
     1321
     1322        cat = category_new("partition");
    13251323        categ_dir_add_cat(&cdir, cat);
    13261324
     
    13761374 *
    13771375 */
    1378 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)
    13791377{
    13801378        /* Accept connection */
     
    14341432 *
    14351433 */
    1436 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)
    14371435{
    14381436        /* Accept connection */
     
    15011499}
    15021500
    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 
    15261501/**
    15271502 *
     
    15361511        }
    15371512       
    1538         /* Set a handler of incomming connections */
    1539         async_set_client_connection(loc_connection);
    1540        
    1541         /* Register location service at naming service */
    1542         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);
    15431516        if (rc != EOK)
    15441517                return rc;
    15451518       
     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       
    15461532        printf("%s: Accepting connections\n", NAME);
    15471533        async_manager();
Note: See TracChangeset for help on using the changeset viewer.