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

    r36f0738 rb7fd2a0  
    117117
    118118/** Decode subnet mask into subnet prefix length. */
    119 static int subnet_mask_decode(uint32_t mask, int *bits)
     119static errno_t subnet_mask_decode(uint32_t mask, int *bits)
    120120{
    121121        int zbits;
     
    148148}
    149149
    150 static int dhcp_send_discover(dhcp_link_t *dlink)
     150static errno_t dhcp_send_discover(dhcp_link_t *dlink)
    151151{
    152152        dhcp_hdr_t *hdr = (dhcp_hdr_t *)msgbuf;
     
    171171}
    172172
    173 static int dhcp_send_request(dhcp_link_t *dlink, dhcp_offer_t *offer)
     173static errno_t dhcp_send_request(dhcp_link_t *dlink, dhcp_offer_t *offer)
    174174{
    175175        dhcp_hdr_t *hdr = (dhcp_hdr_t *)msgbuf;
     
    212212}
    213213
    214 static int dhcp_parse_reply(void *msg, size_t size, dhcp_offer_t *offer)
     214static errno_t dhcp_parse_reply(void *msg, size_t size, dhcp_offer_t *offer)
    215215{
    216216        dhcp_hdr_t *hdr = (dhcp_hdr_t *)msg;
     
    225225        uint8_t opt_type, opt_len;
    226226        uint8_t *msgb;
    227         int rc;
     227        errno_t rc;
    228228        size_t i;
    229229
     
    360360}
    361361
    362 static int dhcp_cfg_create(service_id_t iplink, dhcp_offer_t *offer)
    363 {
    364         int rc;
     362static errno_t dhcp_cfg_create(service_id_t iplink, dhcp_offer_t *offer)
     363{
     364        errno_t rc;
    365365        service_id_t addr_id;
    366366        service_id_t sroute_id;
     
    420420}
    421421
    422 static int dhcp_discover_proc(dhcp_link_t *dlink)
     422static errno_t dhcp_discover_proc(dhcp_link_t *dlink)
    423423{
    424424        dlink->state = ds_selecting;
    425425
    426         int rc = dhcp_send_discover(dlink);
     426        errno_t rc = dhcp_send_discover(dlink);
    427427        if (rc != EOK)
    428428                return EIO;
     
    438438}
    439439
    440 int dhcpsrv_link_add(service_id_t link_id)
     440errno_t dhcpsrv_link_add(service_id_t link_id)
    441441{
    442442        dhcp_link_t *dlink;
    443         int rc;
     443        errno_t rc;
    444444
    445445        log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
     
    498498}
    499499
    500 int dhcpsrv_link_remove(service_id_t link_id)
     500errno_t dhcpsrv_link_remove(service_id_t link_id)
    501501{
    502502        return ENOTSUP;
    503503}
    504504
    505 int dhcpsrv_discover(service_id_t link_id)
     505errno_t dhcpsrv_discover(service_id_t link_id)
    506506{
    507507        log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
     
    520520static void dhcpsrv_recv_offer(dhcp_link_t *dlink, dhcp_offer_t *offer)
    521521{
    522         int rc;
     522        errno_t rc;
    523523
    524524        if (dlink->state != ds_selecting) {
     
    546546static void dhcpsrv_recv_ack(dhcp_link_t *dlink, dhcp_offer_t *offer)
    547547{
    548         int rc;
     548        errno_t rc;
    549549
    550550        if (dlink->state != ds_requesting) {
     
    572572        dhcp_link_t *dlink = (dhcp_link_t *)arg;
    573573        dhcp_offer_t offer;
    574         int rc;
     574        errno_t rc;
    575575
    576576        log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: dhcpsrv_recv() %zu bytes",
     
    600600{
    601601        dhcp_link_t *dlink = (dhcp_link_t *)arg;
    602         int rc;
     602        errno_t rc;
    603603
    604604        assert(dlink->state == ds_selecting);
     
    628628{
    629629        dhcp_link_t *dlink = (dhcp_link_t *)arg;
    630         int rc;
     630        errno_t rc;
    631631
    632632        assert(dlink->state == ds_requesting);
Note: See TracChangeset for help on using the changeset viewer.