Ignore:
File:
1 edited

Legend:

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

    r0ab68f6 rb69ceea  
    3838#include <async.h>
    3939#include <errno.h>
     40#include <err.h>
    4041#include <ipc/ipc.h>
    4142#include <ipc/packet.h>
     
    6667packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size)
    6768{
     69        ERROR_DECLARE;
     70       
    6871        ipc_call_t answer;
    69         aid_t message;
    70         int rc;
    71        
    72         message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
     72        aid_t message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
    7373
    7474        *packet = (packet_t) as_get_mappable_page(size);
    75         rc = async_share_in_start_0_0(phone, *packet, size);
    76         if (rc != EOK) {
     75        if (ERROR_OCCURRED(async_share_in_start_0_0(phone, *packet, size)) ||
     76            ERROR_OCCURRED(pm_add(*packet))) {
    7777                munmap(*packet, size);
    7878                async_wait_for(message, NULL);
    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;
     79                return ERROR_CODE;
    8680        }
    8781       
     
    109103int packet_translate_remote(int phone, packet_ref packet, packet_id_t packet_id)
    110104{
    111         int rc;
     105        ERROR_DECLARE;
    112106       
    113107        if (!packet)
     
    118112                ipcarg_t size;
    119113               
    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;
     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));
    127117        }
    128118        if ((*packet)->next) {
     
    151141    size_t max_prefix, size_t max_suffix)
    152142{
     143        ERROR_DECLARE;
     144       
    153145        ipcarg_t packet_id;
    154146        ipcarg_t 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)
     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)))
    160150                return NULL;
    161151       
     
    163153        packet_t packet = pm_find(packet_id);
    164154        if (!packet) {
    165                 rc = packet_return(phone, &packet, packet_id, size);
    166                 if (rc != EOK)
     155                if (ERROR_OCCURRED(packet_return(phone, &packet, packet_id,
     156                    size)))
    167157                        return NULL;
    168158        }
     
    182172packet_t packet_get_1_remote(int phone, size_t content)
    183173{
     174        ERROR_DECLARE;
     175       
    184176        ipcarg_t packet_id;
    185177        ipcarg_t 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)
     178       
     179        if (ERROR_OCCURRED(async_req_1_2(phone, NET_PACKET_CREATE_1, content,
     180            &packet_id, &size)))
    191181                return NULL;
    192182       
    193183        packet_t packet = pm_find(packet_id);
    194184        if (!packet) {
    195                 rc = packet_return(phone, &packet, packet_id, size);
    196                 if (rc != EOK)
     185                if (ERROR_OCCURRED(packet_return(phone, &packet, packet_id,
     186                    size)))
    197187                        return NULL;
    198188        }
Note: See TracChangeset for help on using the changeset viewer.