Changeset b7fd2a0 in mainline for uspace/lib/nic/include/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/nic/include/nic.h

    r36f0738 rb7fd2a0  
    9595 * @return error code on error.
    9696 */
    97 typedef int (*state_change_handler)(nic_t *);
     97typedef errno_t (*state_change_handler)(nic_t *);
    9898
    9999/**
     
    108108 * @return ENOTSUP      If this mode is not supported
    109109 */
    110 typedef int (*unicast_mode_change_handler)(nic_t *,
     110typedef errno_t (*unicast_mode_change_handler)(nic_t *,
    111111    nic_unicast_mode_t, const nic_address_t *, size_t);
    112112
     
    122122 * @return ENOTSUP      If this mode is not supported
    123123 */
    124 typedef int (*multicast_mode_change_handler)(nic_t *,
     124typedef errno_t (*multicast_mode_change_handler)(nic_t *,
    125125    nic_multicast_mode_t, const nic_address_t *, size_t);
    126126
     
    134134 * @return ENOTSUP      If this mode is not supported
    135135 */
    136 typedef int (*broadcast_mode_change_handler)(nic_t *, nic_broadcast_mode_t);
     136typedef errno_t (*broadcast_mode_change_handler)(nic_t *, nic_broadcast_mode_t);
    137137
    138138/**
     
    172172 *                                      limit of these HW filters was reached.
    173173 */
    174 typedef int (*wol_virtue_add_handler)(nic_t *, const nic_wol_virtue_t *);
     174typedef errno_t (*wol_virtue_add_handler)(nic_t *, const nic_wol_virtue_t *);
    175175
    176176/**
     
    195195 * @return EINVAL       If this mode cannot be set up under no circumstances
    196196 */
    197 typedef int (*poll_mode_change_handler)(nic_t *,
     197typedef errno_t (*poll_mode_change_handler)(nic_t *,
    198198    nic_poll_mode_t, const struct timeval *);
    199199
     
    211211
    212212/* Functions called in the main function */
    213 extern int nic_driver_init(const char *);
     213extern errno_t nic_driver_init(const char *);
    214214extern void nic_driver_implement(driver_ops_t *, ddf_dev_ops_t *,
    215215    nic_iface_t *);
    216216
    217217/* Functions called in add_device */
    218 extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *);
     218extern errno_t nic_get_resources(nic_t *, hw_res_list_parsed_t *);
    219219extern void nic_set_specific(nic_t *, void *);
    220220extern void nic_set_send_frame_handler(nic_t *, send_frame_handler);
     
    239239extern nic_device_state_t nic_query_state(nic_t *);
    240240extern void nic_set_tx_busy(nic_t *, int);
    241 extern int nic_report_address(nic_t *, const nic_address_t *);
    242 extern int nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timeval *);
     241extern errno_t nic_report_address(nic_t *, const nic_address_t *);
     242extern errno_t nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timeval *);
    243243extern void nic_query_address(nic_t *, nic_address_t *);
    244244extern void nic_received_frame(nic_t *, nic_frame_t *);
     
    268268extern void nic_query_blocked_sources(const nic_t *,
    269269    size_t, nic_address_t *, size_t *);
    270 extern int nic_query_vlan_mask(const nic_t *, nic_vlan_mask_t *);
     270extern errno_t nic_query_vlan_mask(const nic_t *, nic_vlan_mask_t *);
    271271extern int nic_query_wol_max_caps(const nic_t *, nic_wv_type_t);
    272272extern void nic_set_wol_max_caps(nic_t *, nic_wv_type_t, int);
Note: See TracChangeset for help on using the changeset viewer.