Changeset b7fd2a0 in mainline for uspace/srv/net/loopip/loopip.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/loopip/loopip.c

    r36f0738 rb7fd2a0  
    4949#define NAME  "loopip"
    5050
    51 static int loopip_open(iplink_srv_t *srv);
    52 static int loopip_close(iplink_srv_t *srv);
    53 static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
    54 static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
    55 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);
    56 static int loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);
    57 static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
    58 static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
     51static errno_t loopip_open(iplink_srv_t *srv);
     52static errno_t loopip_close(iplink_srv_t *srv);
     53static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
     54static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
     55static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);
     56static errno_t loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);
     57static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
     58static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
    5959
    6060static void loopip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
     
    8282} rqueue_entry_t;
    8383
    84 static int loopip_recv_fibril(void *arg)
     84static errno_t loopip_recv_fibril(void *arg)
    8585{
    8686        while (true) {
     
    9999}
    100100
    101 static int loopip_init(void)
     101static errno_t loopip_init(void)
    102102{
    103103        async_set_fallback_port_handler(loopip_client_conn, NULL);
    104104       
    105         int rc = loc_server_register(NAME);
     105        errno_t rc = loc_server_register(NAME);
    106106        if (rc != EOK) {
    107107                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
     
    153153}
    154154
    155 static int loopip_open(iplink_srv_t *srv)
     155static errno_t loopip_open(iplink_srv_t *srv)
    156156{
    157157        log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_open()");
     
    159159}
    160160
    161 static int loopip_close(iplink_srv_t *srv)
     161static errno_t loopip_close(iplink_srv_t *srv)
    162162{
    163163        log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_close()");
     
    165165}
    166166
    167 static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
     167static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
    168168{
    169169        log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_send()");
     
    194194}
    195195
    196 static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
     196static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
    197197{
    198198        log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip6_send()");
     
    223223}
    224224
    225 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)
     225static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)
    226226{
    227227        log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mtu()");
     
    230230}
    231231
    232 static int loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)
     232static errno_t loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)
    233233{
    234234        log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mac48()");
     
    236236}
    237237
    238 static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
    239 {
    240         return EOK;
    241 }
    242 
    243 static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
     238static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
     239{
     240        return EOK;
     241}
     242
     243static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
    244244{
    245245        return EOK;
     
    250250        printf("%s: HelenOS loopback IP link provider\n", NAME);
    251251       
    252         int rc = log_init(NAME);
     252        errno_t rc = log_init(NAME);
    253253        if (rc != EOK) {
    254254                printf("%s: Failed to initialize logging: %s.\n", NAME, str_error(rc));
Note: See TracChangeset for help on using the changeset viewer.