Ignore:
File:
1 edited

Legend:

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

    r3a9cf35 r864762a  
    412412{
    413413        if (server == NULL)
    414                 return EEXIST;
     414                return EEXISTS;
    415415       
    416416        fibril_mutex_lock(&servers_list_mutex);
     
    445445        free(server);
    446446       
    447         loc_category_change_event();
    448447        return EOK;
    449448}
     
    468467        }
    469468       
     469        /* Set the interface, if any. */
     470        service->forward_interface = IPC_GET_ARG1(*icall);
     471
    470472        /* Get fqsn */
    471473        char *fqsn;
     
    512514                free(service->name);
    513515                free(service);
    514                 async_answer_0(iid, EEXIST);
     516                async_answer_0(iid, EEXISTS);
    515517                return;
    516518        }
     
    558560        fibril_mutex_unlock(&services_list_mutex);
    559561        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, void *arg)
     704static void loc_forward(ipc_callid_t callid, ipc_call_t *call)
    705705{
    706706        fibril_mutex_lock(&services_list_mutex);
     
    709709         * Get ID from request
    710710         */
    711         iface_t iface = IPC_GET_ARG1(*call);
    712711        service_id_t id = IPC_GET_ARG2(*call);
    713712        loc_service_t *svc = loc_service_find_id(id);
     
    720719       
    721720        async_exch_t *exch = async_exchange_begin(svc->server->sess);
    722         async_forward_fast(callid, exch, iface, svc->id, 0, IPC_FF_NONE);
     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       
    723728        async_exchange_end(exch);
    724729       
     
    954959            loc_namespace_find_id(IPC_GET_ARG1(*icall));
    955960        if (namespace == NULL)
    956                 async_answer_0(iid, EEXIST);
     961                async_answer_0(iid, EEXISTS);
    957962        else
    958963                async_answer_1(iid, EOK, namespace->refcnt);
     
    13171322        categ_dir_init(&cdir);
    13181323
    1319         cat = category_new("disk");
    1320         categ_dir_add_cat(&cdir, cat);
    1321 
    1322         cat = category_new("partition");
     1324        cat = category_new("bd");
    13231325        categ_dir_add_cat(&cdir, cat);
    13241326
     
    13741376 *
    13751377 */
    1376 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     1378static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall)
    13771379{
    13781380        /* Accept connection */
     
    14321434 *
    14331435 */
    1434 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     1436static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall)
    14351437{
    14361438        /* Accept connection */
     
    14991501}
    15001502
     1503/** Function for handling connections to location service
     1504 *
     1505 */
     1506static 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
    15011526/**
    15021527 *
     
    15111536        }
    15121537       
    1513         port_id_t port;
    1514         int rc = async_create_port(INTERFACE_LOC_SUPPLIER,
    1515             loc_connection_supplier, NULL, &port);
     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);
    15161543        if (rc != EOK)
    15171544                return rc;
    15181545       
    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        
    15321546        printf("%s: Accepting connections\n", NAME);
    15331547        async_manager();
Note: See TracChangeset for help on using the changeset viewer.