Ignore:
Timestamp:
2018-01-04T20:50:52Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
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.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_ahci.c

    rfacacc71 r46577995  
    6565       
    6666        char devn[MAX_NAME_LENGTH];
    67         int rc = devman_fun_get_name(funh, devn, MAX_NAME_LENGTH);
     67        errno_t rc = devman_fun_get_name(funh, devn, MAX_NAME_LENGTH);
    6868        if (rc != EOK)
    6969                return NULL;
     
    8383}
    8484
    85 int ahci_get_sata_device_name(async_sess_t *sess, size_t sata_dev_name_length,
     85errno_t ahci_get_sata_device_name(async_sess_t *sess, size_t sata_dev_name_length,
    8686    char *sata_dev_name)
    8787{
     
    9595        async_data_read_start(exch, sata_dev_name, sata_dev_name_length);
    9696       
    97         int rc;
     97        errno_t rc;
    9898        async_wait_for(req, &rc);
    9999       
     
    101101}
    102102
    103 int ahci_get_num_blocks(async_sess_t *sess, uint64_t *blocks)
     103errno_t ahci_get_num_blocks(async_sess_t *sess, uint64_t *blocks)
    104104{
    105105        async_exch_t *exch = async_exchange_begin(sess);
     
    109109        sysarg_t blocks_hi;
    110110        sysarg_t blocks_lo;
    111         int rc = async_req_1_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
     111        errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    112112            IPC_M_AHCI_GET_NUM_BLOCKS, &blocks_hi, &blocks_lo);
    113113       
     
    122122}
    123123
    124 int ahci_get_block_size(async_sess_t *sess, size_t *blocks_size)
     124errno_t ahci_get_block_size(async_sess_t *sess, size_t *blocks_size)
    125125{
    126126        async_exch_t *exch = async_exchange_begin(sess);
     
    129129       
    130130        sysarg_t bs;
    131         int rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
     131        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    132132            IPC_M_AHCI_GET_BLOCK_SIZE, &bs);
    133133       
     
    140140}
    141141
    142 int ahci_read_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
     142errno_t ahci_read_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
    143143    void *buf)
    144144{
     
    155155        async_exchange_end(exch);
    156156       
    157         int rc;
     157        errno_t rc;
    158158        async_wait_for(req, &rc);
    159159       
     
    161161}
    162162
    163 int ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
     163errno_t ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
    164164    void* buf)
    165165{
     
    175175        async_exchange_end(exch);
    176176       
    177         int rc;
     177        errno_t rc;
    178178        async_wait_for(req, &rc);
    179179       
     
    227227        }       
    228228       
    229         const int ret = ahci_iface->get_sata_device_name(fun,
     229        const errno_t ret = ahci_iface->get_sata_device_name(fun,
    230230            sata_dev_name_length, sata_dev_name);
    231231       
     
    251251       
    252252        uint64_t blocks;
    253         const int ret = ahci_iface->get_num_blocks(fun, &blocks);
     253        const errno_t ret = ahci_iface->get_num_blocks(fun, &blocks);
    254254       
    255255        if (ret != EOK)
     
    270270       
    271271        size_t blocks;
    272         const int ret = ahci_iface->get_block_size(fun, &blocks);
     272        const errno_t ret = ahci_iface->get_block_size(fun, &blocks);
    273273       
    274274        if (ret != EOK)
     
    302302        const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
    303303       
    304         const int ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
     304        const errno_t ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
    305305       
    306306        async_answer_0(callid, ret);
     
    331331        const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
    332332       
    333         const int ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
     333        const errno_t ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
    334334       
    335335        async_answer_0(callid, ret);
Note: See TracChangeset for help on using the changeset viewer.