Changeset 46577995 in mainline for uspace/srv/bd/file_bd/file_bd.c


Ignore:
Timestamp:
2018-01-04T20:50:52Z (6 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/srv/bd/file_bd/file_bd.c

    rfacacc71 r46577995  
    6767
    6868static void print_usage(void);
    69 static int file_bd_init(const char *fname);
     69static errno_t file_bd_init(const char *fname);
    7070static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *);
    7171
    72 static int file_bd_open(bd_srvs_t *, bd_srv_t *);
    73 static int file_bd_close(bd_srv_t *);
    74 static int file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
    75 static int file_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
    76 static int file_bd_get_block_size(bd_srv_t *, size_t *);
    77 static int file_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
     72static errno_t file_bd_open(bd_srvs_t *, bd_srv_t *);
     73static errno_t file_bd_close(bd_srv_t *);
     74static errno_t file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
     75static errno_t file_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
     76static errno_t file_bd_get_block_size(bd_srv_t *, size_t *);
     77static errno_t file_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
    7878
    7979static bd_ops_t file_bd_ops = {
     
    8888int main(int argc, char **argv)
    8989{
    90         int rc;
     90        errno_t rc;
    9191        char *image_name;
    9292        char *device_name;
     
    167167}
    168168
    169 static int file_bd_init(const char *fname)
     169static errno_t file_bd_init(const char *fname)
    170170{
    171171        bd_srvs_init(&bd_srvs);
     
    173173       
    174174        async_set_fallback_port_handler(file_bd_connection, NULL);
    175         int rc = loc_server_register(NAME);
     175        errno_t rc = loc_server_register(NAME);
    176176        if (rc != EOK) {
    177177                printf("%s: Unable to register driver.\n", NAME);
     
    207207
    208208/** Open device. */
    209 static int file_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
     209static errno_t file_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
    210210{
    211211        return EOK;
     
    213213
    214214/** Close device. */
    215 static int file_bd_close(bd_srv_t *bd)
     215static errno_t file_bd_close(bd_srv_t *bd)
    216216{
    217217        return EOK;
     
    219219
    220220/** Read blocks from the device. */
    221 static int file_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
     221static errno_t file_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
    222222    size_t size)
    223223{
     
    259259
    260260/** Write blocks to the device. */
    261 static int file_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     261static errno_t file_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
    262262    const void *buf, size_t size)
    263263{
     
    301301
    302302/** Get device block size. */
    303 static int file_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
     303static errno_t file_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
    304304{
    305305        *rsize = block_size;
     
    308308
    309309/** Get number of blocks on device. */
    310 static int file_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
     310static errno_t file_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
    311311{
    312312        *rnb = num_blocks;
Note: See TracChangeset for help on using the changeset viewer.