Changes in uspace/lib/c/generic/loc.c [f9b2cb4c:3e6a98c5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loc.c
rf9b2cb4c r3e6a98c5 107 107 if (!loc_callback_created) { 108 108 async_exch_t *exch = 109 loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);109 loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 110 110 111 111 ipc_call_t answer; 112 112 aid_t req = async_send_0(exch, LOC_CALLBACK_CREATE, &answer); 113 114 port_id_t port; 115 int rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0, 116 loc_cb_conn, NULL, &port); 117 113 int rc = async_connect_to_me(exch, 0, 0, 0, loc_cb_conn, NULL); 118 114 loc_exchange_end(exch); 119 115 … … 139 135 * 140 136 */ 141 async_exch_t *loc_exchange_begin_blocking( iface_t iface)137 async_exch_t *loc_exchange_begin_blocking(loc_interface_t iface) 142 138 { 143 139 switch (iface) { 144 case INTERFACE_LOC_SUPPLIER:140 case LOC_PORT_SUPPLIER: 145 141 fibril_mutex_lock(&loc_supp_block_mutex); 146 142 … … 151 147 if (loc_supp_block_sess == NULL) 152 148 loc_supp_block_sess = 153 service_connect_blocking( SERVICE_LOC,154 INTERFACE_LOC_SUPPLIER, 0);149 service_connect_blocking(EXCHANGE_SERIALIZE, 150 SERVICE_LOC, LOC_PORT_SUPPLIER, 0); 155 151 } 156 152 … … 161 157 162 158 return async_exchange_begin(loc_supp_block_sess); 163 case INTERFACE_LOC_CONSUMER:159 case LOC_PORT_CONSUMER: 164 160 fibril_mutex_lock(&loc_cons_block_mutex); 165 161 … … 170 166 if (loc_cons_block_sess == NULL) 171 167 loc_cons_block_sess = 172 service_connect_blocking( SERVICE_LOC,173 INTERFACE_LOC_CONSUMER, 0);168 service_connect_blocking(EXCHANGE_SERIALIZE, 169 SERVICE_LOC, LOC_PORT_CONSUMER, 0); 174 170 } 175 171 … … 192 188 * 193 189 */ 194 async_exch_t *loc_exchange_begin( iface_t iface)190 async_exch_t *loc_exchange_begin(loc_interface_t iface) 195 191 { 196 192 switch (iface) { 197 case INTERFACE_LOC_SUPPLIER:193 case LOC_PORT_SUPPLIER: 198 194 fibril_mutex_lock(&loc_supplier_mutex); 199 195 200 196 if (loc_supplier_sess == NULL) 201 197 loc_supplier_sess = 202 service_connect( SERVICE_LOC,203 INTERFACE_LOC_SUPPLIER, 0);198 service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC, 199 LOC_PORT_SUPPLIER, 0); 204 200 205 201 fibril_mutex_unlock(&loc_supplier_mutex); … … 209 205 210 206 return async_exchange_begin(loc_supplier_sess); 211 case INTERFACE_LOC_CONSUMER:207 case LOC_PORT_CONSUMER: 212 208 fibril_mutex_lock(&loc_consumer_mutex); 213 209 214 210 if (loc_consumer_sess == NULL) 215 211 loc_consumer_sess = 216 service_connect( SERVICE_LOC,217 INTERFACE_LOC_CONSUMER, 0);212 service_connect(EXCHANGE_SERIALIZE, SERVICE_LOC, 213 LOC_PORT_CONSUMER, 0); 218 214 219 215 fibril_mutex_unlock(&loc_consumer_mutex); … … 241 237 int loc_server_register(const char *name) 242 238 { 243 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_SUPPLIER);239 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); 244 240 245 241 ipc_call_t answer; … … 254 250 } 255 251 256 exch = loc_exchange_begin( INTERFACE_LOC_SUPPLIER);257 async_connect_to_me(exch, 0, 0, 0 );252 exch = loc_exchange_begin(LOC_PORT_SUPPLIER); 253 async_connect_to_me(exch, 0, 0, 0, NULL, NULL); 258 254 loc_exchange_end(exch); 259 255 … … 264 260 /** Register new service. 265 261 * 266 * @param fqsn Fully qualified service name 267 * @param[out] sid Service ID of new service 268 * 269 */ 270 int loc_service_register(const char *fqsn, service_id_t *sid) 271 { 272 async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER); 262 * The @p interface is used when forwarding connection to the server. 263 * If not 0, the first argument is the interface and the second argument 264 * is the service ID. 265 * 266 * When the interface is zero (default), the first argument is directly 267 * the handle (to ensure backward compatibility). 268 * 269 * @param fqsn Fully qualified service name 270 * @param[out] sid Service ID of new service 271 * @param interface Interface when forwarding 272 * 273 */ 274 int loc_service_register_with_iface(const char *fqsn, 275 service_id_t *sid, sysarg_t interface) 276 { 277 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); 273 278 274 279 ipc_call_t answer; 275 aid_t req = async_send_0(exch, LOC_SERVICE_REGISTER, &answer); 280 aid_t req = async_send_2(exch, LOC_SERVICE_REGISTER, interface, 0, 281 &answer); 276 282 sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn)); 277 283 … … 298 304 } 299 305 306 /** Register new service. 307 * 308 * @param fqsn Fully qualified service name 309 * @param sid Output: ID of new service 310 * 311 */ 312 int loc_service_register(const char *fqdn, service_id_t *sid) 313 { 314 return loc_service_register_with_iface(fqdn, sid, 0); 315 } 316 300 317 /** Unregister service. 301 318 * … … 307 324 sysarg_t retval; 308 325 309 exch = loc_exchange_begin_blocking( INTERFACE_LOC_SUPPLIER);326 exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); 310 327 retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid); 311 328 loc_exchange_end(exch); … … 320 337 321 338 if (flags & IPC_FLAG_BLOCKING) 322 exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);339 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 323 340 else { 324 exch = loc_exchange_begin( INTERFACE_LOC_CONSUMER);341 exch = loc_exchange_begin(LOC_PORT_CONSUMER); 325 342 if (exch == NULL) 326 343 return errno; … … 373 390 374 391 *name = NULL; 375 exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);392 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 376 393 377 394 ipc_call_t answer; … … 453 470 454 471 if (flags & IPC_FLAG_BLOCKING) 455 exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);472 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 456 473 else { 457 exch = loc_exchange_begin( INTERFACE_LOC_CONSUMER);474 exch = loc_exchange_begin(LOC_PORT_CONSUMER); 458 475 if (exch == NULL) 459 476 return errno; … … 502 519 503 520 if (flags & IPC_FLAG_BLOCKING) 504 exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);521 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 505 522 else { 506 exch = loc_exchange_begin( INTERFACE_LOC_CONSUMER);523 exch = loc_exchange_begin(LOC_PORT_CONSUMER); 507 524 if (exch == NULL) 508 525 return errno; … … 539 556 loc_object_type_t loc_id_probe(service_id_t handle) 540 557 { 541 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);558 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 542 559 543 560 sysarg_t type; … … 552 569 } 553 570 554 async_sess_t *loc_service_connect( service_id_t handle, iface_t iface,571 async_sess_t *loc_service_connect(exch_mgmt_t mgmt, service_id_t handle, 555 572 unsigned int flags) 556 573 { … … 558 575 559 576 if (flags & IPC_FLAG_BLOCKING) 560 sess = service_connect_blocking(SERVICE_LOC, iface, handle); 577 sess = service_connect_blocking(mgmt, SERVICE_LOC, 578 LOC_CONNECT_TO_SERVICE, handle); 561 579 else 562 sess = service_connect(SERVICE_LOC, iface, handle); 580 sess = service_connect(mgmt, SERVICE_LOC, 581 LOC_CONNECT_TO_SERVICE, handle); 563 582 564 583 return sess; … … 567 586 int loc_null_create(void) 568 587 { 569 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);588 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 570 589 571 590 sysarg_t null_id; … … 582 601 void loc_null_destroy(int null_id) 583 602 { 584 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);603 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 585 604 async_req_1_0(exch, LOC_NULL_DESTROY, (sysarg_t) null_id); 586 605 loc_exchange_end(exch); … … 608 627 sysarg_t retval; 609 628 610 exch = loc_exchange_begin_blocking( INTERFACE_LOC_SUPPLIER);629 exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); 611 630 retval = async_req_2_0(exch, LOC_SERVICE_ADD_TO_CAT, svc_id, cat_id); 612 631 loc_exchange_end(exch); … … 629 648 size_t loc_count_namespaces(void) 630 649 { 631 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);650 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 632 651 size_t size = loc_count_namespaces_internal(exch); 633 652 loc_exchange_end(exch); … … 638 657 size_t loc_count_services(service_id_t ns_handle) 639 658 { 640 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);659 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 641 660 size_t size = loc_count_services_internal(exch, ns_handle); 642 661 loc_exchange_end(exch); … … 649 668 /* Loop until read is succesful */ 650 669 while (true) { 651 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);670 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 652 671 size_t count = loc_count_namespaces_internal(exch); 653 672 loc_exchange_end(exch); … … 660 679 return 0; 661 680 662 exch = loc_exchange_begin( INTERFACE_LOC_CONSUMER);681 exch = loc_exchange_begin(LOC_PORT_CONSUMER); 663 682 664 683 ipc_call_t answer; … … 698 717 /* Loop until read is succesful */ 699 718 while (true) { 700 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);719 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 701 720 size_t count = loc_count_services_internal(exch, ns_handle); 702 721 loc_exchange_end(exch); … … 709 728 return 0; 710 729 711 exch = loc_exchange_begin( INTERFACE_LOC_CONSUMER);730 exch = loc_exchange_begin(LOC_PORT_CONSUMER); 712 731 713 732 ipc_call_t answer; … … 746 765 sysarg_t *id_buf, size_t buf_size, size_t *act_size) 747 766 { 748 async_exch_t *exch = loc_exchange_begin_blocking( INTERFACE_LOC_CONSUMER);767 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 749 768 750 769 ipc_call_t answer;
Note:
See TracChangeset
for help on using the changeset viewer.