Changes in uspace/lib/hound/src/protocol.c [33b8d024:cf13b17] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/hound/src/protocol.c
r33b8d024 rcf13b17 93 93 { 94 94 service_id_t id = 0; 95 const errno_t ret =95 const int ret = 96 96 loc_service_get_id(service, &id, IPC_FLAG_BLOCKING); 97 97 if (ret != EOK) … … 115 115 * @param name Valid string identifier 116 116 * @param record True if the application context wishes to receive data. 117 * 118 * @param[out] id Return context ID. 119 * 120 * @return EOK on success, Error code on failure. 121 */ 122 errno_t hound_service_register_context(hound_sess_t *sess, 123 const char *name, bool record, hound_context_id_t *id) 117 * @return Valid ID on success, Error code on failure. 118 */ 119 hound_context_id_t hound_service_register_context(hound_sess_t *sess, 120 const char *name, bool record) 124 121 { 125 122 assert(sess); … … 129 126 aid_t mid = 130 127 async_send_1(exch, IPC_M_HOUND_CONTEXT_REGISTER, record, &call); 131 errno_t ret = mid ? EOK : EPARTY;128 int ret = mid ? EOK : EPARTY; 132 129 133 130 if (ret == EOK) … … 137 134 138 135 if (ret == EOK) 139 async_wait_for(mid, &ret);136 async_wait_for(mid, (sysarg_t *)&ret); 140 137 141 138 async_exchange_end(exch); 142 if (ret == EOK) { 143 *id = (hound_context_id_t)IPC_GET_ARG1(call); 144 } 145 146 return ret; 139 return ret == EOK ? (hound_context_id_t)IPC_GET_ARG1(call) : ret; 147 140 } 148 141 … … 153 146 * @return Error code. 154 147 */ 155 errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id)148 int hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id) 156 149 { 157 150 assert(sess); 158 151 async_exch_t *exch = async_exchange_begin(sess); 159 const errno_t ret =152 const int ret = 160 153 async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER, id); 161 154 async_exchange_end(exch); … … 173 166 * @retval Error code. 174 167 */ 175 errno_t hound_service_get_list(hound_sess_t *sess,char ***ids, size_t *count,168 int hound_service_get_list(hound_sess_t *sess, const char ***ids, size_t *count, 176 169 int flags, const char *connection) 177 170 { … … 189 182 ipc_call_t res_call; 190 183 aid_t mid = async_send_3(exch, IPC_M_HOUND_GET_LIST, flags, *count, 191 connection != NULL, &res_call);192 193 errno_t ret = EOK;184 (bool)connection, &res_call); 185 186 int ret = EOK; 194 187 if (mid && connection) 195 188 ret = async_data_write_start(exch, connection, … … 197 190 198 191 if (ret == EOK) 199 async_wait_for(mid, &ret);192 async_wait_for(mid, (sysarg_t*)&ret); 200 193 201 194 if (ret != EOK) { … … 206 199 207 200 /* Start receiving names */ 208 c har **names = NULL;201 const char **names = NULL; 209 202 if (name_count) { 210 203 size_t *sizes = calloc(name_count, sizeof(size_t)); … … 247 240 * @return Error code. 248 241 */ 249 errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,242 int hound_service_connect_source_sink(hound_sess_t *sess, const char *source, 250 243 const char *sink) 251 244 { … … 259 252 ipc_call_t call; 260 253 aid_t id = async_send_0(exch, IPC_M_HOUND_CONNECT, &call); 261 errno_t ret = id ? EOK : EPARTY;254 int ret = id ? EOK : EPARTY; 262 255 if (ret == EOK) 263 256 ret = async_data_write_start(exch, source, str_size(source)); 264 257 if (ret == EOK) 265 258 ret = async_data_write_start(exch, sink, str_size(sink)); 266 async_wait_for(id, &ret);259 async_wait_for(id, (sysarg_t*)&ret); 267 260 async_exchange_end(exch); 268 261 return ret; … … 276 269 * @return Error code. 277 270 */ 278 errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,271 int hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source, 279 272 const char *sink) 280 273 { … … 285 278 ipc_call_t call; 286 279 aid_t id = async_send_0(exch, IPC_M_HOUND_DISCONNECT, &call); 287 errno_t ret = id ? EOK : EPARTY;280 int ret = id ? EOK : EPARTY; 288 281 if (ret == EOK) 289 282 ret = async_data_write_start(exch, source, str_size(source)); 290 283 if (ret == EOK) 291 284 ret = async_data_write_start(exch, sink, str_size(sink)); 292 async_wait_for(id, &ret);285 async_wait_for(id, (sysarg_t*)&ret); 293 286 async_exchange_end(exch); 294 287 return ENOTSUP; … … 304 297 * @return Error code. 305 298 */ 306 errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,299 int hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id, 307 300 int flags, pcm_format_t format, size_t bsize) 308 301 { … … 321 314 * @return Error code. 322 315 */ 323 errno_t hound_service_stream_exit(async_exch_t *exch)316 int hound_service_stream_exit(async_exch_t *exch) 324 317 { 325 318 return async_req_0_0(exch, IPC_M_HOUND_STREAM_EXIT); … … 331 324 * @return Error code. 332 325 */ 333 errno_t hound_service_stream_drain(async_exch_t *exch)326 int hound_service_stream_drain(async_exch_t *exch) 334 327 { 335 328 return async_req_0_0(exch, IPC_M_HOUND_STREAM_DRAIN); … … 343 336 * @return Error code. 344 337 */ 345 errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size)338 int hound_service_stream_write(async_exch_t *exch, const void *data, size_t size) 346 339 { 347 340 return async_data_write_start(exch, data, size); … … 355 348 * @return Error code. 356 349 */ 357 errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size)350 int hound_service_stream_read(async_exch_t *exch, void *data, size_t size) 358 351 { 359 352 return async_data_read_start(exch, data, size); … … 407 400 408 401 /* Get context name */ 409 errno_t ret =402 int ret = 410 403 async_data_write_accept(&name, true, 0, 0, 0, 0); 411 404 if (ret != EOK) { … … 434 427 /* get id, 1st param */ 435 428 hound_context_id_t id = IPC_GET_ARG1(call); 436 const errno_t ret =429 const int ret = 437 430 server_iface->rem_context(server_iface->server, id); 438 431 async_answer_0(callid, ret); … … 446 439 } 447 440 448 c har **list = NULL;441 const char **list = NULL; 449 442 const int flags = IPC_GET_ARG1(call); 450 443 size_t count = IPC_GET_ARG2(call); 451 444 const bool conn = IPC_GET_ARG3(call); 452 445 char *conn_name = NULL; 453 errno_t ret = EOK;446 int ret = EOK; 454 447 455 448 /* get connected actor name if provided */ … … 513 506 514 507 /* read source name */ 515 errno_t ret =508 int ret = 516 509 async_data_write_accept(&source, true, 0, 0, 0, 0); 517 510 /* read sink name */ … … 539 532 540 533 /* read source name */ 541 errno_t ret =534 int ret = 542 535 async_data_write_accept(&source, true, 0, 0, 0, 0); 543 536 /*read sink name */ … … 574 567 575 568 void *stream; 576 errno_t ret = server_iface->add_stream(server_iface->server,569 int ret = server_iface->add_stream(server_iface->server, 577 570 id, flags, f, bsize, &stream); 578 571 if (ret != EOK) { … … 626 619 ipc_call_t call; 627 620 size_t size = 0; 628 errno_t ret_answer = EOK;621 int ret_answer = EOK; 629 622 /* accept data write or drain */ 630 623 while (async_data_write_receive_call(&callid, &call, &size) … … 632 625 /* check drain first */ 633 626 if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) { 634 errno_t ret = ENOTSUP;627 int ret = ENOTSUP; 635 628 if (server_iface->drain_stream) 636 629 ret = server_iface->drain_stream(stream); … … 650 643 continue; 651 644 } 652 const errno_t ret = async_data_write_finalize(callid, buffer, size);645 const int ret = async_data_write_finalize(callid, buffer, size); 653 646 if (ret == EOK) { 654 647 /* push data to stream */ … … 657 650 } 658 651 } 659 const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT652 const int ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT 660 653 ? EOK : EINVAL; 661 654 … … 673 666 ipc_call_t call; 674 667 size_t size = 0; 675 errno_t ret_answer = EOK;668 int ret_answer = EOK; 676 669 /* accept data read and drain */ 677 670 while (async_data_read_receive_call(&callid, &call, &size) … … 679 672 /* drain does not make much sense but it is allowed */ 680 673 if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) { 681 errno_t ret = ENOTSUP;674 int ret = ENOTSUP; 682 675 if (server_iface->drain_stream) 683 676 ret = server_iface->drain_stream(stream); … … 695 688 continue; 696 689 } 697 errno_t ret = server_iface->stream_data_read(stream, buffer, size);690 int ret = server_iface->stream_data_read(stream, buffer, size); 698 691 if (ret == EOK) { 699 692 ret_answer = … … 701 694 } 702 695 } 703 const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT696 const int ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT 704 697 ? EOK : EINVAL; 705 698 … … 718 711 * @return Error code. 719 712 */ 720 errno_t hound_server_register(const char *name, service_id_t *id)713 int hound_server_register(const char *name, service_id_t *id) 721 714 { 722 715 if (!name || !id) 723 716 return EINVAL; 724 717 725 errno_t ret = loc_server_register(name);718 int ret = loc_server_register(name); 726 719 if (ret != EOK) 727 720 return ret; … … 744 737 * @return Error code. 745 738 */ 746 errno_t hound_server_set_device_change_callback(dev_change_callback_t cb)739 int hound_server_set_device_change_callback(dev_change_callback_t cb) 747 740 { 748 741 return loc_register_cat_change_cb(cb); … … 754 747 * @return Error code. 755 748 */ 756 errno_t hound_server_devices_iterate(device_callback_t callback)749 int hound_server_devices_iterate(device_callback_t callback) 757 750 { 758 751 if (!callback) … … 762 755 763 756 if (!resolved) { 764 const errno_t ret = loc_category_get_id("audio-pcm", &cat_id,757 const int ret = loc_category_get_id("audio-pcm", &cat_id, 765 758 IPC_FLAG_BLOCKING); 766 759 if (ret != EOK) … … 771 764 service_id_t *svcs = NULL; 772 765 size_t count = 0; 773 const errno_t ret = loc_category_get_svcs(cat_id, &svcs, &count);766 const int ret = loc_category_get_svcs(cat_id, &svcs, &count); 774 767 if (ret != EOK) 775 768 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.