Changeset a35b458 in mainline for uspace/lib/c/generic/iplink_srv.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_srv.c

    r3061bc1 ra35b458  
    5959                return;
    6060        }
    61        
     61
    6262        ipc_callid_t callid;
    6363        size_t size;
     
    6767                return;
    6868        }
    69        
     69
    7070        if (size != sizeof(addr48_t)) {
    7171                async_answer_0(callid, EINVAL);
     
    7373                return;
    7474        }
    75        
     75
    7676        rc = async_data_read_finalize(callid, &mac, size);
    7777        if (rc != EOK)
    7878                async_answer_0(callid, rc);
    79        
     79
    8080        async_answer_0(iid, rc);
    8181}
     
    9999                return;
    100100        }
    101        
     101
    102102        rc = async_data_read_finalize(callid, &mac, sizeof(addr48_t));
    103103        if (rc != EOK)
    104104                async_answer_0(callid, rc);
    105        
     105
    106106        async_answer_0(iid, rc);
    107107}
     
    117117                return;
    118118        }
    119        
     119
    120120        if (size != sizeof(inet_addr_t)) {
    121121                async_answer_0(callid, EINVAL);
     
    123123                return;
    124124        }
    125        
     125
    126126        inet_addr_t addr;
    127127        errno_t rc = async_data_write_finalize(callid, &addr, size);
     
    130130                async_answer_0(iid, rc);
    131131        }
    132        
     132
    133133        rc = srv->ops->addr_add(srv, &addr);
    134134        async_answer_0(iid, rc);
     
    145145                return;
    146146        }
    147        
     147
    148148        if (size != sizeof(inet_addr_t)) {
    149149                async_answer_0(callid, EINVAL);
     
    151151                return;
    152152        }
    153        
     153
    154154        inet_addr_t addr;
    155155        errno_t rc = async_data_write_finalize(callid, &addr, size);
     
    158158                async_answer_0(iid, rc);
    159159        }
    160        
     160
    161161        rc = srv->ops->addr_remove(srv, &addr);
    162162        async_answer_0(iid, rc);
     
    167167{
    168168        iplink_sdu_t sdu;
    169        
     169
    170170        sdu.src = IPC_GET_ARG1(*icall);
    171171        sdu.dest = IPC_GET_ARG2(*icall);
    172        
     172
    173173        errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
    174174            &sdu.size);
     
    177177                return;
    178178        }
    179        
     179
    180180        rc = srv->ops->send(srv, &sdu);
    181181        free(sdu.data);
     
    187187{
    188188        iplink_sdu6_t sdu;
    189        
     189
    190190        ipc_callid_t callid;
    191191        size_t size;
     
    195195                return;
    196196        }
    197        
     197
    198198        if (size != sizeof(addr48_t)) {
    199199                async_answer_0(callid, EINVAL);
     
    201201                return;
    202202        }
    203        
     203
    204204        errno_t rc = async_data_write_finalize(callid, &sdu.dest, size);
    205205        if (rc != EOK) {
     
    207207                async_answer_0(iid, rc);
    208208        }
    209        
     209
    210210        rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
    211211            &sdu.size);
     
    214214                return;
    215215        }
    216        
     216
    217217        rc = srv->ops->send6(srv, &sdu);
    218218        free(sdu.data);
     
    233233        iplink_srv_t *srv = (iplink_srv_t *) arg;
    234234        errno_t rc;
    235        
     235
    236236        fibril_mutex_lock(&srv->lock);
    237237        if (srv->connected) {
     
    240240                return EBUSY;
    241241        }
    242        
     242
    243243        srv->connected = true;
    244244        fibril_mutex_unlock(&srv->lock);
    245        
     245
    246246        /* Accept the connection */
    247247        async_answer_0(iid, EOK);
    248        
     248
    249249        async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
    250250        if (sess == NULL)
    251251                return ENOMEM;
    252        
     252
    253253        srv->client_sess = sess;
    254        
     254
    255255        rc = srv->ops->open(srv);
    256256        if (rc != EOK)
    257257                return rc;
    258        
     258
    259259        while (true) {
    260260                ipc_call_t call;
    261261                ipc_callid_t callid = async_get_call(&call);
    262262                sysarg_t method = IPC_GET_IMETHOD(call);
    263                
     263
    264264                if (!method) {
    265265                        /* The other side has hung up */
     
    270270                        break;
    271271                }
    272                
     272
    273273                switch (method) {
    274274                case IPLINK_GET_MTU:
     
    297297                }
    298298        }
    299        
     299
    300300        return srv->ops->close(srv);
    301301}
     
    306306        if (srv->client_sess == NULL)
    307307                return EIO;
    308        
     308
    309309        async_exch_t *exch = async_exchange_begin(srv->client_sess);
    310        
     310
    311311        ipc_call_t answer;
    312312        aid_t req = async_send_1(exch, IPLINK_EV_RECV, (sysarg_t)ver,
    313313            &answer);
    314        
     314
    315315        errno_t rc = async_data_write_start(exch, sdu->data, sdu->size);
    316316        async_exchange_end(exch);
    317        
     317
    318318        if (rc != EOK) {
    319319                async_forget(req);
    320320                return rc;
    321321        }
    322        
     322
    323323        errno_t retval;
    324324        async_wait_for(req, &retval);
    325325        if (retval != EOK)
    326326                return retval;
    327        
     327
    328328        return EOK;
    329329}
     
    333333        if (srv->client_sess == NULL)
    334334                return EIO;
    335        
     335
    336336        async_exch_t *exch = async_exchange_begin(srv->client_sess);
    337        
     337
    338338        ipc_call_t answer;
    339339        aid_t req = async_send_0(exch, IPLINK_EV_CHANGE_ADDR, &answer);
    340        
     340
    341341        errno_t rc = async_data_write_start(exch, addr, sizeof(addr48_t));
    342342        async_exchange_end(exch);
    343        
     343
    344344        if (rc != EOK) {
    345345                async_forget(req);
    346346                return rc;
    347347        }
    348        
     348
    349349        errno_t retval;
    350350        async_wait_for(req, &retval);
    351351        if (retval != EOK)
    352352                return retval;
    353        
     353
    354354        return EOK;
    355355}
Note: See TracChangeset for help on using the changeset viewer.