Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/netif/netif_local.c

    r0ab68f6 r42a9f27  
    4343#include <ipc/services.h>
    4444#include <ipc/netif.h>
    45 #include <errno.h>
     45#include <err.h>
    4646
    4747#include <generic.h>
     
    113113int netif_start_req_local(int netif_phone, device_id_t device_id)
    114114{
    115         int rc;
     115        ERROR_DECLARE;
    116116       
    117117        fibril_rwlock_write_lock(&netif_globals.lock);
    118118       
    119119        netif_device_t *device;
    120         rc = find_device(device_id, &device);
    121         if (rc != EOK) {
     120        if (ERROR_OCCURRED(find_device(device_id, &device))) {
    122121                fibril_rwlock_write_unlock(&netif_globals.lock);
    123                 return rc;
     122                return ERROR_CODE;
    124123        }
    125124       
     
    149148int netif_stop_req_local(int netif_phone, device_id_t device_id)
    150149{
    151         int rc;
     150        ERROR_DECLARE;
    152151       
    153152        fibril_rwlock_write_lock(&netif_globals.lock);
    154153       
    155154        netif_device_t *device;
    156         rc = find_device(device_id, &device);
    157         if (rc != EOK) {
     155        if (ERROR_OCCURRED(find_device(device_id, &device))) {
    158156                fibril_rwlock_write_unlock(&netif_globals.lock);
    159                 return rc;
     157                return ERROR_CODE;
    160158        }
    161159       
     
    205203    measured_string_ref *address, char **data)
    206204{
    207         int rc;
     205        ERROR_DECLARE;
    208206       
    209207        if (!address || !data)
     
    213211       
    214212        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))) {
    217214                *address = measured_string_copy(&translation);
    218                 rc = (*address) ? EOK : ENOMEM;
     215                ERROR_CODE = (*address) ? EOK : ENOMEM;
    219216        }
    220217       
     
    223220        *data = (**address).value;
    224221       
    225         return rc;
     222        return ERROR_CODE;
    226223}
    227224
     
    267264int netif_init_module(async_client_conn_t client_connection)
    268265{
    269         int rc;
     266        ERROR_DECLARE;
    270267       
    271268        async_set_client_connection(client_connection);
     
    274271        netif_device_map_initialize(&netif_globals.device_map);
    275272       
    276         rc = pm_init();
    277         if (rc != EOK)
    278                 return rc;
     273        ERROR_PROPAGATE(pm_init());
    279274       
    280275        fibril_rwlock_initialize(&netif_globals.lock);
    281        
    282         rc = netif_initialize();
    283         if (rc != EOK) {
     276        if (ERROR_OCCURRED(netif_initialize())) {
    284277                pm_destroy();
    285                 return rc;
     278                return ERROR_CODE;
    286279        }
    287280       
     
    324317static int register_message(const char *name, device_id_t device_id, int phone)
    325318{
     319        ERROR_DECLARE;
     320       
    326321        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)
    334324                return ELIMIT;
    335325       
     
    359349    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
    360350{
     351        ERROR_DECLARE;
     352       
    361353        size_t length;
    362354        device_stats_t stats;
    363355        packet_t packet;
    364356        measured_string_t address;
    365         int rc;
    366357       
    367358        *answer_count = 0;
     
    376367        case IPC_M_CONNECT_TO_ME:
    377368                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),
    379370                    IPC_GET_PHONE(call));
    380371                fibril_rwlock_write_unlock(&netif_globals.lock);
    381                 return rc;
     372                return ERROR_CODE;
    382373               
    383374        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)));
    388377                return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet,
    389378                    IPC_GET_SENDER(call));
    390                
     379                   
    391380        case NET_NETIF_START:
    392381                return netif_start_req_local(0, IPC_GET_DEVICE(call));
     
    395384                fibril_rwlock_read_lock(&netif_globals.lock);
    396385
    397                 rc = async_data_read_receive(&callid, &length);
    398                 if (rc != EOK) {
     386                if (ERROR_OCCURRED(async_data_read_receive(&callid, &length))) {
    399387                        fibril_rwlock_read_unlock(&netif_globals.lock);
    400                         return rc;
     388                        return ERROR_CODE;
    401389                }
    402390                if (length < sizeof(device_stats_t)) {
     
    405393                }
    406394
    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,
    410398                            sizeof(device_stats_t));
    411399                }
    412400
    413401                fibril_rwlock_read_unlock(&netif_globals.lock);
    414                 return rc;
     402                return ERROR_CODE;
    415403
    416404        case NET_NETIF_STOP:
     
    419407        case NET_NETIF_GET_ADDR:
    420408                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);
    424412                fibril_rwlock_read_unlock(&netif_globals.lock);
    425                 return rc;
     413                return ERROR_CODE;
    426414        }
    427415       
     
    443431int netif_module_start_standalone(async_client_conn_t client_connection)
    444432{
    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));
    450436       
    451437        async_manager();
Note: See TracChangeset for help on using the changeset viewer.