Changes in uspace/lib/c/generic/inetcfg.c [b7fd2a0:cde999a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inetcfg.c
rb7fd2a0 rcde999a 39 39 static async_sess_t *inetcfg_sess = NULL; 40 40 41 static errno_t inetcfg_get_ids_once(sysarg_t method, sysarg_t arg1,41 static int inetcfg_get_ids_once(sysarg_t method, sysarg_t arg1, 42 42 sysarg_t *id_buf, size_t buf_size, size_t *act_size) 43 43 { … … 46 46 ipc_call_t answer; 47 47 aid_t req = async_send_1(exch, method, arg1, &answer); 48 errno_t rc = async_data_read_start(exch, id_buf, buf_size);49 50 async_exchange_end(exch); 51 52 if (rc != EOK) { 53 async_forget(req); 54 return rc; 55 } 56 57 errno_t retval;48 int rc = async_data_read_start(exch, id_buf, buf_size); 49 50 async_exchange_end(exch); 51 52 if (rc != EOK) { 53 async_forget(req); 54 return rc; 55 } 56 57 int retval; 58 58 async_wait_for(req, &retval); 59 59 … … 76 76 * @return EOK on success or an error code 77 77 */ 78 static errno_t inetcfg_get_ids_internal(sysarg_t method, sysarg_t arg1,78 static int inetcfg_get_ids_internal(sysarg_t method, sysarg_t arg1, 79 79 sysarg_t **data, size_t *count) 80 80 { … … 83 83 84 84 size_t act_size = 0; 85 errno_t rc = inetcfg_get_ids_once(method, arg1, NULL, 0,85 int rc = inetcfg_get_ids_once(method, arg1, NULL, 0, 86 86 &act_size); 87 87 if (rc != EOK) … … 113 113 } 114 114 115 errno_t inetcfg_init(void)115 int inetcfg_init(void) 116 116 { 117 117 service_id_t inet_svc; 118 errno_t rc;118 int rc; 119 119 120 120 assert(inetcfg_sess == NULL); … … 133 133 } 134 134 135 errno_t inetcfg_addr_create_static(const char *name, inet_naddr_t *naddr,135 int inetcfg_addr_create_static(const char *name, inet_naddr_t *naddr, 136 136 sysarg_t link_id, sysarg_t *addr_id) 137 137 { … … 142 142 &answer); 143 143 144 errno_t rc = async_data_write_start(exch, naddr, sizeof(inet_naddr_t));144 int rc = async_data_write_start(exch, naddr, sizeof(inet_naddr_t)); 145 145 if (rc != EOK) { 146 146 async_exchange_end(exch); … … 158 158 } 159 159 160 errno_t retval;160 int retval; 161 161 async_wait_for(req, &retval); 162 162 … … 166 166 } 167 167 168 errno_t inetcfg_addr_delete(sysarg_t addr_id)169 { 170 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 171 172 errno_t rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);168 int inetcfg_addr_delete(sysarg_t addr_id) 169 { 170 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 171 172 int rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id); 173 173 async_exchange_end(exch); 174 174 … … 176 176 } 177 177 178 errno_t inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)178 int inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo) 179 179 { 180 180 async_exch_t *exch = async_exchange_begin(inetcfg_sess); … … 187 187 sizeof(inet_naddr_t), &answer_naddr); 188 188 189 errno_t retval_naddr;189 int retval_naddr; 190 190 async_wait_for(req_naddr, &retval_naddr); 191 191 … … 203 203 async_exchange_end(exch); 204 204 205 errno_t retval_name;205 int retval_name; 206 206 async_wait_for(req_name, &retval_name); 207 207 … … 211 211 } 212 212 213 errno_t retval;213 int retval; 214 214 async_wait_for(req, &retval); 215 215 … … 228 228 } 229 229 230 errno_t inetcfg_addr_get_id(const char *name, sysarg_t link_id, sysarg_t *addr_id)230 int inetcfg_addr_get_id(const char *name, sysarg_t link_id, sysarg_t *addr_id) 231 231 { 232 232 async_exch_t *exch = async_exchange_begin(inetcfg_sess); … … 234 234 ipc_call_t answer; 235 235 aid_t req = async_send_1(exch, INETCFG_ADDR_GET_ID, link_id, &answer); 236 errno_t retval = async_data_write_start(exch, name, str_size(name));236 int retval = async_data_write_start(exch, name, str_size(name)); 237 237 238 238 async_exchange_end(exch); … … 249 249 } 250 250 251 errno_t inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)251 int inetcfg_get_addr_list(sysarg_t **addrs, size_t *count) 252 252 { 253 253 return inetcfg_get_ids_internal(INETCFG_GET_ADDR_LIST, … … 255 255 } 256 256 257 errno_t inetcfg_get_link_list(sysarg_t **links, size_t *count)257 int inetcfg_get_link_list(sysarg_t **links, size_t *count) 258 258 { 259 259 return inetcfg_get_ids_internal(INETCFG_GET_LINK_LIST, … … 261 261 } 262 262 263 errno_t inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)263 int inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count) 264 264 { 265 265 return inetcfg_get_ids_internal(INETCFG_GET_SROUTE_LIST, … … 267 267 } 268 268 269 errno_t inetcfg_link_add(sysarg_t link_id)270 { 271 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 272 273 errno_t rc = async_req_1_0(exch, INETCFG_LINK_ADD, link_id);269 int inetcfg_link_add(sysarg_t link_id) 270 { 271 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 272 273 int rc = async_req_1_0(exch, INETCFG_LINK_ADD, link_id); 274 274 async_exchange_end(exch); 275 275 … … 277 277 } 278 278 279 errno_t inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)279 int inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo) 280 280 { 281 281 ipc_call_t dreply; 282 errno_t dretval;282 int dretval; 283 283 size_t act_size; 284 284 char name_buf[LOC_NAME_MAXLEN + 1]; … … 289 289 aid_t req = async_send_1(exch, INETCFG_LINK_GET, link_id, &answer); 290 290 aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply); 291 errno_t rc = async_data_read_start(exch, &linfo->mac_addr, sizeof(addr48_t));291 int rc = async_data_read_start(exch, &linfo->mac_addr, sizeof(addr48_t)); 292 292 async_wait_for(dreq, &dretval); 293 293 … … 299 299 } 300 300 301 errno_t retval;301 int retval; 302 302 async_wait_for(req, &retval); 303 303 … … 315 315 } 316 316 317 errno_t inetcfg_link_remove(sysarg_t link_id)318 { 319 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 320 321 errno_t rc = async_req_1_0(exch, INETCFG_LINK_REMOVE, link_id);317 int inetcfg_link_remove(sysarg_t link_id) 318 { 319 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 320 321 int rc = async_req_1_0(exch, INETCFG_LINK_REMOVE, link_id); 322 322 async_exchange_end(exch); 323 323 … … 325 325 } 326 326 327 errno_t inetcfg_sroute_create(const char *name, inet_naddr_t *dest,327 int inetcfg_sroute_create(const char *name, inet_naddr_t *dest, 328 328 inet_addr_t *router, sysarg_t *sroute_id) 329 329 { … … 333 333 aid_t req = async_send_0(exch, INETCFG_SROUTE_CREATE, &answer); 334 334 335 errno_t rc = async_data_write_start(exch, dest, sizeof(inet_naddr_t));335 int rc = async_data_write_start(exch, dest, sizeof(inet_naddr_t)); 336 336 if (rc != EOK) { 337 337 async_exchange_end(exch); … … 356 356 } 357 357 358 errno_t retval;358 int retval; 359 359 async_wait_for(req, &retval); 360 360 … … 364 364 } 365 365 366 errno_t inetcfg_sroute_delete(sysarg_t sroute_id)367 { 368 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 369 370 errno_t rc = async_req_1_0(exch, INETCFG_SROUTE_DELETE, sroute_id);366 int inetcfg_sroute_delete(sysarg_t sroute_id) 367 { 368 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 369 370 int rc = async_req_1_0(exch, INETCFG_SROUTE_DELETE, sroute_id); 371 371 async_exchange_end(exch); 372 372 … … 374 374 } 375 375 376 errno_t inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)376 int inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo) 377 377 { 378 378 async_exch_t *exch = async_exchange_begin(inetcfg_sess); … … 385 385 sizeof(inet_naddr_t), &answer_dest); 386 386 387 errno_t retval_dest;387 int retval_dest; 388 388 async_wait_for(req_dest, &retval_dest); 389 389 … … 398 398 sizeof(inet_addr_t), &answer_router); 399 399 400 errno_t retval_router;400 int retval_router; 401 401 async_wait_for(req_router, &retval_router); 402 402 … … 414 414 async_exchange_end(exch); 415 415 416 errno_t retval_name;416 int retval_name; 417 417 async_wait_for(req_name, &retval_name); 418 418 … … 422 422 } 423 423 424 errno_t retval;424 int retval; 425 425 async_wait_for(req, &retval); 426 426 … … 438 438 } 439 439 440 errno_t inetcfg_sroute_get_id(const char *name, sysarg_t *sroute_id)440 int inetcfg_sroute_get_id(const char *name, sysarg_t *sroute_id) 441 441 { 442 442 async_exch_t *exch = async_exchange_begin(inetcfg_sess); … … 444 444 ipc_call_t answer; 445 445 aid_t req = async_send_0(exch, INETCFG_SROUTE_GET_ID, &answer); 446 errno_t retval = async_data_write_start(exch, name, str_size(name));446 int retval = async_data_write_start(exch, name, str_size(name)); 447 447 448 448 async_exchange_end(exch);
Note:
See TracChangeset
for help on using the changeset viewer.