Changes in uspace/srv/locsrv/locsrv.c [864762a:3a9cf35] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/locsrv/locsrv.c
r864762a r3a9cf35 412 412 { 413 413 if (server == NULL) 414 return EEXIST S;414 return EEXIST; 415 415 416 416 fibril_mutex_lock(&servers_list_mutex); … … 445 445 free(server); 446 446 447 loc_category_change_event(); 447 448 return EOK; 448 449 } … … 467 468 } 468 469 469 /* Set the interface, if any. */470 service->forward_interface = IPC_GET_ARG1(*icall);471 472 470 /* Get fqsn */ 473 471 char *fqsn; … … 514 512 free(service->name); 515 513 free(service); 516 async_answer_0(iid, EEXIST S);514 async_answer_0(iid, EEXIST); 517 515 return; 518 516 } … … 560 558 fibril_mutex_unlock(&services_list_mutex); 561 559 async_answer_0(iid, EOK); 560 561 loc_category_change_event(); 562 562 } 563 563 … … 702 702 * 703 703 */ 704 static void loc_forward(ipc_callid_t callid, ipc_call_t *call )704 static void loc_forward(ipc_callid_t callid, ipc_call_t *call, void *arg) 705 705 { 706 706 fibril_mutex_lock(&services_list_mutex); … … 709 709 * Get ID from request 710 710 */ 711 iface_t iface = IPC_GET_ARG1(*call); 711 712 service_id_t id = IPC_GET_ARG2(*call); 712 713 loc_service_t *svc = loc_service_find_id(id); … … 719 720 720 721 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); 728 723 async_exchange_end(exch); 729 724 … … 959 954 loc_namespace_find_id(IPC_GET_ARG1(*icall)); 960 955 if (namespace == NULL) 961 async_answer_0(iid, EEXIST S);956 async_answer_0(iid, EEXIST); 962 957 else 963 958 async_answer_1(iid, EOK, namespace->refcnt); … … 1322 1317 categ_dir_init(&cdir); 1323 1318 1324 cat = category_new("bd"); 1319 cat = category_new("disk"); 1320 categ_dir_add_cat(&cdir, cat); 1321 1322 cat = category_new("partition"); 1325 1323 categ_dir_add_cat(&cdir, cat); 1326 1324 … … 1376 1374 * 1377 1375 */ 1378 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall )1376 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall, void *arg) 1379 1377 { 1380 1378 /* Accept connection */ … … 1434 1432 * 1435 1433 */ 1436 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall )1434 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall, void *arg) 1437 1435 { 1438 1436 /* Accept connection */ … … 1501 1499 } 1502 1500 1503 /** Function for handling connections to location service1504 *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 1526 1501 /** 1527 1502 * … … 1536 1511 } 1537 1512 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); 1543 1516 if (rc != EOK) 1544 1517 return rc; 1545 1518 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 1546 1532 printf("%s: Accepting connections\n", NAME); 1547 1533 async_manager();
Note:
See TracChangeset
for help on using the changeset viewer.