Changeset 3e66428 in mainline for uspace/lib/c/generic/dnsr.c
- Timestamp:
- 2013-06-20T14:10:51Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 19a4f73
- Parents:
- b49d872
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/dnsr.c
rb49d872 r3e66428 44 44 static async_exch_t *dnsr_exchange_begin(void) 45 45 { 46 async_sess_t *sess;47 service_id_t dnsr_svc;48 49 46 fibril_mutex_lock(&dnsr_sess_mutex); 50 47 51 48 if (dnsr_sess == NULL) { 49 service_id_t dnsr_svc; 50 52 51 (void) loc_service_get_id(SERVICE_NAME_DNSR, &dnsr_svc, 53 52 IPC_FLAG_BLOCKING); 54 53 55 54 dnsr_sess = loc_service_connect(EXCHANGE_SERIALIZE, dnsr_svc, 56 55 IPC_FLAG_BLOCKING); 57 56 } 58 59 sess = dnsr_sess;57 58 async_sess_t *sess = dnsr_sess; 60 59 fibril_mutex_unlock(&dnsr_sess_mutex); 61 60 62 61 return async_exchange_begin(sess); 63 62 } … … 109 108 110 109 info->cname = str_dup(cname_buf); 111 in fo->addr.ipv4 = IPC_GET_ARG1(answer);110 inet2_addr_unpack(IPC_GET_ARG1(answer), &info->addr); 112 111 113 112 *rinfo = info; … … 119 118 if (info == NULL) 120 119 return; 121 120 122 121 free(info->cname); 123 122 free(info); 124 123 } 125 124 126 int dnsr_get_srvaddr(inet _addr_t *srvaddr)125 int dnsr_get_srvaddr(inet2_addr_t *srvaddr) 127 126 { 128 sysarg_t addr;129 127 async_exch_t *exch = dnsr_exchange_begin(); 130 131 int rc = async_req_0_1(exch, DNSR_GET_SRVADDR, &addr); 132 dnsr_exchange_end(exch); 133 134 if (rc != EOK) 128 129 ipc_call_t answer; 130 aid_t req = async_send_0(exch, DNSR_GET_SRVADDR, &answer); 131 int rc = async_data_read_start(exch, srvaddr, sizeof(inet2_addr_t)); 132 133 loc_exchange_end(exch); 134 135 if (rc != EOK) { 136 async_forget(req); 135 137 return rc; 136 137 srvaddr->ipv4 = addr; 138 return EOK; 138 } 139 140 sysarg_t retval; 141 async_wait_for(req, &retval); 142 143 return (int) retval; 139 144 } 140 145 141 int dnsr_set_srvaddr(inet _addr_t *srvaddr)146 int dnsr_set_srvaddr(inet2_addr_t *srvaddr) 142 147 { 143 148 async_exch_t *exch = dnsr_exchange_begin(); 144 145 int rc = async_req_1_0(exch, DNSR_SET_SRVADDR, srvaddr->ipv4); 146 dnsr_exchange_end(exch); 147 148 if (rc != EOK) 149 150 ipc_call_t answer; 151 aid_t req = async_send_0(exch, DNSR_SET_SRVADDR, &answer); 152 int rc = async_data_write_start(exch, srvaddr, sizeof(inet2_addr_t)); 153 154 loc_exchange_end(exch); 155 156 if (rc != EOK) { 157 async_forget(req); 149 158 return rc; 150 151 return EOK; 159 } 160 161 sysarg_t retval; 162 async_wait_for(req, &retval); 163 164 return (int) retval; 152 165 } 153 166
Note:
See TracChangeset
for help on using the changeset viewer.