Changeset b7fd2a0 in mainline for uspace/drv/nic/ne2k/ne2k.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (6 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/drv/nic/ne2k/ne2k.c

    r36f0738 rb7fd2a0  
    124124static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *);
    125125
    126 static int ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)
     126static errno_t ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)
    127127{
    128128        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
     
    178178}
    179179
    180 static int ne2k_dev_init(nic_t *nic_data)
     180static errno_t ne2k_dev_init(nic_t *nic_data)
    181181{
    182182        /* Get HW resources */
     
    184184        hw_res_list_parsed_init(&hw_res_parsed);
    185185       
    186         int rc = nic_get_resources(nic_data, &hw_res_parsed);
     186        errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
    187187       
    188188        if (rc != EOK)
     
    243243}
    244244
    245 static int ne2k_on_activating(nic_t *nic_data)
     245static errno_t ne2k_on_activating(nic_t *nic_data)
    246246{
    247247        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
    248248
    249249        if (!ne2k->up) {
    250                 int rc = ne2k_up(ne2k);
     250                errno_t rc = ne2k_up(ne2k);
    251251                if (rc != EOK)
    252252                        return rc;
     
    261261}
    262262
    263 static int ne2k_on_stopping(nic_t *nic_data)
     263static errno_t ne2k_on_stopping(nic_t *nic_data)
    264264{
    265265        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
     
    271271}
    272272
    273 static int ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
     273static errno_t ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
    274274{
    275275        nic_t *nic_data = DRIVER_DATA(ddf_fun_get_dev(fun));
    276         int rc = nic_report_address(nic_data, address);
     276        errno_t rc = nic_report_address(nic_data, address);
    277277        if (rc != EOK) {
    278278                return EINVAL;
     
    286286}
    287287
    288 static int ne2k_on_unicast_mode_change(nic_t *nic_data,
     288static errno_t ne2k_on_unicast_mode_change(nic_t *nic_data,
    289289        nic_unicast_mode_t new_mode,
    290290        const nic_address_t *address_list, size_t address_count)
     
    313313}
    314314
    315 static int ne2k_on_multicast_mode_change(nic_t *nic_data,
     315static errno_t ne2k_on_multicast_mode_change(nic_t *nic_data,
    316316        nic_multicast_mode_t new_mode,
    317317        const nic_address_t *address_list, size_t address_count)
     
    339339}
    340340
    341 static int ne2k_on_broadcast_mode_change(nic_t *nic_data,
     341static errno_t ne2k_on_broadcast_mode_change(nic_t *nic_data,
    342342        nic_broadcast_mode_t new_mode)
    343343{
     
    355355}
    356356
    357 static int ne2k_dev_add(ddf_dev_t *dev)
     357static errno_t ne2k_dev_add(ddf_dev_t *dev)
    358358{
    359359        ddf_fun_t *fun;
     
    387387        }
    388388       
    389         int rc = ne2k_dev_init(nic_data);
     389        errno_t rc = ne2k_dev_init(nic_data);
    390390        if (rc != EOK) {
    391391                ne2k_dev_cleanup(dev);
Note: See TracChangeset for help on using the changeset viewer.