Changeset b7fd2a0 in mainline for uspace/lib/nic/src/nic_driver.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/lib/nic/src/nic_driver.c

    r36f0738 rb7fd2a0  
    6161 * @param name  Name of the device/driver (used in logging)
    6262 */
    63 int nic_driver_init(const char *name)
     63errno_t nic_driver_init(const char *name)
    6464{
    6565        list_initialize(&nic_globals.frame_list_cache);
     
    243243 * @return EOK or an error code
    244244 */
    245 int nic_get_resources(nic_t *nic_data, hw_res_list_parsed_t *resources)
     245errno_t nic_get_resources(nic_t *nic_data, hw_res_list_parsed_t *resources)
    246246{
    247247        ddf_dev_t *dev = nic_data->dev;
     
    399399 *  @return EINVAL
    400400 */
    401 int nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
     401errno_t nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
    402402        struct timeval *period)
    403403{
    404         int rc = EOK;
     404        errno_t rc = EOK;
    405405        fibril_rwlock_write_lock(&nic_data->main_lock);
    406406        nic_data->poll_mode = mode;
     
    423423 *
    424424 */
    425 int nic_report_address(nic_t *nic_data, const nic_address_t *address)
     425errno_t nic_report_address(nic_t *nic_data, const nic_address_t *address)
    426426{
    427427        assert(nic_data);
     
    434434        /* Notify NIL layer (and uppper) if bound - not in add_device */
    435435        if (nic_data->client_session != NULL) {
    436                 int rc = nic_ev_addr_changed(nic_data->client_session,
     436                errno_t rc = nic_ev_addr_changed(nic_data->client_session,
    437437                    address);
    438438
     
    450450         * calls this should not happen.
    451451         */
    452         int rc = nic_rxc_set_addr(&nic_data->rx_control,
     452        errno_t rc = nic_rxc_set_addr(&nic_data->rx_control,
    453453            &nic_data->mac, address);
    454454       
     
    808808 * @return ENOENT
    809809 */
    810 int nic_query_vlan_mask(const nic_t *nic_data, nic_vlan_mask_t *mask)
     810errno_t nic_query_vlan_mask(const nic_t *nic_data, nic_vlan_mask_t *mask)
    811811{
    812812        assert(mask);
     
    10391039 *  @return 0, never reached
    10401040 */
    1041 static int period_fibril_fun(void *data)
     1041static errno_t period_fibril_fun(void *data)
    10421042{
    10431043        nic_t *nic = data;
Note: See TracChangeset for help on using the changeset viewer.