Changeset 46577995 in mainline for uspace/srv/net/inetsrv/inetsrv.c


Ignore:
Timestamp:
2018-01-04T20:50:52Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
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.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

File:
1 edited

Legend:

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

    rfacacc71 r46577995  
    8484static void inet_default_conn(ipc_callid_t, ipc_call_t *, void *);
    8585
    86 static int inet_init(void)
     86static errno_t inet_init(void)
    8787{
    8888        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_init()");
    8989       
    9090        port_id_t port;
    91         int rc = async_create_port(INTERFACE_INET,
     91        errno_t rc = async_create_port(INTERFACE_INET,
    9292            inet_default_conn, NULL, &port);
    9393        if (rc != EOK)
     
    135135}
    136136
    137 static int inet_find_dir(inet_addr_t *src, inet_addr_t *dest, uint8_t tos,
     137static errno_t inet_find_dir(inet_addr_t *src, inet_addr_t *dest, uint8_t tos,
    138138    inet_dir_t *dir)
    139139{
     
    165165}
    166166
    167 int inet_route_packet(inet_dgram_t *dgram, uint8_t proto, uint8_t ttl,
     167errno_t inet_route_packet(inet_dgram_t *dgram, uint8_t proto, uint8_t ttl,
    168168    int df)
    169169{
    170170        inet_dir_t dir;
    171171        inet_link_t *ilink;
    172         int rc;
     172        errno_t rc;
    173173
    174174        if (dgram->iplink != 0) {
     
    201201}
    202202
    203 static int inet_send(inet_client_t *client, inet_dgram_t *dgram,
     203static errno_t inet_send(inet_client_t *client, inet_dgram_t *dgram,
    204204    uint8_t proto, uint8_t ttl, int df)
    205205{
     
    207207}
    208208
    209 int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
     209errno_t inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
    210210{
    211211        inet_dir_t dir;
    212         int rc;
     212        errno_t rc;
    213213
    214214        rc = inet_find_dir(NULL, remote, tos, &dir);
     
    252252       
    253253        inet_addr_t remote;
    254         int rc = async_data_write_finalize(callid, &remote, size);
     254        errno_t rc = async_data_write_finalize(callid, &remote, size);
    255255        if (rc != EOK) {
    256256                async_answer_0(callid, rc);
     
    314314        }
    315315       
    316         int rc = async_data_write_finalize(callid, &dgram.src, size);
     316        errno_t rc = async_data_write_finalize(callid, &dgram.src, size);
    317317        if (rc != EOK) {
    318318                async_answer_0(callid, rc);
     
    445445}
    446446
    447 int inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
     447errno_t inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
    448448{
    449449        async_exch_t *exch = async_exchange_begin(client->sess);
     
    457457            dgram->iplink, &answer);
    458458
    459         int rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
     459        errno_t rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
    460460        if (rc != EOK) {
    461461                async_exchange_end(exch);
     
    480480        }
    481481
    482         int retval;
     482        errno_t retval;
    483483        async_wait_for(req, &retval);
    484484
     
    486486}
    487487
    488 int inet_recv_dgram_local(inet_dgram_t *dgram, uint8_t proto)
     488errno_t inet_recv_dgram_local(inet_dgram_t *dgram, uint8_t proto)
    489489{
    490490        inet_client_t *client;
     
    509509}
    510510
    511 int inet_recv_packet(inet_packet_t *packet)
     511errno_t inet_recv_packet(inet_packet_t *packet)
    512512{
    513513        inet_addrobj_t *addr;
     
    543543int main(int argc, char *argv[])
    544544{
    545         int rc;
     545        errno_t rc;
    546546
    547547        printf(NAME ": HelenOS Internet Protocol service\n");
Note: See TracChangeset for help on using the changeset viewer.