Changeset a35b458 in mainline for uspace/srv/net/inetsrv/inet_link.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/srv/net/inetsrv/inet_link.c

    r3061bc1 ra35b458  
    154154        if (ilink->svc_name != NULL)
    155155                free(ilink->svc_name);
    156        
     156
    157157        free(ilink);
    158158}
     
    197197                goto error;
    198198        }
    199        
     199
    200200        /*
    201201         * Get the MAC address of the link. If the link has a MAC
     
    221221
    222222        inet_addrobj_t *addr = NULL;
    223        
     223
    224224        /* XXX FIXME Cannot rely on loopback being the first IP link service!! */
    225225        if (first_link) {
    226226                addr = inet_addrobj_new();
    227                
     227
    228228                inet_naddr(&addr->naddr, 127, 0, 0, 1, 24);
    229229                first_link = false;
    230230        }
    231        
     231
    232232        if (addr != NULL) {
    233233                addr->ilink = ilink;
    234234                addr->name = str_dup("v4a");
    235                
     235
    236236                rc = inet_addrobj_add(addr);
    237237                if (rc == EOK) {
     
    249249                }
    250250        }
    251        
     251
    252252        inet_addrobj_t *addr6 = NULL;
    253        
     253
    254254        if (first_link6) {
    255255                addr6 = inet_addrobj_new();
    256                
     256
    257257                inet_naddr6(&addr6->naddr, 0, 0, 0, 0, 0, 0, 0, 1, 128);
    258258                first_link6 = false;
    259259        } else if (ilink->mac_valid) {
    260260                addr6 = inet_addrobj_new();
    261                
     261
    262262                addr128_t link_local;
    263263                inet_link_local_node_ip(ilink->mac, link_local);
    264                
     264
    265265                inet_naddr_set6(link_local, 64, &addr6->naddr);
    266266        }
    267        
     267
    268268        if (addr6 != NULL) {
    269269                addr6->ilink = ilink;
    270270                addr6->name = str_dup("v6a");
    271                
     271
    272272                rc = inet_addrobj_add(addr6);
    273273                if (rc == EOK) {
     
    285285                }
    286286        }
    287        
     287
    288288        log_msg(LOG_DEFAULT, LVL_DEBUG, "Configured link '%s'.", ilink->svc_name);
    289289        return EOK;
    290        
     290
    291291error:
    292292        if (ilink->iplink != NULL)
    293293                iplink_close(ilink->iplink);
    294        
     294
    295295        inet_link_delete(ilink);
    296296        return rc;
     
    319319        if (src_ver != ip_v4)
    320320                return EINVAL;
    321        
     321
    322322        addr32_t dest_v4;
    323323        ip_ver_t dest_ver = inet_addr_get(&dgram->dest, &dest_v4, NULL);
    324324        if (dest_ver != ip_v4)
    325325                return EINVAL;
    326        
     326
    327327        /*
    328328         * Fill packet structure. Fragmentation is performed by
    329329         * inet_pdu_encode().
    330330         */
    331        
     331
    332332        iplink_sdu_t sdu;
    333        
     333
    334334        sdu.src = lsrc;
    335335        sdu.dest = ldest;
    336        
     336
    337337        inet_packet_t packet;
    338        
     338
    339339        packet.src = dgram->src;
    340340        packet.dest = dgram->dest;
     
    342342        packet.proto = proto;
    343343        packet.ttl = ttl;
    344        
     344
    345345        /* Allocate identifier */
    346346        fibril_mutex_lock(&ip_ident_lock);
    347347        packet.ident = ++ip_ident;
    348348        fibril_mutex_unlock(&ip_ident_lock);
    349        
     349
    350350        packet.df = df;
    351351        packet.data = dgram->data;
    352352        packet.size = dgram->size;
    353        
     353
    354354        errno_t rc;
    355355        size_t offs = 0;
    356        
     356
    357357        do {
    358358                /* Encode one fragment */
    359                
     359
    360360                size_t roffs;
    361361                rc = inet_pdu_encode(&packet, src_v4, dest_v4, offs, ilink->def_mtu,
     
    363363                if (rc != EOK)
    364364                        return rc;
    365                
     365
    366366                /* Send the PDU */
    367367                rc = iplink_send(ilink->iplink, &sdu);
    368                
     368
    369369                free(sdu.data);
    370370                offs = roffs;
    371371        } while (offs < packet.size);
    372        
     372
    373373        return rc;
    374374}
     
    394394        if (src_ver != ip_v6)
    395395                return EINVAL;
    396        
     396
    397397        addr128_t dest_v6;
    398398        ip_ver_t dest_ver = inet_addr_get(&dgram->dest, NULL, &dest_v6);
    399399        if (dest_ver != ip_v6)
    400400                return EINVAL;
    401        
     401
    402402        iplink_sdu6_t sdu6;
    403403        addr48(ldest, sdu6.dest);
    404        
     404
    405405        /*
    406406         * Fill packet structure. Fragmentation is performed by
    407407         * inet_pdu_encode6().
    408408         */
    409        
     409
    410410        inet_packet_t packet;
    411        
     411
    412412        packet.src = dgram->src;
    413413        packet.dest = dgram->dest;
     
    415415        packet.proto = proto;
    416416        packet.ttl = ttl;
    417        
     417
    418418        /* Allocate identifier */
    419419        fibril_mutex_lock(&ip_ident_lock);
    420420        packet.ident = ++ip_ident;
    421421        fibril_mutex_unlock(&ip_ident_lock);
    422        
     422
    423423        packet.df = df;
    424424        packet.data = dgram->data;
    425425        packet.size = dgram->size;
    426        
     426
    427427        errno_t rc;
    428428        size_t offs = 0;
    429        
     429
    430430        do {
    431431                /* Encode one fragment */
    432                
     432
    433433                size_t roffs;
    434434                rc = inet_pdu_encode6(&packet, src_v6, dest_v6, offs, ilink->def_mtu,
     
    436436                if (rc != EOK)
    437437                        return rc;
    438                
     438
    439439                /* Send the PDU */
    440440                rc = iplink_send6(ilink->iplink, &sdu6);
    441                
     441
    442442                free(sdu6.data);
    443443                offs = roffs;
    444444        } while (offs < packet.size);
    445        
     445
    446446        return rc;
    447447}
Note: See TracChangeset for help on using the changeset viewer.