Changeset b7fd2a0 in mainline for uspace/lib/fs/libfs.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (6 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/fs/libfs.c

    r36f0738 rb7fd2a0  
    8484{
    8585        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    86         int rc;
     86        errno_t rc;
    8787        vfs_fs_probe_info_t info;
    8888       
     
    112112        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    113113        char *opts;
    114         int rc;
     114        errno_t rc;
    115115       
    116116        /* Accept the mount options. */
     
    136136{
    137137        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    138         int rc;
     138        errno_t rc;
    139139
    140140        rc = vfs_out_ops->unmounted(service_id);
     
    160160            IPC_GET_ARG4(*req));
    161161        size_t rbytes;
    162         int rc;
     162        errno_t rc;
    163163
    164164        rc = vfs_out_ops->read(service_id, index, pos, &rbytes);
     
    178178        size_t wbytes;
    179179        aoff64_t nsize;
    180         int rc;
     180        errno_t rc;
    181181
    182182        rc = vfs_out_ops->write(service_id, index, pos, &wbytes, &nsize);
     
    195195        aoff64_t size = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*req),
    196196            IPC_GET_ARG4(*req));
    197         int rc;
     197        errno_t rc;
    198198
    199199        rc = vfs_out_ops->truncate(service_id, index, size);
     
    206206        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    207207        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
    208         int rc;
     208        errno_t rc;
    209209
    210210        rc = vfs_out_ops->close(service_id, index);
     
    218218        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
    219219
    220         int rc;
     220        errno_t rc;
    221221        fs_node_t *node = NULL;
    222222        rc = libfs_ops->node_get(&node, service_id, index);
     
    244244        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    245245        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
    246         int rc;
     246        errno_t rc;
    247247
    248248        rc = vfs_out_ops->sync(service_id, index);
     
    260260        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    261261        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
    262         int rc;
     262        errno_t rc;
    263263
    264264        fs_node_t *node = NULL;
     
    364364 *
    365365 */
    366 int fs_register(async_sess_t *sess, vfs_info_t *info, vfs_out_ops_t *vops,
     366errno_t fs_register(async_sess_t *sess, vfs_info_t *info, vfs_out_ops_t *vops,
    367367    libfs_ops_t *lops)
    368368{
     
    381381         * Send our VFS info structure to VFS.
    382382         */
    383         int rc = async_data_write_start(exch, info, sizeof(*info));
     383        errno_t rc = async_data_write_start(exch, info, sizeof(*info));
    384384       
    385385        if (rc != EOK) {
     
    446446}
    447447
    448 static int plb_get_component(char *dest, unsigned *sz, unsigned *ppos,
     448static errno_t plb_get_component(char *dest, unsigned *sz, unsigned *ppos,
    449449    unsigned last)
    450450{
     
    476476}
    477477
    478 static int receive_fname(char *buffer)
     478static errno_t receive_fname(char *buffer)
    479479{
    480480        size_t size;
     
    500500       
    501501        char component[NAME_MAX + 1];
    502         int rc = receive_fname(component);
     502        errno_t rc = receive_fname(component);
    503503        if (rc != EOK) {
    504504                async_answer_0(rid, rc);
     
    555555       
    556556        char component[NAME_MAX + 1];
    557         int rc;
     557        errno_t rc;
    558558       
    559559        fs_node_t *par = NULL;
     
    727727
    728728        fs_node_t *fn;
    729         int rc = ops->node_get(&fn, service_id, index);
     729        errno_t rc = ops->node_get(&fn, service_id, index);
    730730        on_error(rc, answer_and_return(rid, rc));
    731731
     
    766766
    767767        fs_node_t *fn;
    768         int rc = ops->node_get(&fn, service_id, index);
     768        errno_t rc = ops->node_get(&fn, service_id, index);
    769769        on_error(rc, answer_and_return(rid, rc));
    770770
     
    826826       
    827827        fs_node_t *fn;
    828         int rc = ops->node_get(&fn, service_id, index);
     828        errno_t rc = ops->node_get(&fn, service_id, index);
    829829        on_error(rc, answer_and_return(rid, rc));
    830830       
     
    853853} fs_instance_t;
    854854
    855 int fs_instance_create(service_id_t service_id, void *data)
     855errno_t fs_instance_create(service_id_t service_id, void *data)
    856856{
    857857        fs_instance_t *inst = malloc(sizeof(fs_instance_t));
     
    884884}
    885885
    886 int fs_instance_get(service_id_t service_id, void **idp)
     886errno_t fs_instance_get(service_id_t service_id, void **idp)
    887887{
    888888        fibril_mutex_lock(&instances_mutex);
     
    898898}
    899899
    900 int fs_instance_destroy(service_id_t service_id)
     900errno_t fs_instance_destroy(service_id_t service_id)
    901901{
    902902        fibril_mutex_lock(&instances_mutex);
Note: See TracChangeset for help on using the changeset viewer.