Changeset a35b458 in mainline for uspace/lib/c/generic/iplink.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

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

    r3061bc1 ra35b458  
    5353        if (iplink == NULL)
    5454                return ENOMEM;
    55        
     55
    5656        iplink->sess = sess;
    5757        iplink->ev_ops = ev_ops;
    5858        iplink->arg = arg;
    59        
     59
    6060        async_exch_t *exch = async_exchange_begin(sess);
    6161
     
    6363        errno_t rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
    6464            iplink_cb_conn, iplink, &port);
    65        
    66         async_exchange_end(exch);
    67        
     65
     66        async_exchange_end(exch);
     67
    6868        if (rc != EOK)
    6969                goto error;
    70        
     70
    7171        *riplink = iplink;
    7272        return EOK;
    73        
     73
    7474error:
    7575        if (iplink != NULL)
    7676                free(iplink);
    77        
     77
    7878        return rc;
    7979}
     
    8888{
    8989        async_exch_t *exch = async_exchange_begin(iplink->sess);
    90        
     90
    9191        ipc_call_t answer;
    9292        aid_t req = async_send_2(exch, IPLINK_SEND, (sysarg_t) sdu->src,
    9393            (sysarg_t) sdu->dest, &answer);
    94        
     94
    9595        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        
     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
    107107        return retval;
    108108}
     
    111111{
    112112        async_exch_t *exch = async_exchange_begin(iplink->sess);
    113        
     113
    114114        ipc_call_t answer;
    115115        aid_t req = async_send_0(exch, IPLINK_SEND6, &answer);
    116        
     116
    117117        errno_t rc = async_data_write_start(exch, &sdu->dest, sizeof(addr48_t));
    118118        if (rc != EOK) {
     
    121121                return rc;
    122122        }
    123        
     123
    124124        rc = async_data_write_start(exch, sdu->data, sdu->size);
    125        
    126         async_exchange_end(exch);
    127        
    128         if (rc != EOK) {
    129                 async_forget(req);
    130                 return rc;
    131         }
    132        
    133         errno_t retval;
    134         async_wait_for(req, &retval);
    135        
     125
     126        async_exchange_end(exch);
     127
     128        if (rc != EOK) {
     129                async_forget(req);
     130                return rc;
     131        }
     132
     133        errno_t retval;
     134        async_wait_for(req, &retval);
     135
    136136        return retval;
    137137}
     
    140140{
    141141        async_exch_t *exch = async_exchange_begin(iplink->sess);
    142        
     142
    143143        sysarg_t mtu;
    144144        errno_t rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
    145        
    146         async_exchange_end(exch);
    147        
     145
     146        async_exchange_end(exch);
     147
    148148        if (rc != EOK)
    149149                return rc;
    150        
     150
    151151        *rmtu = mtu;
    152152        return EOK;
     
    156156{
    157157        async_exch_t *exch = async_exchange_begin(iplink->sess);
    158        
     158
    159159        ipc_call_t answer;
    160160        aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
    161        
     161
    162162        errno_t rc = async_data_read_start(exch, mac, sizeof(addr48_t));
    163        
     163
    164164        loc_exchange_end(exch);
    165        
    166         if (rc != EOK) {
    167                 async_forget(req);
    168                 return rc;
    169         }
    170        
    171         errno_t retval;
    172         async_wait_for(req, &retval);
    173        
     165
     166        if (rc != EOK) {
     167                async_forget(req);
     168                return rc;
     169        }
     170
     171        errno_t retval;
     172        async_wait_for(req, &retval);
     173
    174174        return retval;
    175175}
     
    178178{
    179179        async_exch_t *exch = async_exchange_begin(iplink->sess);
    180        
     180
    181181        ipc_call_t answer;
    182182        aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
    183        
     183
    184184        errno_t rc = async_data_read_start(exch, mac, sizeof(addr48_t));
    185        
     185
    186186        loc_exchange_end(exch);
    187        
    188         if (rc != EOK) {
    189                 async_forget(req);
    190                 return rc;
    191         }
    192        
    193         errno_t retval;
    194         async_wait_for(req, &retval);
    195        
     187
     188        if (rc != EOK) {
     189                async_forget(req);
     190                return rc;
     191        }
     192
     193        errno_t retval;
     194        async_wait_for(req, &retval);
     195
    196196        return retval;
    197197}
     
    201201{
    202202        async_exch_t *exch = async_exchange_begin(iplink->sess);
    203        
     203
    204204        ipc_call_t answer;
    205205        aid_t req = async_send_0(exch, IPLINK_ADDR_ADD, &answer);
    206        
     206
    207207        errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
    208208        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        
     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
    218218        return retval;
    219219}
     
    222222{
    223223        async_exch_t *exch = async_exchange_begin(iplink->sess);
    224        
     224
    225225        ipc_call_t answer;
    226226        aid_t req = async_send_0(exch, IPLINK_ADDR_REMOVE, &answer);
    227        
     227
    228228        errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
    229229        async_exchange_end(exch);
    230        
    231         if (rc != EOK) {
    232                 async_forget(req);
    233                 return rc;
    234         }
    235        
    236         errno_t retval;
    237         async_wait_for(req, &retval);
    238        
     230
     231        if (rc != EOK) {
     232                async_forget(req);
     233                return rc;
     234        }
     235
     236        errno_t retval;
     237        async_wait_for(req, &retval);
     238
    239239        return retval;
    240240}
     
    249249{
    250250        iplink_recv_sdu_t sdu;
    251        
     251
    252252        ip_ver_t ver = IPC_GET_ARG1(*icall);
    253        
     253
    254254        errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
    255255            &sdu.size);
     
    258258                return;
    259259        }
    260        
     260
    261261        rc = iplink->ev_ops->recv(iplink, &sdu, ver);
    262262        free(sdu.data);
     
    269269        addr48_t *addr;
    270270        size_t size;
    271        
     271
    272272        errno_t rc = async_data_write_accept((void **)&addr, false,
    273273            sizeof(addr48_t), sizeof(addr48_t), 0, &size);
     
    285285{
    286286        iplink_t *iplink = (iplink_t *) arg;
    287        
     287
    288288        while (true) {
    289289                ipc_call_t call;
    290290                ipc_callid_t callid = async_get_call(&call);
    291                
     291
    292292                if (!IPC_GET_IMETHOD(call)) {
    293293                        /* TODO: Handle hangup */
    294294                        return;
    295295                }
    296                
     296
    297297                switch (IPC_GET_IMETHOD(call)) {
    298298                case IPLINK_EV_RECV:
Note: See TracChangeset for help on using the changeset viewer.