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

    r36f0738 rb7fd2a0  
    5858static uint16_t inetping_ident = 0;
    5959
    60 static int inetping_send(inetping_client_t *client, inetping_sdu_t *sdu)
     60static errno_t inetping_send(inetping_client_t *client, inetping_sdu_t *sdu)
    6161{
    6262        if (sdu->src.version != sdu->dest.version)
     
    7373}
    7474
    75 static int inetping_get_srcaddr(inetping_client_t *client,
     75static errno_t inetping_get_srcaddr(inetping_client_t *client,
    7676    inet_addr_t *remote, inet_addr_t *local)
    7777{
     
    9494}
    9595
    96 int inetping_recv(uint16_t ident, inetping_sdu_t *sdu)
     96errno_t inetping_recv(uint16_t ident, inetping_sdu_t *sdu)
    9797{
    9898        inetping_client_t *client = inetping_client_find(ident);
     
    107107        aid_t req = async_send_1(exch, INETPING_EV_RECV, sdu->seq_no, &answer);
    108108
    109         int rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
     109        errno_t rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
    110110        if (rc != EOK) {
    111111                async_exchange_end(exch);
     
    130130        }
    131131
    132         int retval;
     132        errno_t retval;
    133133        async_wait_for(req, &retval);
    134134
     
    142142
    143143        inetping_sdu_t sdu;
    144         int rc;
     144        errno_t rc;
    145145
    146146        sdu.seq_no = IPC_GET_ARG1(*icall);
     
    222222        }
    223223
    224         int rc = async_data_write_finalize(callid, &remote, size);
     224        errno_t rc = async_data_write_finalize(callid, &remote, size);
    225225        if (rc != EOK) {
    226226                async_answer_0(callid, rc);
     
    254254}
    255255
    256 static int inetping_client_init(inetping_client_t *client)
     256static errno_t inetping_client_init(inetping_client_t *client)
    257257{
    258258        async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
     
    289289
    290290        inetping_client_t client;
    291         int rc = inetping_client_init(&client);
     291        errno_t rc = inetping_client_init(&client);
    292292        if (rc != EOK)
    293293                return;
Note: See TracChangeset for help on using the changeset viewer.