Changeset b7fd2a0 in mainline for uspace/app/vuhid


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/app/vuhid
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/vuhid/device.c

    r36f0738 rb7fd2a0  
    4141#include <usb/classes/classes.h>
    4242
    43 static int on_data_from_device(usbvirt_device_t *dev,
     43static errno_t on_data_from_device(usbvirt_device_t *dev,
    4444    usb_endpoint_t ep, usb_transfer_type_t tr_type,
    4545    void *data, size_t data_size, size_t *actual_size)
     
    5858}
    5959
    60 static int on_data_to_device(usbvirt_device_t *dev,
     60static errno_t on_data_to_device(usbvirt_device_t *dev,
    6161    usb_endpoint_t ep, usb_transfer_type_t tr_type,
    6262    const void *data, size_t data_size)
     
    7575}
    7676
    77 static int interface_life_fibril(void *arg)
     77static errno_t interface_life_fibril(void *arg)
    7878{
    7979        vuhid_interface_t *iface = arg;
     
    109109}
    110110
    111 int add_interface_by_id(vuhid_interface_t **interfaces, const char *id,
     111errno_t add_interface_by_id(vuhid_interface_t **interfaces, const char *id,
    112112    usbvirt_device_t *dev)
    113113{
     
    161161
    162162        /* From now on, in case of errors, we goto to error_leave */
    163         int rc;
     163        errno_t rc;
    164164
    165165        /*
  • uspace/app/vuhid/hids/bootkbd.c

    r36f0738 rb7fd2a0  
    101101};
    102102
    103 static int on_data_out(vuhid_interface_t *iface,
     103static errno_t on_data_out(vuhid_interface_t *iface,
    104104    const void *buffer, size_t buffer_size)
    105105{
  • uspace/app/vuhid/life.c

    r36f0738 rb7fd2a0  
    5656
    5757
    58 int interface_live_on_data_in(vuhid_interface_t *iface,
     58errno_t interface_live_on_data_in(vuhid_interface_t *iface,
    5959    void *buffer, size_t buffer_size, size_t *act_buffer_size)
    6060{
  • uspace/app/vuhid/main.c

    r36f0738 rb7fd2a0  
    216216        /* Determine which interfaces to initialize. */
    217217        for (int i = optind; i < argc; i++) {
    218                 int rc = add_interface_by_id(available_hid_interfaces, argv[i],
     218                errno_t rc = add_interface_by_id(available_hid_interfaces, argv[i],
    219219                    &hid_dev);
    220220                if (rc != EOK) {
     
    234234        }
    235235
    236         const int rc = usbvirt_device_plug(&hid_dev, controller);
     236        const errno_t rc = usbvirt_device_plug(&hid_dev, controller);
    237237        if (rc != EOK) {
    238238                printf("Unable to start communication with VHCD `%s': %s.\n",
  • uspace/app/vuhid/stdreq.c

    r36f0738 rb7fd2a0  
    4343        vuhid_data_t *vuhid = device->device_data
    4444
    45 int req_get_descriptor(usbvirt_device_t *device,
     45errno_t req_get_descriptor(usbvirt_device_t *device,
    4646    const usb_device_request_setup_packet_t *setup_packet,
    4747    uint8_t *data, size_t *act_size)
     
    7070}
    7171
    72 int req_set_protocol(usbvirt_device_t *device,
     72errno_t req_set_protocol(usbvirt_device_t *device,
    7373    const usb_device_request_setup_packet_t *setup_packet,
    7474    uint8_t *data, size_t *act_size)
     
    8989}
    9090
    91 int req_set_report(usbvirt_device_t *device,
     91errno_t req_set_report(usbvirt_device_t *device,
    9292    const usb_device_request_setup_packet_t *setup_packet,
    9393    uint8_t *data, size_t *act_size)
     
    109109
    110110        /* SET_REPORT is translated to data out */
    111         int rc = iface->on_data_out(iface, data, data_length);
     111        errno_t rc = iface->on_data_out(iface, data, data_length);
    112112
    113113        return rc;
  • uspace/app/vuhid/stdreq.h

    r36f0738 rb7fd2a0  
    3838#include <usbvirt/device.h>
    3939
    40 int req_get_descriptor(usbvirt_device_t *device,
     40errno_t req_get_descriptor(usbvirt_device_t *device,
    4141    const usb_device_request_setup_packet_t *setup_packet,
    4242    uint8_t *data, size_t *act_size);
    4343
    44 int req_set_protocol(usbvirt_device_t *device,
     44errno_t req_set_protocol(usbvirt_device_t *device,
    4545    const usb_device_request_setup_packet_t *setup_packet,
    4646    uint8_t *data, size_t *act_size);
    4747
    48 int req_set_report(usbvirt_device_t *device,
     48errno_t req_set_report(usbvirt_device_t *device,
    4949    const usb_device_request_setup_packet_t *setup_packet,
    5050    uint8_t *data, size_t *act_size);
  • uspace/app/vuhid/virthid.h

    r36f0738 rb7fd2a0  
    7070        size_t out_data_size;
    7171
    72         int (*on_data_in)(vuhid_interface_t *, void *, size_t, size_t *);
    73         int (*on_data_out)(vuhid_interface_t *, const void *, size_t);
     72        errno_t (*on_data_in)(vuhid_interface_t *, void *, size_t, size_t *);
     73        errno_t (*on_data_out)(vuhid_interface_t *, const void *, size_t);
    7474        void (*live)(vuhid_interface_t *);
    7575
     
    114114} __attribute__ ((packed)) hid_descriptor_t;
    115115
    116 int add_interface_by_id(vuhid_interface_t **, const char *, usbvirt_device_t *);
     116errno_t add_interface_by_id(vuhid_interface_t **, const char *, usbvirt_device_t *);
    117117void wait_for_interfaces_death(usbvirt_device_t *);
    118118
    119119void interface_life_live(vuhid_interface_t *);
    120 int interface_live_on_data_in(vuhid_interface_t *, void *, size_t, size_t *);
     120errno_t interface_live_on_data_in(vuhid_interface_t *, void *, size_t, size_t *);
    121121
    122122
Note: See TracChangeset for help on using the changeset viewer.