Changes in uspace/lib/c/generic/loc.c [38d150e:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loc.c
r38d150e rb7fd2a0 103 103 * 104 104 */ 105 static int loc_callback_create(void)105 static errno_t loc_callback_create(void) 106 106 { 107 107 if (!loc_callback_created) { … … 113 113 114 114 port_id_t port; 115 int rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0,115 errno_t rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0, 116 116 loc_cb_conn, NULL, &port); 117 117 … … 121 121 return rc; 122 122 123 sysarg_t retval;123 errno_t retval; 124 124 async_wait_for(req, &retval); 125 125 if (retval != EOK) … … 239 239 240 240 /** Register new driver with loc. */ 241 int loc_server_register(const char *name)241 errno_t loc_server_register(const char *name) 242 242 { 243 243 async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER); … … 245 245 ipc_call_t answer; 246 246 aid_t req = async_send_2(exch, LOC_SERVER_REGISTER, 0, 0, &answer); 247 sysarg_t retval = async_data_write_start(exch, name, str_size(name));247 errno_t retval = async_data_write_start(exch, name, str_size(name)); 248 248 249 249 if (retval != EOK) { … … 272 272 * 273 273 */ 274 int loc_service_register(const char *fqsn, service_id_t *sid)274 errno_t loc_service_register(const char *fqsn, service_id_t *sid) 275 275 { 276 276 async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER); … … 278 278 ipc_call_t answer; 279 279 aid_t req = async_send_0(exch, LOC_SERVICE_REGISTER, &answer); 280 sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));280 errno_t retval = async_data_write_start(exch, fqsn, str_size(fqsn)); 281 281 282 282 if (retval != EOK) { … … 311 311 * @param sid Service ID 312 312 */ 313 int loc_service_unregister(service_id_t sid)313 errno_t loc_service_unregister(service_id_t sid) 314 314 { 315 315 async_exch_t *exch; 316 sysarg_t retval;316 errno_t retval; 317 317 318 318 exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER); … … 320 320 loc_exchange_end(exch); 321 321 322 return ( int)retval;323 } 324 325 int loc_service_get_id(const char *fqdn, service_id_t *handle,322 return (errno_t)retval; 323 } 324 325 errno_t loc_service_get_id(const char *fqdn, service_id_t *handle, 326 326 unsigned int flags) 327 327 { … … 339 339 aid_t req = async_send_2(exch, LOC_SERVICE_GET_ID, flags, 0, 340 340 &answer); 341 sysarg_t retval = async_data_write_start(exch, fqdn, str_size(fqdn));341 errno_t retval = async_data_write_start(exch, fqdn, str_size(fqdn)); 342 342 343 343 loc_exchange_end(exch); … … 371 371 * @param name Place to store pointer to new string. Caller should 372 372 * free it using free(). 373 * @return EOK on success or negativeerror code374 */ 375 static int loc_get_name_internal(sysarg_t method, sysarg_t id, char **name)373 * @return EOK on success or an error code 374 */ 375 static errno_t loc_get_name_internal(sysarg_t method, sysarg_t id, char **name) 376 376 { 377 377 async_exch_t *exch; … … 379 379 ipc_call_t dreply; 380 380 size_t act_size; 381 sysarg_t dretval;381 errno_t dretval; 382 382 383 383 *name = NULL; … … 397 397 } 398 398 399 sysarg_t retval;399 errno_t retval; 400 400 async_wait_for(req, &retval); 401 401 … … 421 421 * @param name Place to store pointer to new string. Caller should 422 422 * free it using free(). 423 * @return EOK on success or negativeerror code424 */ 425 int loc_category_get_name(category_id_t cat_id, char **name)423 * @return EOK on success or an error code 424 */ 425 errno_t loc_category_get_name(category_id_t cat_id, char **name) 426 426 { 427 427 return loc_get_name_internal(LOC_CATEGORY_GET_NAME, cat_id, name); … … 435 435 * @param name Place to store pointer to new string. Caller should 436 436 * free it using free(). 437 * @return EOK on success or negativeerror code438 */ 439 int loc_service_get_name(service_id_t svc_id, char **name)437 * @return EOK on success or an error code 438 */ 439 errno_t loc_service_get_name(service_id_t svc_id, char **name) 440 440 { 441 441 return loc_get_name_internal(LOC_SERVICE_GET_NAME, svc_id, name); … … 449 449 * @param name Place to store pointer to new string. Caller should 450 450 * free it using free(). 451 * @return EOK on success or negativeerror code452 */ 453 int loc_service_get_server_name(service_id_t svc_id, char **name)451 * @return EOK on success or an error code 452 */ 453 errno_t loc_service_get_server_name(service_id_t svc_id, char **name) 454 454 { 455 455 return loc_get_name_internal(LOC_SERVICE_GET_SERVER_NAME, svc_id, name); 456 456 } 457 457 458 int loc_namespace_get_id(const char *name, service_id_t *handle,458 errno_t loc_namespace_get_id(const char *name, service_id_t *handle, 459 459 unsigned int flags) 460 460 { … … 472 472 aid_t req = async_send_2(exch, LOC_NAMESPACE_GET_ID, flags, 0, 473 473 &answer); 474 sysarg_t retval = async_data_write_start(exch, name, str_size(name));474 errno_t retval = async_data_write_start(exch, name, str_size(name)); 475 475 476 476 loc_exchange_end(exch); … … 503 503 * @param cat_id Place to store ID 504 504 * @param flags IPC_FLAG_BLOCKING to wait for location service to start 505 * @return EOK on success or negativeerror code506 */ 507 int loc_category_get_id(const char *name, category_id_t *cat_id,505 * @return EOK on success or an error code 506 */ 507 errno_t loc_category_get_id(const char *name, category_id_t *cat_id, 508 508 unsigned int flags) 509 509 { … … 521 521 aid_t req = async_send_0(exch, LOC_CATEGORY_GET_ID, 522 522 &answer); 523 sysarg_t retval = async_data_write_start(exch, name, str_size(name));523 errno_t retval = async_data_write_start(exch, name, str_size(name)); 524 524 525 525 loc_exchange_end(exch); … … 551 551 552 552 sysarg_t type; 553 int retval = async_req_1_1(exch, LOC_ID_PROBE, handle, &type);553 errno_t retval = async_req_1_1(exch, LOC_ID_PROBE, handle, &type); 554 554 555 555 loc_exchange_end(exch); … … 574 574 } 575 575 576 /** 577 * @return ID of a new NULL device, or -1 if failed. 578 */ 576 579 int loc_null_create(void) 577 580 { … … 579 582 580 583 sysarg_t null_id; 581 int retval = async_req_0_1(exch, LOC_NULL_CREATE, &null_id);584 errno_t retval = async_req_0_1(exch, LOC_NULL_CREATE, &null_id); 582 585 583 586 loc_exchange_end(exch); … … 599 602 { 600 603 sysarg_t count; 601 int retval = async_req_0_1(exch, LOC_GET_NAMESPACE_COUNT, &count);604 errno_t retval = async_req_0_1(exch, LOC_GET_NAMESPACE_COUNT, &count); 602 605 if (retval != EOK) 603 606 return 0; … … 610 613 * @param svc_id Service ID 611 614 * @param cat_id Category ID 612 * @return EOK on success or negativeerror code613 */ 614 int loc_service_add_to_cat(service_id_t svc_id, service_id_t cat_id)615 * @return EOK on success or an error code 616 */ 617 errno_t loc_service_add_to_cat(service_id_t svc_id, service_id_t cat_id) 615 618 { 616 619 async_exch_t *exch; 617 sysarg_t retval;620 errno_t retval; 618 621 619 622 exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER); … … 628 631 { 629 632 sysarg_t count; 630 int retval = async_req_1_1(exch, LOC_GET_SERVICE_COUNT, ns_handle,633 errno_t retval = async_req_1_1(exch, LOC_GET_SERVICE_COUNT, ns_handle, 631 634 &count); 632 635 if (retval != EOK) … … 673 676 ipc_call_t answer; 674 677 aid_t req = async_send_0(exch, LOC_GET_NAMESPACES, &answer); 675 int rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));678 errno_t rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t)); 676 679 677 680 loc_exchange_end(exch); … … 692 695 } 693 696 694 sysarg_t retval;697 errno_t retval; 695 698 async_wait_for(req, &retval); 696 699 … … 722 725 ipc_call_t answer; 723 726 aid_t req = async_send_1(exch, LOC_GET_SERVICES, ns_handle, &answer); 724 int rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));727 errno_t rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t)); 725 728 726 729 loc_exchange_end(exch); … … 741 744 } 742 745 743 sysarg_t retval;746 errno_t retval; 744 747 async_wait_for(req, &retval); 745 748 … … 752 755 } 753 756 754 static int loc_category_get_ids_once(sysarg_t method, sysarg_t arg1,757 static errno_t loc_category_get_ids_once(sysarg_t method, sysarg_t arg1, 755 758 sysarg_t *id_buf, size_t buf_size, size_t *act_size) 756 759 { … … 759 762 ipc_call_t answer; 760 763 aid_t req = async_send_1(exch, method, arg1, &answer); 761 int rc = async_data_read_start(exch, id_buf, buf_size);764 errno_t rc = async_data_read_start(exch, id_buf, buf_size); 762 765 763 766 loc_exchange_end(exch); … … 768 771 } 769 772 770 sysarg_t retval;773 errno_t retval; 771 774 async_wait_for(req, &retval); 772 775 … … 787 790 * @param data Place to store pointer to array of IDs 788 791 * @param count Place to store number of IDs 789 * @return EOK on success or negativeerror code790 */ 791 static int loc_get_ids_internal(sysarg_t method, sysarg_t arg1,792 * @return EOK on success or an error code 793 */ 794 static errno_t loc_get_ids_internal(sysarg_t method, sysarg_t arg1, 792 795 sysarg_t **data, size_t *count) 793 796 { … … 796 799 797 800 size_t act_size = 0; 798 int rc = loc_category_get_ids_once(method, arg1, NULL, 0,801 errno_t rc = loc_category_get_ids_once(method, arg1, NULL, 0, 799 802 &act_size); 800 803 if (rc != EOK) … … 833 836 * @param data Place to store pointer to array of IDs 834 837 * @param count Place to store number of IDs 835 * @return EOK on success or negativeerror code836 */ 837 int loc_category_get_svcs(category_id_t cat_id, service_id_t **data,838 * @return EOK on success or an error code 839 */ 840 errno_t loc_category_get_svcs(category_id_t cat_id, service_id_t **data, 838 841 size_t *count) 839 842 { … … 848 851 * @param data Place to store pointer to array of IDs 849 852 * @param count Place to store number of IDs 850 * @return EOK on success or negativeerror code851 */ 852 int loc_get_categories(category_id_t **data, size_t *count)853 * @return EOK on success or an error code 854 */ 855 errno_t loc_get_categories(category_id_t **data, size_t *count) 853 856 { 854 857 return loc_get_ids_internal(LOC_GET_CATEGORIES, 0, … … 856 859 } 857 860 858 int loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun)861 errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun) 859 862 { 860 863 fibril_mutex_lock(&loc_callback_mutex);
Note:
See TracChangeset
for help on using the changeset viewer.