Changes in uspace/lib/net/netif/netif_local.c [0ab68f6:42a9f27] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/netif/netif_local.c
r0ab68f6 r42a9f27 43 43 #include <ipc/services.h> 44 44 #include <ipc/netif.h> 45 #include <err no.h>45 #include <err.h> 46 46 47 47 #include <generic.h> … … 113 113 int netif_start_req_local(int netif_phone, device_id_t device_id) 114 114 { 115 int rc;115 ERROR_DECLARE; 116 116 117 117 fibril_rwlock_write_lock(&netif_globals.lock); 118 118 119 119 netif_device_t *device; 120 rc = find_device(device_id, &device); 121 if (rc != EOK) { 120 if (ERROR_OCCURRED(find_device(device_id, &device))) { 122 121 fibril_rwlock_write_unlock(&netif_globals.lock); 123 return rc;122 return ERROR_CODE; 124 123 } 125 124 … … 149 148 int netif_stop_req_local(int netif_phone, device_id_t device_id) 150 149 { 151 int rc;150 ERROR_DECLARE; 152 151 153 152 fibril_rwlock_write_lock(&netif_globals.lock); 154 153 155 154 netif_device_t *device; 156 rc = find_device(device_id, &device); 157 if (rc != EOK) { 155 if (ERROR_OCCURRED(find_device(device_id, &device))) { 158 156 fibril_rwlock_write_unlock(&netif_globals.lock); 159 return rc;157 return ERROR_CODE; 160 158 } 161 159 … … 205 203 measured_string_ref *address, char **data) 206 204 { 207 int rc;205 ERROR_DECLARE; 208 206 209 207 if (!address || !data) … … 213 211 214 212 measured_string_t translation; 215 rc = netif_get_addr_message(device_id, &translation); 216 if (rc == EOK) { 213 if (!ERROR_OCCURRED(netif_get_addr_message(device_id, &translation))) { 217 214 *address = measured_string_copy(&translation); 218 rc= (*address) ? EOK : ENOMEM;215 ERROR_CODE = (*address) ? EOK : ENOMEM; 219 216 } 220 217 … … 223 220 *data = (**address).value; 224 221 225 return rc;222 return ERROR_CODE; 226 223 } 227 224 … … 267 264 int netif_init_module(async_client_conn_t client_connection) 268 265 { 269 int rc;266 ERROR_DECLARE; 270 267 271 268 async_set_client_connection(client_connection); … … 274 271 netif_device_map_initialize(&netif_globals.device_map); 275 272 276 rc = pm_init(); 277 if (rc != EOK) 278 return rc; 273 ERROR_PROPAGATE(pm_init()); 279 274 280 275 fibril_rwlock_initialize(&netif_globals.lock); 281 282 rc = netif_initialize(); 283 if (rc != EOK) { 276 if (ERROR_OCCURRED(netif_initialize())) { 284 277 pm_destroy(); 285 return rc;278 return ERROR_CODE; 286 279 } 287 280 … … 324 317 static int register_message(const char *name, device_id_t device_id, int phone) 325 318 { 319 ERROR_DECLARE; 320 326 321 netif_device_t *device; 327 int rc; 328 329 rc = find_device(device_id, &device); 330 if (rc != EOK) 331 return rc; 332 333 if (device->nil_phone > 0) 322 ERROR_PROPAGATE(find_device(device_id, &device)); 323 if(device->nil_phone > 0) 334 324 return ELIMIT; 335 325 … … 359 349 ipc_call_t *call, ipc_call_t *answer, int *answer_count) 360 350 { 351 ERROR_DECLARE; 352 361 353 size_t length; 362 354 device_stats_t stats; 363 355 packet_t packet; 364 356 measured_string_t address; 365 int rc;366 357 367 358 *answer_count = 0; … … 376 367 case IPC_M_CONNECT_TO_ME: 377 368 fibril_rwlock_write_lock(&netif_globals.lock); 378 rc= register_message(name, IPC_GET_DEVICE(call),369 ERROR_CODE = register_message(name, IPC_GET_DEVICE(call), 379 370 IPC_GET_PHONE(call)); 380 371 fibril_rwlock_write_unlock(&netif_globals.lock); 381 return rc;372 return ERROR_CODE; 382 373 383 374 case NET_NETIF_SEND: 384 rc = packet_translate_remote(netif_globals.net_phone, &packet, 385 IPC_GET_PACKET(call)); 386 if (rc != EOK) 387 return rc; 375 ERROR_PROPAGATE(packet_translate_remote(netif_globals.net_phone, 376 &packet, IPC_GET_PACKET(call))); 388 377 return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet, 389 378 IPC_GET_SENDER(call)); 390 379 391 380 case NET_NETIF_START: 392 381 return netif_start_req_local(0, IPC_GET_DEVICE(call)); … … 395 384 fibril_rwlock_read_lock(&netif_globals.lock); 396 385 397 rc = async_data_read_receive(&callid, &length); 398 if (rc != EOK) { 386 if (ERROR_OCCURRED(async_data_read_receive(&callid, &length))) { 399 387 fibril_rwlock_read_unlock(&netif_globals.lock); 400 return rc;388 return ERROR_CODE; 401 389 } 402 390 if (length < sizeof(device_stats_t)) { … … 405 393 } 406 394 407 rc = netif_get_device_stats(IPC_GET_DEVICE(call), &stats);408 if (rc == EOK) {409 rc= async_data_read_finalize(callid, &stats,395 if (ERROR_NONE(netif_get_device_stats(IPC_GET_DEVICE(call), 396 &stats))) { 397 ERROR_CODE = async_data_read_finalize(callid, &stats, 410 398 sizeof(device_stats_t)); 411 399 } 412 400 413 401 fibril_rwlock_read_unlock(&netif_globals.lock); 414 return rc;402 return ERROR_CODE; 415 403 416 404 case NET_NETIF_STOP: … … 419 407 case NET_NETIF_GET_ADDR: 420 408 fibril_rwlock_read_lock(&netif_globals.lock); 421 rc = netif_get_addr_message(IPC_GET_DEVICE(call), &address);422 if (rc == EOK)423 rc= measured_strings_reply(&address, 1);409 if (ERROR_NONE(netif_get_addr_message(IPC_GET_DEVICE(call), 410 &address))) 411 ERROR_CODE = measured_strings_reply(&address, 1); 424 412 fibril_rwlock_read_unlock(&netif_globals.lock); 425 return rc;413 return ERROR_CODE; 426 414 } 427 415 … … 443 431 int netif_module_start_standalone(async_client_conn_t client_connection) 444 432 { 445 int rc; 446 447 rc = netif_init_module(client_connection); 448 if (rc != EOK) 449 return rc; 433 ERROR_DECLARE; 434 435 ERROR_PROPAGATE(netif_init_module(client_connection)); 450 436 451 437 async_manager();
Note:
See TracChangeset
for help on using the changeset viewer.