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