Ignore:
Timestamp:
2010-11-06T00:19:13Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1712f87
Parents:
0485135 (diff), 0578271 (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.
Message:

Merge from lp:~jakub/helenos/net.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/nil/nildummy/nildummy.c

    r0485135 r0b81cad0  
    4141#include <stdio.h>
    4242#include <str.h>
    43 #include <err.h>
    4443#include <ipc/ipc.h>
    4544#include <ipc/net.h>
     
    8281int nil_initialize(int net_phone)
    8382{
    84         ERROR_DECLARE;
     83        int rc;
    8584       
    8685        fibril_rwlock_initialize(&nildummy_globals.devices_lock);
     
    9190        nildummy_globals.net_phone = net_phone;
    9291        nildummy_globals.proto.phone = 0;
    93         ERROR_CODE = nildummy_devices_initialize(&nildummy_globals.devices);
     92        rc = nildummy_devices_initialize(&nildummy_globals.devices);
    9493       
    9594        fibril_rwlock_write_unlock(&nildummy_globals.protos_lock);
    9695        fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
    9796       
    98         return ERROR_CODE;
     97        return rc;
    9998}
    10099
     
    107106static void nildummy_receiver(ipc_callid_t iid, ipc_call_t *icall)
    108107{
    109         ERROR_DECLARE;
    110 
    111108        packet_t packet;
     109        int rc;
    112110
    113111        while (true) {
    114112                switch (IPC_GET_METHOD(*icall)) {
    115113                case NET_NIL_DEVICE_STATE:
    116                         ERROR_CODE = nil_device_state_msg_local(0,
     114                        rc = nil_device_state_msg_local(0,
    117115                            IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
    118                         ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
     116                        ipc_answer_0(iid, (ipcarg_t) rc);
    119117                        break;
    120118               
    121119                case NET_NIL_RECEIVED:
    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,
     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,
    126124                                    IPC_GET_DEVICE(icall), packet, 0);
    127125                        }
    128                         ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
     126                        ipc_answer_0(iid, (ipcarg_t) rc);
    129127                        break;
    130128               
     
    155153nildummy_device_message(device_id_t device_id, services_t service, size_t mtu)
    156154{
    157         ERROR_DECLARE;
    158 
    159155        nildummy_device_ref device;
    160156        int index;
     157        int rc;
    161158
    162159        fibril_rwlock_write_lock(&nildummy_globals.devices_lock);
     
    216213       
    217214        // get hardware address
    218         if (ERROR_OCCURRED(netif_get_addr_req(device->phone, device->device_id,
    219             &device->addr, &device->addr_data))) {
     215        rc = netif_get_addr_req(device->phone, device->device_id, &device->addr,
     216            &device->addr_data);
     217        if (rc != EOK) {
    220218                fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
    221219                free(device);
    222                 return ERROR_CODE;
     220                return rc;
    223221        }
    224222       
     
    380378    ipc_call_t *answer, int *answer_count)
    381379{
    382         ERROR_DECLARE;
    383        
    384380        measured_string_ref address;
    385381        packet_t packet;
     
    388384        size_t suffix;
    389385        size_t content;
     386        int rc;
    390387       
    391388        *answer_count = 0;
     
    399396       
    400397        case NET_NIL_SEND:
    401                 ERROR_PROPAGATE(packet_translate_remote(
    402                     nildummy_globals.net_phone, &packet, IPC_GET_PACKET(call)));
     398                rc = packet_translate_remote(nildummy_globals.net_phone,
     399                    &packet, IPC_GET_PACKET(call));
     400                if (rc != EOK)
     401                        return rc;
    403402                return nildummy_send_message(IPC_GET_DEVICE(call), packet,
    404403                    IPC_GET_SERVICE(call));
    405404       
    406405        case NET_NIL_PACKET_SPACE:
    407                 ERROR_PROPAGATE(nildummy_packet_space_message(
    408                     IPC_GET_DEVICE(call), &addrlen, &prefix, &content,
    409                     &suffix));
     406                rc = nildummy_packet_space_message(IPC_GET_DEVICE(call),
     407                    &addrlen, &prefix, &content, &suffix);
     408                if (rc != EOK)
     409                        return rc;
    410410                IPC_SET_ADDR(answer, addrlen);
    411411                IPC_SET_PREFIX(answer, prefix);
     
    416416       
    417417        case NET_NIL_ADDR:
    418                 ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call),
    419                     &address));
     418                rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address);
     419                if (rc != EOK)
     420                        return rc;
    420421                return measured_strings_reply(address, 1);
    421422       
    422423        case NET_NIL_BROADCAST_ADDR:
    423                 ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call),
    424                     &address));
     424                rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address);
     425                if (rc != EOK)
     426                        return rc;
    425427                return measured_strings_reply(address, 1);
    426428       
     
    476478int main(int argc, char *argv[])
    477479{
    478         ERROR_DECLARE;
     480        int rc;
    479481       
    480482        /* Start the module */
    481         ERROR_PROPAGATE(nil_module_start_standalone(nil_client_connection));
    482         return EOK;
     483        rc = nil_module_start_standalone(nil_client_connection);
     484        return rc;
    483485}
    484486
Note: See TracChangeset for help on using the changeset viewer.