Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/iplink.c

    r25a179e rb7fd2a0  
    4747static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    4848
    49 int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
     49errno_t iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
    5050    iplink_t **riplink)
    5151{
     
    6161
    6262        port_id_t port;
    63         int rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
     63        errno_t rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
    6464            iplink_cb_conn, iplink, &port);
    6565       
     
    8585}
    8686
    87 int iplink_send(iplink_t *iplink, iplink_sdu_t *sdu)
     87errno_t iplink_send(iplink_t *iplink, iplink_sdu_t *sdu)
    8888{
    8989        async_exch_t *exch = async_exchange_begin(iplink->sess);
     
    9393            (sysarg_t) sdu->dest, &answer);
    9494       
    95         int rc = async_data_write_start(exch, sdu->data, sdu->size);
    96        
    97         async_exchange_end(exch);
    98        
    99         if (rc != EOK) {
    100                 async_forget(req);
    101                 return rc;
    102         }
    103        
    104         int retval;
    105         async_wait_for(req, &retval);
    106        
    107         return retval;
    108 }
    109 
    110 int iplink_send6(iplink_t *iplink, iplink_sdu6_t *sdu)
     95        errno_t rc = async_data_write_start(exch, sdu->data, sdu->size);
     96       
     97        async_exchange_end(exch);
     98       
     99        if (rc != EOK) {
     100                async_forget(req);
     101                return rc;
     102        }
     103       
     104        errno_t retval;
     105        async_wait_for(req, &retval);
     106       
     107        return retval;
     108}
     109
     110errno_t iplink_send6(iplink_t *iplink, iplink_sdu6_t *sdu)
    111111{
    112112        async_exch_t *exch = async_exchange_begin(iplink->sess);
     
    115115        aid_t req = async_send_0(exch, IPLINK_SEND6, &answer);
    116116       
    117         int rc = async_data_write_start(exch, &sdu->dest, sizeof(addr48_t));
     117        errno_t rc = async_data_write_start(exch, &sdu->dest, sizeof(addr48_t));
    118118        if (rc != EOK) {
    119119                async_exchange_end(exch);
     
    131131        }
    132132       
    133         int retval;
    134         async_wait_for(req, &retval);
    135        
    136         return retval;
    137 }
    138 
    139 int iplink_get_mtu(iplink_t *iplink, size_t *rmtu)
     133        errno_t retval;
     134        async_wait_for(req, &retval);
     135       
     136        return retval;
     137}
     138
     139errno_t iplink_get_mtu(iplink_t *iplink, size_t *rmtu)
    140140{
    141141        async_exch_t *exch = async_exchange_begin(iplink->sess);
    142142       
    143143        sysarg_t mtu;
    144         int rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
     144        errno_t rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
    145145       
    146146        async_exchange_end(exch);
     
    153153}
    154154
    155 int iplink_get_mac48(iplink_t *iplink, addr48_t *mac)
     155errno_t iplink_get_mac48(iplink_t *iplink, addr48_t *mac)
    156156{
    157157        async_exch_t *exch = async_exchange_begin(iplink->sess);
     
    160160        aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
    161161       
    162         int rc = async_data_read_start(exch, mac, sizeof(addr48_t));
     162        errno_t rc = async_data_read_start(exch, mac, sizeof(addr48_t));
    163163       
    164164        loc_exchange_end(exch);
     
    169169        }
    170170       
    171         int retval;
    172         async_wait_for(req, &retval);
    173        
    174         return retval;
    175 }
    176 
    177 int iplink_set_mac48(iplink_t *iplink, addr48_t mac)
     171        errno_t retval;
     172        async_wait_for(req, &retval);
     173       
     174        return retval;
     175}
     176
     177errno_t iplink_set_mac48(iplink_t *iplink, addr48_t mac)
    178178{
    179179        async_exch_t *exch = async_exchange_begin(iplink->sess);
     
    182182        aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
    183183       
    184         int rc = async_data_read_start(exch, mac, sizeof(addr48_t));
     184        errno_t rc = async_data_read_start(exch, mac, sizeof(addr48_t));
    185185       
    186186        loc_exchange_end(exch);
     
    191191        }
    192192       
    193         int retval;
    194         async_wait_for(req, &retval);
    195        
    196         return retval;
    197 }
    198 
    199 
    200 int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
     193        errno_t retval;
     194        async_wait_for(req, &retval);
     195       
     196        return retval;
     197}
     198
     199
     200errno_t iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
    201201{
    202202        async_exch_t *exch = async_exchange_begin(iplink->sess);
     
    205205        aid_t req = async_send_0(exch, IPLINK_ADDR_ADD, &answer);
    206206       
    207         int rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
    208         async_exchange_end(exch);
    209        
    210         if (rc != EOK) {
    211                 async_forget(req);
    212                 return rc;
    213         }
    214        
    215         int retval;
    216         async_wait_for(req, &retval);
    217        
    218         return retval;
    219 }
    220 
    221 int iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
     207        errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
     208        async_exchange_end(exch);
     209       
     210        if (rc != EOK) {
     211                async_forget(req);
     212                return rc;
     213        }
     214       
     215        errno_t retval;
     216        async_wait_for(req, &retval);
     217       
     218        return retval;
     219}
     220
     221errno_t iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
    222222{
    223223        async_exch_t *exch = async_exchange_begin(iplink->sess);
     
    226226        aid_t req = async_send_0(exch, IPLINK_ADDR_REMOVE, &answer);
    227227       
    228         int rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
    229         async_exchange_end(exch);
    230        
    231         if (rc != EOK) {
    232                 async_forget(req);
    233                 return rc;
    234         }
    235        
    236         int retval;
     228        errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
     229        async_exchange_end(exch);
     230       
     231        if (rc != EOK) {
     232                async_forget(req);
     233                return rc;
     234        }
     235       
     236        errno_t retval;
    237237        async_wait_for(req, &retval);
    238238       
     
    252252        ip_ver_t ver = IPC_GET_ARG1(*icall);
    253253       
    254         int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
     254        errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
    255255            &sdu.size);
    256256        if (rc != EOK) {
     
    270270        size_t size;
    271271       
    272         int rc = async_data_write_accept((void **)&addr, false,
     272        errno_t rc = async_data_write_accept((void **)&addr, false,
    273273            sizeof(addr48_t), sizeof(addr48_t), 0, &size);
    274274        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.