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/usbhost/include/usb/host/hcd.h

    r36f0738 rb7fd2a0  
    4949typedef struct hcd hcd_t;
    5050
    51 typedef int (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
    52 typedef int (*ep_add_hook_t)(hcd_t *, endpoint_t *);
     51typedef errno_t (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
     52typedef errno_t (*ep_add_hook_t)(hcd_t *, endpoint_t *);
    5353typedef void (*ep_remove_hook_t)(hcd_t *, endpoint_t *);
    5454typedef void (*interrupt_hook_t)(hcd_t *, uint32_t);
    55 typedef int (*status_hook_t)(hcd_t *, uint32_t *);
     55typedef errno_t (*status_hook_t)(hcd_t *, uint32_t *);
    5656
    5757typedef struct {
     
    102102}
    103103
    104 extern int hcd_request_address(hcd_t *, usb_speed_t, usb_address_t *);
     104extern errno_t hcd_request_address(hcd_t *, usb_speed_t, usb_address_t *);
    105105
    106 extern int hcd_release_address(hcd_t *, usb_address_t);
     106extern errno_t hcd_release_address(hcd_t *, usb_address_t);
    107107
    108 extern int hcd_reserve_default_address(hcd_t *, usb_speed_t);
     108extern errno_t hcd_reserve_default_address(hcd_t *, usb_speed_t);
    109109
    110 static inline int hcd_release_default_address(hcd_t *hcd)
     110static inline errno_t hcd_release_default_address(hcd_t *hcd)
    111111{
    112112        return hcd_release_address(hcd, USB_ADDRESS_DEFAULT);
    113113}
    114114
    115 extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
     115extern errno_t hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
    116116    usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t,
    117117    unsigned int);
    118118
    119 extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
     119extern errno_t hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
    120120
    121 extern int hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *,
     121extern errno_t hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *,
    122122    size_t, uint64_t, usbhc_iface_transfer_in_callback_t,
    123123    usbhc_iface_transfer_out_callback_t, void *, const char *);
    124124
    125 extern int hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t,
     125extern errno_t hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t,
    126126    void *, size_t, uint64_t, const char *, size_t *);
    127127
Note: See TracChangeset for help on using the changeset viewer.