Changeset 914c693 in mainline
- Timestamp:
- 2018-07-08T19:25:52Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 87337dc5
- Parents:
- d4475a44
- Location:
- uspace/lib/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async/client.c
rd4475a44 r914c693 694 694 695 695 static errno_t async_connect_me_to_internal(cap_phone_handle_t phone, 696 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,696 iface_t iface, sysarg_t arg2, sysarg_t arg3, sysarg_t flags, 697 697 cap_phone_handle_t *out_phone) 698 698 { … … 710 710 msg->wdata.active = true; 711 711 712 ipc_call_async_4(phone, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3, arg4,713 msg, reply_received);712 ipc_call_async_4(phone, IPC_M_CONNECT_ME_TO, (sysarg_t) iface, arg2, 713 arg3, flags, msg, reply_received); 714 714 715 715 errno_t rc; … … 721 721 *out_phone = (cap_phone_handle_t) IPC_GET_ARG5(result); 722 722 return EOK; 723 }724 725 /** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.726 *727 * Ask through for a new connection to some service.728 *729 * @param mgmt Exchange management style.730 * @param exch Exchange for sending the message.731 * @param arg1 User defined argument.732 * @param arg2 User defined argument.733 * @param arg3 User defined argument.734 *735 * @return New session on success or NULL on error.736 *737 */738 async_sess_t *async_connect_me_to(exch_mgmt_t mgmt, async_exch_t *exch,739 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)740 {741 if (exch == NULL) {742 errno = ENOENT;743 return NULL;744 }745 746 async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));747 if (sess == NULL) {748 errno = ENOMEM;749 return NULL;750 }751 752 cap_phone_handle_t phone;753 errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,754 0, &phone);755 if (rc != EOK) {756 errno = rc;757 free(sess);758 return NULL;759 }760 761 sess->iface = 0;762 sess->mgmt = mgmt;763 sess->phone = phone;764 sess->arg1 = arg1;765 sess->arg2 = arg2;766 sess->arg3 = arg3;767 768 fibril_mutex_initialize(&sess->remote_state_mtx);769 sess->remote_state_data = NULL;770 771 list_initialize(&sess->exch_list);772 fibril_mutex_initialize(&sess->mutex);773 atomic_set(&sess->refcnt, 0);774 775 return sess;776 723 } 777 724 … … 789 736 * 790 737 */ 791 async_sess_t *async_connect_me_to _iface(async_exch_t *exch, iface_t iface,738 async_sess_t *async_connect_me_to(async_exch_t *exch, iface_t iface, 792 739 sysarg_t arg2, sysarg_t arg3) 793 740 { … … 838 785 * tagging. 839 786 */ 840 void async_sess_args_set(async_sess_t *sess, sysarg_t arg1, sysarg_t arg2,787 void async_sess_args_set(async_sess_t *sess, iface_t iface, sysarg_t arg2, 841 788 sysarg_t arg3) 842 789 { 843 sess->arg1 = arg1;790 sess->arg1 = iface; 844 791 sess->arg2 = arg2; 845 792 sess->arg3 = arg3; 846 }847 848 /** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.849 *850 * Ask through phone for a new connection to some service and block until851 * success.852 *853 * @param mgmt Exchange management style.854 * @param exch Exchange for sending the message.855 * @param arg1 User defined argument.856 * @param arg2 User defined argument.857 * @param arg3 User defined argument.858 *859 * @return New session on success or NULL on error.860 *861 */862 async_sess_t *async_connect_me_to_blocking(exch_mgmt_t mgmt, async_exch_t *exch,863 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)864 {865 if (exch == NULL) {866 errno = ENOENT;867 return NULL;868 }869 870 async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));871 if (sess == NULL) {872 errno = ENOMEM;873 return NULL;874 }875 876 cap_phone_handle_t phone;877 errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,878 IPC_FLAG_BLOCKING, &phone);879 880 if (rc != EOK) {881 errno = rc;882 free(sess);883 return NULL;884 }885 886 sess->iface = 0;887 sess->mgmt = mgmt;888 sess->phone = phone;889 sess->arg1 = arg1;890 sess->arg2 = arg2;891 sess->arg3 = arg3;892 893 fibril_mutex_initialize(&sess->remote_state_mtx);894 sess->remote_state_data = NULL;895 896 list_initialize(&sess->exch_list);897 fibril_mutex_initialize(&sess->mutex);898 atomic_set(&sess->refcnt, 0);899 900 return sess;901 793 } 902 794 … … 914 806 * 915 807 */ 916 async_sess_t *async_connect_me_to_blocking _iface(async_exch_t *exch, iface_t iface,808 async_sess_t *async_connect_me_to_blocking(async_exch_t *exch, iface_t iface, 917 809 sysarg_t arg2, sysarg_t arg3) 918 810 { -
uspace/lib/c/generic/ns.c
rd4475a44 r914c693 81 81 82 82 async_sess_t *csess = 83 async_connect_me_to _iface(exch, iface, service, arg3);83 async_connect_me_to(exch, iface, service, arg3); 84 84 async_exchange_end(exch); 85 85 … … 106 106 async_exch_t *exch = async_exchange_begin(sess); 107 107 async_sess_t *csess = 108 async_connect_me_to_blocking _iface(exch, iface, service, arg3);108 async_connect_me_to_blocking(exch, iface, service, arg3); 109 109 async_exchange_end(exch); 110 110 … … 156 156 if (sess_ns == NULL) { 157 157 exch = async_exchange_begin(&session_ns); 158 sess_ns = async_connect_me_to _iface(exch, 0, 0, 0);158 sess_ns = async_connect_me_to(exch, 0, 0, 0); 159 159 async_exchange_end(exch); 160 160 if (sess_ns == NULL) -
uspace/lib/c/generic/private/async.h
rd4475a44 r914c693 96 96 97 97 /** First clone connection argument */ 98 sysarg_t arg1;98 iface_t arg1; 99 99 100 100 /** Second clone connection argument */ -
uspace/lib/c/include/async.h
rd4475a44 r914c693 339 339 sysarg_t *, sysarg_t *); 340 340 341 extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t, 342 sysarg_t, sysarg_t); 343 extern async_sess_t *async_connect_me_to_iface(async_exch_t *, iface_t, 344 sysarg_t, sysarg_t); 345 extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *, 346 sysarg_t, sysarg_t, sysarg_t); 347 extern async_sess_t *async_connect_me_to_blocking_iface(async_exch_t *, iface_t, 341 extern async_sess_t *async_connect_me_to(async_exch_t *, iface_t, sysarg_t, 342 sysarg_t); 343 extern async_sess_t *async_connect_me_to_blocking(async_exch_t *, iface_t, 348 344 sysarg_t, sysarg_t); 349 345 extern async_sess_t *async_connect_kbox(task_id_t); … … 361 357 * management. Proper solution needs to be implemented. 362 358 */ 363 void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);359 void async_sess_args_set(async_sess_t *sess, iface_t, sysarg_t, sysarg_t); 364 360 365 361 /*
Note:
See TracChangeset
for help on using the changeset viewer.