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

    r36f0738 rb7fd2a0  
    9595extern void usb_dev_disconnect(usb_dev_session_t *);
    9696
    97 extern int usb_get_my_interface(async_exch_t *, int *);
    98 extern int usb_get_my_device_handle(async_exch_t *, devman_handle_t *);
     97extern errno_t usb_get_my_interface(async_exch_t *, int *);
     98extern errno_t usb_get_my_device_handle(async_exch_t *, devman_handle_t *);
    9999
    100 extern int usb_reserve_default_address(async_exch_t *, usb_speed_t);
    101 extern int usb_release_default_address(async_exch_t *);
     100extern errno_t usb_reserve_default_address(async_exch_t *, usb_speed_t);
     101extern errno_t usb_release_default_address(async_exch_t *);
    102102
    103 extern int usb_device_enumerate(async_exch_t *, unsigned port);
    104 extern int usb_device_remove(async_exch_t *, unsigned port);
     103extern errno_t usb_device_enumerate(async_exch_t *, unsigned port);
     104extern errno_t usb_device_remove(async_exch_t *, unsigned port);
    105105
    106 extern int usb_register_endpoint(async_exch_t *, usb_endpoint_t,
     106extern errno_t usb_register_endpoint(async_exch_t *, usb_endpoint_t,
    107107    usb_transfer_type_t, usb_direction_t, size_t, unsigned, unsigned);
    108 extern int usb_unregister_endpoint(async_exch_t *, usb_endpoint_t,
     108extern errno_t usb_unregister_endpoint(async_exch_t *, usb_endpoint_t,
    109109    usb_direction_t);
    110 extern int usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t,
     110extern errno_t usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t,
    111111    size_t *);
    112 extern int usb_write(async_exch_t *, usb_endpoint_t, uint64_t, const void *,
     112extern errno_t usb_write(async_exch_t *, usb_endpoint_t, uint64_t, const void *,
    113113    size_t);
    114114
    115115/** Callback for outgoing transfer. */
    116 typedef void (*usb_iface_transfer_out_callback_t)(int, void *);
     116typedef void (*usb_iface_transfer_out_callback_t)(errno_t, void *);
    117117
    118118/** Callback for incoming transfer. */
    119 typedef void (*usb_iface_transfer_in_callback_t)(int, size_t, void *);
     119typedef void (*usb_iface_transfer_in_callback_t)(errno_t, size_t, void *);
    120120
    121121/** USB device communication interface. */
    122122typedef struct {
    123         int (*get_my_interface)(ddf_fun_t *, int *);
    124         int (*get_my_device_handle)(ddf_fun_t *, devman_handle_t *);
     123        errno_t (*get_my_interface)(ddf_fun_t *, int *);
     124        errno_t (*get_my_device_handle)(ddf_fun_t *, devman_handle_t *);
    125125
    126         int (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
    127         int (*release_default_address)(ddf_fun_t *);
     126        errno_t (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
     127        errno_t (*release_default_address)(ddf_fun_t *);
    128128
    129         int (*device_enumerate)(ddf_fun_t *, unsigned);
    130         int (*device_remove)(ddf_fun_t *, unsigned);
     129        errno_t (*device_enumerate)(ddf_fun_t *, unsigned);
     130        errno_t (*device_remove)(ddf_fun_t *, unsigned);
    131131
    132         int (*register_endpoint)(ddf_fun_t *, usb_endpoint_t,
     132        errno_t (*register_endpoint)(ddf_fun_t *, usb_endpoint_t,
    133133            usb_transfer_type_t, usb_direction_t, size_t, unsigned, unsigned);
    134         int (*unregister_endpoint)(ddf_fun_t *, usb_endpoint_t,
     134        errno_t (*unregister_endpoint)(ddf_fun_t *, usb_endpoint_t,
    135135            usb_direction_t);
    136136
    137         int (*read)(ddf_fun_t *, usb_endpoint_t, uint64_t, uint8_t *, size_t,
     137        errno_t (*read)(ddf_fun_t *, usb_endpoint_t, uint64_t, uint8_t *, size_t,
    138138            usb_iface_transfer_in_callback_t, void *);
    139         int (*write)(ddf_fun_t *, usb_endpoint_t, uint64_t, const uint8_t *,
     139        errno_t (*write)(ddf_fun_t *, usb_endpoint_t, uint64_t, const uint8_t *,
    140140            size_t, usb_iface_transfer_out_callback_t, void *);
    141141} usb_iface_t;
Note: See TracChangeset for help on using the changeset viewer.