Changeset b7fd2a0 in mainline for uspace/srv/net/inetsrv/inet_link.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (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:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/inetsrv/inet_link.c

    r36f0738 rb7fd2a0  
    5555static uint16_t ip_ident = 0;
    5656
    57 static int inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
    58 static int inet_iplink_change_addr(iplink_t *, addr48_t);
     57static errno_t inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
     58static errno_t inet_iplink_change_addr(iplink_t *, addr48_t);
    5959static inet_link_t *inet_link_get_by_id_locked(sysarg_t);
    6060
     
    8383}
    8484
    85 static int inet_iplink_recv(iplink_t *iplink, iplink_recv_sdu_t *sdu, ip_ver_t ver)
     85static errno_t inet_iplink_recv(iplink_t *iplink, iplink_recv_sdu_t *sdu, ip_ver_t ver)
    8686{
    8787        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_recv()");
    8888
    89         int rc;
     89        errno_t rc;
    9090        inet_packet_t packet;
    9191        inet_link_t *ilink;
     
    121121}
    122122
    123 static int inet_iplink_change_addr(iplink_t *iplink, addr48_t mac)
     123static errno_t inet_iplink_change_addr(iplink_t *iplink, addr48_t mac)
    124124{
    125125        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_change_addr(): "
     
    158158}
    159159
    160 int inet_link_open(service_id_t sid)
     160errno_t inet_link_open(service_id_t sid)
    161161{
    162162        inet_link_t *ilink;
    163163        inet_addr_t iaddr;
    164         int rc;
     164        errno_t rc;
    165165
    166166        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_link_open()");
     
    312312 *
    313313 */
    314 int inet_link_send_dgram(inet_link_t *ilink, addr32_t lsrc, addr32_t ldest,
     314errno_t inet_link_send_dgram(inet_link_t *ilink, addr32_t lsrc, addr32_t ldest,
    315315    inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
    316316{
     
    352352        packet.size = dgram->size;
    353353       
    354         int rc;
     354        errno_t rc;
    355355        size_t offs = 0;
    356356       
     
    387387 *
    388388 */
    389 int inet_link_send_dgram6(inet_link_t *ilink, addr48_t ldest,
     389errno_t inet_link_send_dgram6(inet_link_t *ilink, addr48_t ldest,
    390390    inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
    391391{
     
    425425        packet.size = dgram->size;
    426426       
    427         int rc;
     427        errno_t rc;
    428428        size_t offs = 0;
    429429       
     
    471471
    472472/** Get IDs of all links. */
    473 int inet_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
     473errno_t inet_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
    474474{
    475475        sysarg_t *id_list;
Note: See TracChangeset for help on using the changeset viewer.