Changes in uspace/srv/net/nil/nildummy/nildummy.c [093c0a1:3cd95ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/nil/nildummy/nildummy.c
r093c0a1 r3cd95ef 41 41 #include <stdio.h> 42 42 #include <str.h> 43 #include <err.h> 43 44 #include <ipc/ipc.h> 44 45 #include <ipc/net.h> … … 81 82 int nil_initialize(int net_phone) 82 83 { 83 int rc;84 ERROR_DECLARE; 84 85 85 86 fibril_rwlock_initialize(&nildummy_globals.devices_lock); … … 90 91 nildummy_globals.net_phone = net_phone; 91 92 nildummy_globals.proto.phone = 0; 92 rc= nildummy_devices_initialize(&nildummy_globals.devices);93 ERROR_CODE = nildummy_devices_initialize(&nildummy_globals.devices); 93 94 94 95 fibril_rwlock_write_unlock(&nildummy_globals.protos_lock); 95 96 fibril_rwlock_write_unlock(&nildummy_globals.devices_lock); 96 97 97 return rc;98 return ERROR_CODE; 98 99 } 99 100 … … 106 107 static void nildummy_receiver(ipc_callid_t iid, ipc_call_t *icall) 107 108 { 109 ERROR_DECLARE; 110 108 111 packet_t packet; 109 int rc;110 112 111 113 while (true) { 112 114 switch (IPC_GET_METHOD(*icall)) { 113 115 case NET_NIL_DEVICE_STATE: 114 rc= nil_device_state_msg_local(0,116 ERROR_CODE = nil_device_state_msg_local(0, 115 117 IPC_GET_DEVICE(icall), IPC_GET_STATE(icall)); 116 ipc_answer_0(iid, (ipcarg_t) rc);118 ipc_answer_0(iid, (ipcarg_t) ERROR_CODE); 117 119 break; 118 120 119 121 case NET_NIL_RECEIVED: 120 rc = packet_translate_remote(nildummy_globals.net_phone,121 &packet, IPC_GET_PACKET(icall));122 if (rc == EOK) {123 rc= nil_received_msg_local(0,122 if (ERROR_NONE(packet_translate_remote( 123 nildummy_globals.net_phone, &packet, 124 IPC_GET_PACKET(icall)))) { 125 ERROR_CODE = nil_received_msg_local(0, 124 126 IPC_GET_DEVICE(icall), packet, 0); 125 127 } 126 ipc_answer_0(iid, (ipcarg_t) rc);128 ipc_answer_0(iid, (ipcarg_t) ERROR_CODE); 127 129 break; 128 130 … … 153 155 nildummy_device_message(device_id_t device_id, services_t service, size_t mtu) 154 156 { 157 ERROR_DECLARE; 158 155 159 nildummy_device_ref device; 156 160 int index; 157 int rc;158 161 159 162 fibril_rwlock_write_lock(&nildummy_globals.devices_lock); … … 213 216 214 217 // get hardware address 215 rc = netif_get_addr_req(device->phone, device->device_id, &device->addr, 216 &device->addr_data); 217 if (rc != EOK) { 218 if (ERROR_OCCURRED(netif_get_addr_req(device->phone, device->device_id, 219 &device->addr, &device->addr_data))) { 218 220 fibril_rwlock_write_unlock(&nildummy_globals.devices_lock); 219 221 free(device); 220 return rc;222 return ERROR_CODE; 221 223 } 222 224 … … 378 380 ipc_call_t *answer, int *answer_count) 379 381 { 382 ERROR_DECLARE; 383 380 384 measured_string_ref address; 381 385 packet_t packet; … … 384 388 size_t suffix; 385 389 size_t content; 386 int rc;387 390 388 391 *answer_count = 0; … … 396 399 397 400 case NET_NIL_SEND: 398 rc = packet_translate_remote(nildummy_globals.net_phone, 399 &packet, IPC_GET_PACKET(call)); 400 if (rc != EOK) 401 return rc; 401 ERROR_PROPAGATE(packet_translate_remote( 402 nildummy_globals.net_phone, &packet, IPC_GET_PACKET(call))); 402 403 return nildummy_send_message(IPC_GET_DEVICE(call), packet, 403 404 IPC_GET_SERVICE(call)); 404 405 405 406 case NET_NIL_PACKET_SPACE: 406 rc = nildummy_packet_space_message(IPC_GET_DEVICE(call), 407 &addrlen, &prefix, &content, &suffix); 408 if (rc != EOK) 409 return rc; 407 ERROR_PROPAGATE(nildummy_packet_space_message( 408 IPC_GET_DEVICE(call), &addrlen, &prefix, &content, 409 &suffix)); 410 410 IPC_SET_ADDR(answer, addrlen); 411 411 IPC_SET_PREFIX(answer, prefix); … … 416 416 417 417 case NET_NIL_ADDR: 418 rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address); 419 if (rc != EOK) 420 return rc; 418 ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call), 419 &address)); 421 420 return measured_strings_reply(address, 1); 422 421 423 422 case NET_NIL_BROADCAST_ADDR: 424 rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address); 425 if (rc != EOK) 426 return rc; 423 ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call), 424 &address)); 427 425 return measured_strings_reply(address, 1); 428 426 … … 478 476 int main(int argc, char *argv[]) 479 477 { 480 int rc;478 ERROR_DECLARE; 481 479 482 480 /* Start the module */ 483 rc = nil_module_start_standalone(nil_client_connection);484 return rc;481 ERROR_PROPAGATE(nil_module_start_standalone(nil_client_connection)); 482 return EOK; 485 483 } 486 484
Note:
See TracChangeset
for help on using the changeset viewer.