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/generic/remote_usbhc.c

    r36f0738 rb7fd2a0  
    9696} usbhc_iface_funcs_t;
    9797
    98 int usbhc_read(async_exch_t *exch, usb_address_t address,
     98errno_t usbhc_read(async_exch_t *exch, usb_address_t address,
    9999    usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
    100100    size_t *rec_size)
     
    131131
    132132        /* Wait for the answer. */
    133         int data_request_rc;
    134         int opening_request_rc;
     133        errno_t data_request_rc;
     134        errno_t opening_request_rc;
    135135        async_wait_for(data_request, &data_request_rc);
    136136        async_wait_for(opening_request, &opening_request_rc);
     
    139139                /* Prefer the return code of the opening request. */
    140140                if (opening_request_rc != EOK) {
    141                         return (int) opening_request_rc;
     141                        return (errno_t) opening_request_rc;
    142142                } else {
    143                         return (int) data_request_rc;
     143                        return (errno_t) data_request_rc;
    144144                }
    145145        }
    146146        if (opening_request_rc != EOK) {
    147                 return (int) opening_request_rc;
     147                return (errno_t) opening_request_rc;
    148148        }
    149149
     
    152152}
    153153
    154 int usbhc_write(async_exch_t *exch, usb_address_t address,
     154errno_t usbhc_write(async_exch_t *exch, usb_address_t address,
    155155    usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
    156156{
     
    174174        /* Send the data if any. */
    175175        if (size > 0) {
    176                 const int ret = async_data_write_start(exch, data, size);
     176                const errno_t ret = async_data_write_start(exch, data, size);
    177177                if (ret != EOK) {
    178178                        async_forget(opening_request);
     
    182182
    183183        /* Wait for the answer. */
    184         int opening_request_rc;
     184        errno_t opening_request_rc;
    185185        async_wait_for(opening_request, &opening_request_rc);
    186186
    187         return (int) opening_request_rc;
     187        return (errno_t) opening_request_rc;
    188188}
    189189
     
    235235}
    236236
    237 static void callback_out(int outcome, void *arg)
     237static void callback_out(errno_t outcome, void *arg)
    238238{
    239239        async_transaction_t *trans = arg;
     
    244244}
    245245
    246 static void callback_in(int outcome, size_t actual_size, void *arg)
     246static void callback_in(errno_t outcome, size_t actual_size, void *arg)
    247247{
    248248        async_transaction_t *trans = (async_transaction_t *)arg;
     
    306306        }
    307307
    308         const int rc = hc_iface->read(
     308        const errno_t rc = hc_iface->read(
    309309            fun, target, setup, trans->buffer, size, callback_in, trans);
    310310
     
    344344        size_t size = 0;
    345345        if (data_buffer_len > 0) {
    346                 const int rc = async_data_write_accept(&trans->buffer, false,
     346                const errno_t rc = async_data_write_accept(&trans->buffer, false,
    347347                    1, USB_MAX_PAYLOAD_SIZE,
    348348                    0, &size);
     
    355355        }
    356356
    357         const int rc = hc_iface->write(
     357        const errno_t rc = hc_iface->write(
    358358            fun, target, setup, trans->buffer, size, callback_out, trans);
    359359
Note: See TracChangeset for help on using the changeset viewer.