Changeset b7fd2a0 in mainline for uspace/lib/c/generic/device/hw_res.c


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

    r36f0738 rb7fd2a0  
    3838#include <stdlib.h>
    3939
    40 int hw_res_get_resource_list(async_sess_t *sess,
     40errno_t hw_res_get_resource_list(async_sess_t *sess,
    4141    hw_resource_list_t *hw_resources)
    4242{
     
    4545        async_exch_t *exch = async_exchange_begin(sess);
    4646       
    47         int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     47        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    4848            HW_RES_GET_RESOURCE_LIST, &count);
    4949       
     
    7575}
    7676
    77 int hw_res_enable_interrupt(async_sess_t *sess, int irq)
     77errno_t hw_res_enable_interrupt(async_sess_t *sess, int irq)
    7878{
    7979        async_exch_t *exch = async_exchange_begin(sess);
    8080       
    81         int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     81        errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    8282            HW_RES_ENABLE_INTERRUPT, irq);
    8383        async_exchange_end(exch);
     
    8686}
    8787
    88 int hw_res_disable_interrupt(async_sess_t *sess, int irq)
     88errno_t hw_res_disable_interrupt(async_sess_t *sess, int irq)
    8989{
    9090        async_exch_t *exch = async_exchange_begin(sess);
    9191       
    92         int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     92        errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    9393            HW_RES_DISABLE_INTERRUPT, irq);
    9494        async_exchange_end(exch);
     
    9797}
    9898
    99 int hw_res_clear_interrupt(async_sess_t *sess, int irq)
     99errno_t hw_res_clear_interrupt(async_sess_t *sess, int irq)
    100100{
    101101        async_exch_t *exch = async_exchange_begin(sess);
    102102       
    103         int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     103        errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    104104            HW_RES_CLEAR_INTERRUPT, irq);
    105105        async_exchange_end(exch);
     
    122122 *
    123123 */
    124 int hw_res_dma_channel_setup(async_sess_t *sess,
     124errno_t hw_res_dma_channel_setup(async_sess_t *sess,
    125125    unsigned channel, uint32_t pa, uint32_t size, uint8_t mode)
    126126{
     
    128128       
    129129        const uint32_t packed = (channel & 0xffff) | (mode << 16);
    130         const int ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     130        const errno_t ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    131131            HW_RES_DMA_CHANNEL_SETUP, packed, pa, size);
    132132       
     
    145145 *
    146146 */
    147 int hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel, size_t *rem)
     147errno_t hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel, size_t *rem)
    148148{
    149149        async_exch_t *exch = async_exchange_begin(sess);
    150150       
    151151        sysarg_t remain;
    152         const int ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     152        const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    153153            HW_RES_DMA_CHANNEL_REMAIN, channel, &remain);
    154154       
Note: See TracChangeset for help on using the changeset viewer.