Changeset b7fd2a0 in mainline for uspace/srv/bd/sata_bd/sata_bd.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/srv/bd/sata_bd/sata_bd.c

    r36f0738 rb7fd2a0  
    6060static int disk_count;
    6161
    62 static int sata_bd_open(bd_srvs_t *, bd_srv_t *);
    63 static int sata_bd_close(bd_srv_t *);
    64 static int sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
    65 static int sata_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
    66 static int sata_bd_get_block_size(bd_srv_t *, size_t *);
    67 static int sata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
     62static errno_t sata_bd_open(bd_srvs_t *, bd_srv_t *);
     63static errno_t sata_bd_close(bd_srv_t *);
     64static errno_t sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
     65static errno_t sata_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
     66static errno_t sata_bd_get_block_size(bd_srv_t *, size_t *);
     67static errno_t sata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
    6868
    6969static bd_ops_t sata_bd_ops = {
     
    8888 *
    8989 */
    90 static int scan_device_tree(devman_handle_t funh)
     90static errno_t scan_device_tree(devman_handle_t funh)
    9191{
    9292        devman_handle_t devh;
    9393        devman_handle_t *cfuns;
    9494        size_t count, i;
    95         int rc;
     95        errno_t rc;
    9696               
    9797        /* If device is SATA, add device to the disk array. */
     
    148148 *
    149149 */
    150 static int get_sata_disks(void)
     150static errno_t get_sata_disks(void)
    151151{
    152152        devman_handle_t root_fun;
    153         int rc;
     153        errno_t rc;
    154154       
    155155        disk_count = 0;
     
    190190
    191191/** Open device. */
    192 static int sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
     192static errno_t sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
    193193{
    194194        return EOK;
     
    196196
    197197/** Close device. */
    198 static int sata_bd_close(bd_srv_t *bd)
     198static errno_t sata_bd_close(bd_srv_t *bd)
    199199{
    200200        return EOK;
     
    202202
    203203/** Read blocks from partition. */
    204 static int sata_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
     204static errno_t sata_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
    205205    size_t size)
    206206{
     
    214214
    215215/** Write blocks to partition. */
    216 static int sata_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     216static errno_t sata_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
    217217    const void *buf, size_t size)
    218218{
     
    226226
    227227/** Get device block size. */
    228 static int sata_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
     228static errno_t sata_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
    229229{
    230230        sata_bd_dev_t *sbd = bd_srv_sata(bd);
     
    235235
    236236/** Get number of blocks on device. */
    237 static int sata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
     237static errno_t sata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
    238238{
    239239        sata_bd_dev_t *sbd = bd_srv_sata(bd);
     
    246246int main(int argc, char **argv)
    247247{
    248         int rc;
     248        errno_t rc;
    249249        category_id_t disk_cat;
    250250       
Note: See TracChangeset for help on using the changeset viewer.