Changeset b7fd2a0 in mainline for uspace/lib/nic/include


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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.

Location:
uspace/lib/nic/include
Files:
6 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);
  • uspace/lib/nic/include/nic_addr_db.h

    r36f0738 rb7fd2a0  
    5555
    5656
    57 extern int nic_addr_db_init(nic_addr_db_t *db, size_t addr_len);
     57extern errno_t nic_addr_db_init(nic_addr_db_t *db, size_t addr_len);
    5858extern void nic_addr_db_clear(nic_addr_db_t *db);
    5959extern void nic_addr_db_destroy(nic_addr_db_t *db);
    60 extern int nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr);
    61 extern int nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr);
     60extern errno_t nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr);
     61extern errno_t nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr);
    6262extern bool nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr);
    6363extern void nic_addr_db_foreach(const nic_addr_db_t *db,
  • uspace/lib/nic/include/nic_ev.h

    r36f0738 rb7fd2a0  
    4343#include <stddef.h>
    4444
    45 extern int nic_ev_addr_changed(async_sess_t *, const nic_address_t *);
    46 extern int nic_ev_device_state(async_sess_t *, sysarg_t);
    47 extern int nic_ev_received(async_sess_t *, void *, size_t);
     45extern errno_t nic_ev_addr_changed(async_sess_t *, const nic_address_t *);
     46extern errno_t nic_ev_device_state(async_sess_t *, sysarg_t);
     47extern errno_t nic_ev_received(async_sess_t *, void *, size_t);
    4848
    4949#endif
  • uspace/lib/nic/include/nic_impl.h

    r36f0738 rb7fd2a0  
    4646 * inject some adaptation layer between the DDF call and NICF implementation */
    4747
    48 extern int nic_get_address_impl(ddf_fun_t *dev_fun, nic_address_t *address);
    49 extern int nic_send_frame_impl(ddf_fun_t *dev_fun, void *data, size_t size);
    50 extern int nic_callback_create_impl(ddf_fun_t *dev_fun);
    51 extern int nic_get_state_impl(ddf_fun_t *dev_fun, nic_device_state_t *state);
    52 extern int nic_set_state_impl(ddf_fun_t *dev_fun, nic_device_state_t state);
    53 extern int nic_get_stats_impl(ddf_fun_t *dev_fun, nic_device_stats_t *stats);
    54 extern int nic_unicast_get_mode_impl(ddf_fun_t *dev_fun,
     48extern errno_t nic_get_address_impl(ddf_fun_t *dev_fun, nic_address_t *address);
     49extern errno_t nic_send_frame_impl(ddf_fun_t *dev_fun, void *data, size_t size);
     50extern errno_t nic_callback_create_impl(ddf_fun_t *dev_fun);
     51extern errno_t nic_get_state_impl(ddf_fun_t *dev_fun, nic_device_state_t *state);
     52extern errno_t nic_set_state_impl(ddf_fun_t *dev_fun, nic_device_state_t state);
     53extern errno_t nic_get_stats_impl(ddf_fun_t *dev_fun, nic_device_stats_t *stats);
     54extern errno_t nic_unicast_get_mode_impl(ddf_fun_t *dev_fun,
    5555    nic_unicast_mode_t *, size_t, nic_address_t *, size_t *);
    56 extern int nic_unicast_set_mode_impl(ddf_fun_t *dev_fun,
     56extern errno_t nic_unicast_set_mode_impl(ddf_fun_t *dev_fun,
    5757    nic_unicast_mode_t, const nic_address_t *, size_t);
    58 extern int nic_multicast_get_mode_impl(ddf_fun_t *dev_fun,
     58extern errno_t nic_multicast_get_mode_impl(ddf_fun_t *dev_fun,
    5959    nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
    60 extern int nic_multicast_set_mode_impl(ddf_fun_t *dev_fun,
     60extern errno_t nic_multicast_set_mode_impl(ddf_fun_t *dev_fun,
    6161    nic_multicast_mode_t, const nic_address_t *, size_t);
    62 extern int nic_broadcast_get_mode_impl(ddf_fun_t *, nic_broadcast_mode_t *);
    63 extern int nic_broadcast_set_mode_impl(ddf_fun_t *, nic_broadcast_mode_t);
    64 extern int nic_blocked_sources_get_impl(ddf_fun_t *,
     62extern errno_t nic_broadcast_get_mode_impl(ddf_fun_t *, nic_broadcast_mode_t *);
     63extern errno_t nic_broadcast_set_mode_impl(ddf_fun_t *, nic_broadcast_mode_t);
     64extern errno_t nic_blocked_sources_get_impl(ddf_fun_t *,
    6565    size_t, nic_address_t *, size_t *);
    66 extern int nic_blocked_sources_set_impl(ddf_fun_t *, const nic_address_t *, size_t);
    67 extern int nic_vlan_get_mask_impl(ddf_fun_t *, nic_vlan_mask_t *);
    68 extern int nic_vlan_set_mask_impl(ddf_fun_t *, const nic_vlan_mask_t *);
    69 extern int nic_wol_virtue_add_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
     66extern errno_t nic_blocked_sources_set_impl(ddf_fun_t *, const nic_address_t *, size_t);
     67extern errno_t nic_vlan_get_mask_impl(ddf_fun_t *, nic_vlan_mask_t *);
     68extern errno_t nic_vlan_set_mask_impl(ddf_fun_t *, const nic_vlan_mask_t *);
     69extern errno_t nic_wol_virtue_add_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
    7070    const void *data, size_t length, nic_wv_id_t *new_id);
    71 extern int nic_wol_virtue_remove_impl(ddf_fun_t *dev_fun, nic_wv_id_t id);
    72 extern int nic_wol_virtue_probe_impl(ddf_fun_t *dev_fun, nic_wv_id_t id,
     71extern errno_t nic_wol_virtue_remove_impl(ddf_fun_t *dev_fun, nic_wv_id_t id);
     72extern errno_t nic_wol_virtue_probe_impl(ddf_fun_t *dev_fun, nic_wv_id_t id,
    7373    nic_wv_type_t *type, size_t max_length, void *data, size_t *length);
    74 extern int nic_wol_virtue_list_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
     74extern errno_t nic_wol_virtue_list_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
    7575    size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
    76 extern int nic_wol_virtue_get_caps_impl(ddf_fun_t *, nic_wv_type_t, int *);
    77 extern int nic_poll_get_mode_impl(ddf_fun_t *,
     76extern errno_t nic_wol_virtue_get_caps_impl(ddf_fun_t *, nic_wv_type_t, int *);
     77extern errno_t nic_poll_get_mode_impl(ddf_fun_t *,
    7878    nic_poll_mode_t *, struct timeval *);
    79 extern int nic_poll_set_mode_impl(ddf_fun_t *,
     79extern errno_t nic_poll_set_mode_impl(ddf_fun_t *,
    8080    nic_poll_mode_t, const struct timeval *);
    81 extern int nic_poll_now_impl(ddf_fun_t *);
     81extern errno_t nic_poll_now_impl(ddf_fun_t *);
    8282
    8383extern void nic_default_handler_impl(ddf_fun_t *dev_fun,
    8484        ipc_callid_t callid, ipc_call_t *call);
    85 extern int nic_open_impl(ddf_fun_t *fun);
     85extern errno_t nic_open_impl(ddf_fun_t *fun);
    8686extern void nic_close_impl(ddf_fun_t *fun);
    8787
  • uspace/lib/nic/include/nic_rx_control.h

    r36f0738 rb7fd2a0  
    114114} __attribute__ ((packed)) vlan_header_t;
    115115
    116 extern int nic_rxc_init(nic_rxc_t *rxc);
    117 extern int nic_rxc_clear(nic_rxc_t *rxc);
    118 extern int nic_rxc_set_addr(nic_rxc_t *rxc,
     116extern errno_t nic_rxc_init(nic_rxc_t *rxc);
     117extern errno_t nic_rxc_clear(nic_rxc_t *rxc);
     118extern errno_t nic_rxc_set_addr(nic_rxc_t *rxc,
    119119        const nic_address_t *prev_addr, const nic_address_t *curr_addr);
    120120extern bool nic_rxc_check(const nic_rxc_t *rxc,
     
    126126extern void nic_rxc_unicast_get_mode(const nic_rxc_t *, nic_unicast_mode_t *,
    127127        size_t max_count, nic_address_t *address_list, size_t *address_count);
    128 extern int nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
     128extern errno_t nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
    129129        const nic_address_t *address_list, size_t address_count);
    130130extern void nic_rxc_multicast_get_mode(const nic_rxc_t *,
    131131        nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
    132 extern int nic_rxc_multicast_set_mode(nic_rxc_t *, nic_multicast_mode_t mode,
     132extern errno_t nic_rxc_multicast_set_mode(nic_rxc_t *, nic_multicast_mode_t mode,
    133133        const nic_address_t *address_list, size_t address_count);
    134134extern void nic_rxc_broadcast_get_mode(const nic_rxc_t *,
    135135        nic_broadcast_mode_t *mode);
    136 extern int nic_rxc_broadcast_set_mode(nic_rxc_t *,
     136extern errno_t nic_rxc_broadcast_set_mode(nic_rxc_t *,
    137137        nic_broadcast_mode_t mode);
    138138extern void nic_rxc_blocked_sources_get(const nic_rxc_t *,
    139139        size_t max_count, nic_address_t *address_list, size_t *address_count);
    140 extern int nic_rxc_blocked_sources_set(nic_rxc_t *,
     140extern errno_t nic_rxc_blocked_sources_set(nic_rxc_t *,
    141141        const nic_address_t *address_list, size_t address_count);
    142 extern int nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask);
    143 extern int nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask);
     142extern errno_t nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask);
     143extern errno_t nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask);
    144144
    145145#endif
  • uspace/lib/nic/include/nic_wol_virtues.h

    r36f0738 rb7fd2a0  
    7474} nic_wol_virtues_t;
    7575
    76 extern int nic_wol_virtues_init(nic_wol_virtues_t *);
     76extern errno_t nic_wol_virtues_init(nic_wol_virtues_t *);
    7777extern void nic_wol_virtues_clear(nic_wol_virtues_t *);
    78 extern int nic_wol_virtues_verify(nic_wv_type_t, const void *, size_t);
    79 extern int nic_wol_virtues_list(const nic_wol_virtues_t *, nic_wv_type_t type,
     78extern errno_t nic_wol_virtues_verify(nic_wv_type_t, const void *, size_t);
     79extern errno_t nic_wol_virtues_list(const nic_wol_virtues_t *, nic_wv_type_t type,
    8080        size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
    81 extern int nic_wol_virtues_add(nic_wol_virtues_t *, nic_wol_virtue_t *);
     81extern errno_t nic_wol_virtues_add(nic_wol_virtues_t *, nic_wol_virtue_t *);
    8282extern nic_wol_virtue_t *nic_wol_virtues_remove(nic_wol_virtues_t *,
    8383        nic_wv_id_t);
Note: See TracChangeset for help on using the changeset viewer.