Changeset cb569e6 in mainline for uspace/lib/net/netif/netif_local.c


Ignore:
Timestamp:
2010-11-18T21:58:27Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4e5c7ba
Parents:
69e0d6d (diff), 45f04f8 (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 mainline changes.

File:
1 edited

Legend:

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

    r69e0d6d rcb569e6  
    4343#include <ipc/services.h>
    4444#include <ipc/netif.h>
    45 #include <err.h>
     45#include <errno.h>
    4646
    4747#include <generic.h>
     
    113113int netif_start_req_local(int netif_phone, device_id_t device_id)
    114114{
    115         ERROR_DECLARE;
     115        int rc;
    116116       
    117117        fibril_rwlock_write_lock(&netif_globals.lock);
    118118       
    119119        netif_device_t *device;
    120         if (ERROR_OCCURRED(find_device(device_id, &device))) {
     120        rc = find_device(device_id, &device);
     121        if (rc != EOK) {
    121122                fibril_rwlock_write_unlock(&netif_globals.lock);
    122                 return ERROR_CODE;
     123                return rc;
    123124        }
    124125       
     
    148149int netif_stop_req_local(int netif_phone, device_id_t device_id)
    149150{
    150         ERROR_DECLARE;
     151        int rc;
    151152       
    152153        fibril_rwlock_write_lock(&netif_globals.lock);
    153154       
    154155        netif_device_t *device;
    155         if (ERROR_OCCURRED(find_device(device_id, &device))) {
     156        rc = find_device(device_id, &device);
     157        if (rc != EOK) {
    156158                fibril_rwlock_write_unlock(&netif_globals.lock);
    157                 return ERROR_CODE;
     159                return rc;
    158160        }
    159161       
     
    203205    measured_string_ref *address, char **data)
    204206{
    205         ERROR_DECLARE;
     207        int rc;
    206208       
    207209        if (!address || !data)
     
    211213       
    212214        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) {
    214217                *address = measured_string_copy(&translation);
    215                 ERROR_CODE = (*address) ? EOK : ENOMEM;
     218                rc = (*address) ? EOK : ENOMEM;
    216219        }
    217220       
     
    220223        *data = (**address).value;
    221224       
    222         return ERROR_CODE;
     225        return rc;
    223226}
    224227
     
    264267int netif_init_module(async_client_conn_t client_connection)
    265268{
    266         ERROR_DECLARE;
     269        int rc;
    267270       
    268271        async_set_client_connection(client_connection);
     
    271274        netif_device_map_initialize(&netif_globals.device_map);
    272275       
    273         ERROR_PROPAGATE(pm_init());
     276        rc = pm_init();
     277        if (rc != EOK)
     278                return rc;
    274279       
    275280        fibril_rwlock_initialize(&netif_globals.lock);
    276         if (ERROR_OCCURRED(netif_initialize())) {
     281       
     282        rc = netif_initialize();
     283        if (rc != EOK) {
    277284                pm_destroy();
    278                 return ERROR_CODE;
     285                return rc;
    279286        }
    280287       
     
    317324static int register_message(const char *name, device_id_t device_id, int phone)
    318325{
    319         ERROR_DECLARE;
    320        
    321326        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)
    324334                return ELIMIT;
    325335       
     
    349359    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
    350360{
    351         ERROR_DECLARE;
    352        
    353361        size_t length;
    354362        device_stats_t stats;
    355363        packet_t packet;
    356364        measured_string_t address;
     365        int rc;
    357366       
    358367        *answer_count = 0;
     
    367376        case IPC_M_CONNECT_TO_ME:
    368377                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),
    370379                    IPC_GET_PHONE(call));
    371380                fibril_rwlock_write_unlock(&netif_globals.lock);
    372                 return ERROR_CODE;
     381                return rc;
    373382               
    374383        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;
    377388                return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet,
    378389                    IPC_GET_SENDER(call));
    379                    
     390               
    380391        case NET_NETIF_START:
    381392                return netif_start_req_local(0, IPC_GET_DEVICE(call));
     
    384395                fibril_rwlock_read_lock(&netif_globals.lock);
    385396
    386                 if (ERROR_OCCURRED(async_data_read_receive(&callid, &length))) {
     397                rc = async_data_read_receive(&callid, &length);
     398                if (rc != EOK) {
    387399                        fibril_rwlock_read_unlock(&netif_globals.lock);
    388                         return ERROR_CODE;
     400                        return rc;
    389401                }
    390402                if (length < sizeof(device_stats_t)) {
     
    393405                }
    394406
    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,
    398410                            sizeof(device_stats_t));
    399411                }
    400412
    401413                fibril_rwlock_read_unlock(&netif_globals.lock);
    402                 return ERROR_CODE;
     414                return rc;
    403415
    404416        case NET_NETIF_STOP:
     
    407419        case NET_NETIF_GET_ADDR:
    408420                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);
    412424                fibril_rwlock_read_unlock(&netif_globals.lock);
    413                 return ERROR_CODE;
     425                return rc;
    414426        }
    415427       
     
    431443int netif_module_start_standalone(async_client_conn_t client_connection)
    432444{
    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;
    436450       
    437451        async_manager();
Note: See TracChangeset for help on using the changeset viewer.