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_usbhid.c

    r36f0738 rb7fd2a0  
    9797 *
    9898 */
    99 int usbhid_dev_get_event_length(async_sess_t *dev_sess, size_t *size)
     99errno_t usbhid_dev_get_event_length(async_sess_t *dev_sess, size_t *size)
    100100{
    101101        if (!dev_sess)
     
    105105       
    106106        sysarg_t len;
    107         int rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
     107        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
    108108            IPC_M_USBHID_GET_EVENT_LENGTH, &len);
    109109       
     
    132132 *
    133133 */
    134 int usbhid_dev_get_event(async_sess_t *dev_sess, uint8_t *buf,
     134errno_t usbhid_dev_get_event(async_sess_t *dev_sess, uint8_t *buf,
    135135    size_t size, size_t *actual_size, int *event_nr, unsigned int flags)
    136136{
     
    174174        }
    175175       
    176         int data_request_rc;
    177         int opening_request_rc;
     176        errno_t data_request_rc;
     177        errno_t opening_request_rc;
    178178        async_wait_for(data_request, &data_request_rc);
    179179        async_wait_for(opening_request, &opening_request_rc);
     
    182182                /* Prefer return code of the opening request. */
    183183                if (opening_request_rc != EOK)
    184                         return (int) opening_request_rc;
     184                        return (errno_t) opening_request_rc;
    185185                else
    186                         return (int) data_request_rc;
     186                        return (errno_t) data_request_rc;
    187187        }
    188188       
    189189        if (opening_request_rc != EOK)
    190                 return (int) opening_request_rc;
     190                return (errno_t) opening_request_rc;
    191191       
    192192        size_t act_size = IPC_GET_ARG2(data_request_call);
     
    204204}
    205205
    206 int usbhid_dev_get_report_descriptor_length(async_sess_t *dev_sess,
     206errno_t usbhid_dev_get_report_descriptor_length(async_sess_t *dev_sess,
    207207    size_t *size)
    208208{
     
    213213       
    214214        sysarg_t arg_size;
    215         int rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
     215        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
    216216            IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH, &arg_size);
    217217       
     
    226226}
    227227
    228 int usbhid_dev_get_report_descriptor(async_sess_t *dev_sess, uint8_t *buf,
     228errno_t usbhid_dev_get_report_descriptor(async_sess_t *dev_sess, uint8_t *buf,
    229229    size_t size, size_t *actual_size)
    230230{
     
    259259        }
    260260       
    261         int data_request_rc;
    262         int opening_request_rc;
     261        errno_t data_request_rc;
     262        errno_t opening_request_rc;
    263263        async_wait_for(data_request, &data_request_rc);
    264264        async_wait_for(opening_request, &opening_request_rc);
     
    267267                /* Prefer return code of the opening request. */
    268268                if (opening_request_rc != EOK)
    269                         return (int) opening_request_rc;
     269                        return (errno_t) opening_request_rc;
    270270                else
    271                         return (int) data_request_rc;
     271                        return (errno_t) data_request_rc;
    272272        }
    273273       
    274274        if (opening_request_rc != EOK)
    275                 return (int) opening_request_rc;
     275                return (errno_t) opening_request_rc;
    276276       
    277277        size_t act_size = IPC_GET_ARG2(data_request_call);
     
    362362        }
    363363
    364         int rc;
     364        errno_t rc;
    365365
    366366        uint8_t *data = malloc(len);
     
    438438
    439439        size_t act_len = 0;
    440         int rc = hid_iface->get_report_descriptor(fun, descriptor, len,
     440        errno_t rc = hid_iface->get_report_descriptor(fun, descriptor, len,
    441441            &act_len);
    442442        if (act_len > len) {
Note: See TracChangeset for help on using the changeset viewer.