Changeset b7fd2a0 in mainline for uspace/lib/drv/include/ops/nic.h


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/drv/include/ops/nic.h

    r36f0738 rb7fd2a0  
    4444typedef struct nic_iface {
    4545        /** Mandatory methods */
    46         int (*send_frame)(ddf_fun_t *, void *, size_t);
    47         int (*callback_create)(ddf_fun_t *);
    48         int (*get_state)(ddf_fun_t *, nic_device_state_t *);
    49         int (*set_state)(ddf_fun_t *, nic_device_state_t);
    50         int (*get_address)(ddf_fun_t *, nic_address_t *);
     46        errno_t (*send_frame)(ddf_fun_t *, void *, size_t);
     47        errno_t (*callback_create)(ddf_fun_t *);
     48        errno_t (*get_state)(ddf_fun_t *, nic_device_state_t *);
     49        errno_t (*set_state)(ddf_fun_t *, nic_device_state_t);
     50        errno_t (*get_address)(ddf_fun_t *, nic_address_t *);
    5151       
    5252        /** Optional methods */
    53         int (*set_address)(ddf_fun_t *, const nic_address_t *);
    54         int (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
    55         int (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
    56         int (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
     53        errno_t (*set_address)(ddf_fun_t *, const nic_address_t *);
     54        errno_t (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
     55        errno_t (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
     56        errno_t (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
    5757       
    58         int (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
     58        errno_t (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
    5959            nic_role_t *);
    60         int (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
     60        errno_t (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
    6161            nic_role_t);
    62         int (*autoneg_enable)(ddf_fun_t *, uint32_t);
    63         int (*autoneg_disable)(ddf_fun_t *);
    64         int (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
     62        errno_t (*autoneg_enable)(ddf_fun_t *, uint32_t);
     63        errno_t (*autoneg_disable)(ddf_fun_t *);
     64        errno_t (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
    6565            nic_result_t *, nic_result_t *);
    66         int (*autoneg_restart)(ddf_fun_t *);
    67         int (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
     66        errno_t (*autoneg_restart)(ddf_fun_t *);
     67        errno_t (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
    6868                uint16_t *);
    69         int (*set_pause)(ddf_fun_t *, int, int, uint16_t);
     69        errno_t (*set_pause)(ddf_fun_t *, int, int, uint16_t);
    7070       
    71         int (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
     71        errno_t (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
    7272            nic_address_t *, size_t *);
    73         int (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
     73        errno_t (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
    7474            const nic_address_t *, size_t);
    75         int (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
     75        errno_t (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
    7676            nic_address_t *, size_t *);
    77         int (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
     77        errno_t (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
    7878            const nic_address_t *, size_t);
    79         int (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
    80         int (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
    81         int (*defective_get_mode)(ddf_fun_t *, uint32_t *);
    82         int (*defective_set_mode)(ddf_fun_t *, uint32_t);
    83         int (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
     79        errno_t (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
     80        errno_t (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
     81        errno_t (*defective_get_mode)(ddf_fun_t *, uint32_t *);
     82        errno_t (*defective_set_mode)(ddf_fun_t *, uint32_t);
     83        errno_t (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
    8484            size_t *);
    85         int (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
     85        errno_t (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
    8686       
    87         int (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
    88         int (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
    89         int (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
     87        errno_t (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
     88        errno_t (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
     89        errno_t (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
    9090       
    91         int (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
     91        errno_t (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
    9292            size_t, nic_wv_id_t *);
    93         int (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
    94         int (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
     93        errno_t (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
     94        errno_t (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
    9595            size_t, void *, size_t *);
    96         int (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
     96        errno_t (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
    9797            nic_wv_id_t *, size_t *);
    98         int (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
    99         int (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
     98        errno_t (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
     99        errno_t (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
    100100            uint8_t *, size_t *);
    101101       
    102         int (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
    103         int (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
     102        errno_t (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
     103        errno_t (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
    104104       
    105         int (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
     105        errno_t (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
    106106            struct timeval *);
    107         int (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
     107        errno_t (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
    108108            const struct timeval *);
    109         int (*poll_now)(ddf_fun_t *);
     109        errno_t (*poll_now)(ddf_fun_t *);
    110110} nic_iface_t;
    111111
Note: See TracChangeset for help on using the changeset viewer.