Ignore:
Timestamp:
2010-11-07T20:48:21Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3a5d238f
Parents:
88b127b
Message:

Get rid of the ERROR_CODE madness in libnet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/generic/packet_remote.c

    r88b127b r0ab68f6  
    3838#include <async.h>
    3939#include <errno.h>
    40 #include <err.h>
    4140#include <ipc/ipc.h>
    4241#include <ipc/packet.h>
     
    6766packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size)
    6867{
    69         ERROR_DECLARE;
    70        
    7168        ipc_call_t answer;
    72         aid_t message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
     69        aid_t message;
     70        int rc;
     71       
     72        message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
    7373
    7474        *packet = (packet_t) as_get_mappable_page(size);
    75         if (ERROR_OCCURRED(async_share_in_start_0_0(phone, *packet, size)) ||
    76             ERROR_OCCURRED(pm_add(*packet))) {
     75        rc = async_share_in_start_0_0(phone, *packet, size);
     76        if (rc != EOK) {
    7777                munmap(*packet, size);
    7878                async_wait_for(message, NULL);
    79                 return ERROR_CODE;
     79                return rc;
     80        }
     81        rc = pm_add(*packet);
     82        if (rc != EOK) {
     83                munmap(*packet, size);
     84                async_wait_for(message, NULL);
     85                return rc;
    8086        }
    8187       
     
    103109int packet_translate_remote(int phone, packet_ref packet, packet_id_t packet_id)
    104110{
    105         ERROR_DECLARE;
     111        int rc;
    106112       
    107113        if (!packet)
     
    112118                ipcarg_t size;
    113119               
    114                 ERROR_PROPAGATE(async_req_1_1(phone, NET_PACKET_GET_SIZE,
    115                     packet_id, &size));
    116                 ERROR_PROPAGATE(packet_return(phone, packet, packet_id, size));
     120                rc = async_req_1_1(phone, NET_PACKET_GET_SIZE, packet_id,
     121                    &size);
     122                if (rc != EOK)
     123                        return rc;
     124                rc = packet_return(phone, packet, packet_id, size);
     125                if (rc != EOK)
     126                        return rc;
    117127        }
    118128        if ((*packet)->next) {
     
    141151    size_t max_prefix, size_t max_suffix)
    142152{
    143         ERROR_DECLARE;
    144        
    145153        ipcarg_t packet_id;
    146154        ipcarg_t size;
    147        
    148         if (ERROR_OCCURRED(async_req_4_2(phone, NET_PACKET_CREATE_4,
    149             max_content, addr_len, max_prefix, max_suffix, &packet_id, &size)))
     155        int rc;
     156       
     157        rc = async_req_4_2(phone, NET_PACKET_CREATE_4, max_content, addr_len,
     158            max_prefix, max_suffix, &packet_id, &size);
     159        if (rc != EOK)
    150160                return NULL;
    151161       
     
    153163        packet_t packet = pm_find(packet_id);
    154164        if (!packet) {
    155                 if (ERROR_OCCURRED(packet_return(phone, &packet, packet_id,
    156                     size)))
     165                rc = packet_return(phone, &packet, packet_id, size);
     166                if (rc != EOK)
    157167                        return NULL;
    158168        }
     
    172182packet_t packet_get_1_remote(int phone, size_t content)
    173183{
    174         ERROR_DECLARE;
    175        
    176184        ipcarg_t packet_id;
    177185        ipcarg_t size;
    178        
    179         if (ERROR_OCCURRED(async_req_1_2(phone, NET_PACKET_CREATE_1, content,
    180             &packet_id, &size)))
     186        int rc;
     187       
     188        rc = async_req_1_2(phone, NET_PACKET_CREATE_1, content, &packet_id,
     189            &size);
     190        if (rc != EOK)
    181191                return NULL;
    182192       
    183193        packet_t packet = pm_find(packet_id);
    184194        if (!packet) {
    185                 if (ERROR_OCCURRED(packet_return(phone, &packet, packet_id,
    186                     size)))
     195                rc = packet_return(phone, &packet, packet_id, size);
     196                if (rc != EOK)
    187197                        return NULL;
    188198        }
Note: See TracChangeset for help on using the changeset viewer.