Changeset b7fd2a0 in mainline for uspace/srv/fs/locfs/locfs_ops.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/fs/locfs/locfs_ops.c

    r36f0738 rb7fd2a0  
    101101};
    102102
    103 static int locfs_node_get_internal(fs_node_t **rfn, loc_object_type_t type,
     103static errno_t locfs_node_get_internal(fs_node_t **rfn, loc_object_type_t type,
    104104    service_id_t service_id)
    105105{
     
    125125}
    126126
    127 static int locfs_root_get(fs_node_t **rfn, service_id_t service_id)
     127static errno_t locfs_root_get(fs_node_t **rfn, service_id_t service_id)
    128128{
    129129        return locfs_node_get_internal(rfn, LOC_OBJECT_NONE, 0);
    130130}
    131131
    132 static int locfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
     132static errno_t locfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
    133133{
    134134        locfs_node_t *node = (locfs_node_t *) pfn->data;
    135         int ret;
     135        errno_t ret;
    136136       
    137137        if (node->service_id == 0) {
     
    208208}
    209209
    210 static int locfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
     210static errno_t locfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
    211211{
    212212        return locfs_node_get_internal(rfn, loc_id_probe(index), index);
    213213}
    214214
    215 static int locfs_node_open(fs_node_t *fn)
     215static errno_t locfs_node_open(fs_node_t *fn)
    216216{
    217217        locfs_node_t *node = (locfs_node_t *) fn->data;
     
    312312}
    313313
    314 static int locfs_node_put(fs_node_t *fn)
     314static errno_t locfs_node_put(fs_node_t *fn)
    315315{
    316316        free(fn->data);
     
    319319}
    320320
    321 static int locfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
     321static errno_t locfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
    322322{
    323323        assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
     
    327327}
    328328
    329 static int locfs_destroy_node(fs_node_t *fn)
     329static errno_t locfs_destroy_node(fs_node_t *fn)
    330330{
    331331        return ENOTSUP;
    332332}
    333333
    334 static int locfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
     334static errno_t locfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
    335335{
    336336        return ENOTSUP;
    337337}
    338338
    339 static int locfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
     339static errno_t locfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
    340340{
    341341        return ENOTSUP;
    342342}
    343343
    344 static int locfs_has_children(bool *has_children, fs_node_t *fn)
     344static errno_t locfs_has_children(bool *has_children, fs_node_t *fn)
    345345{
    346346        locfs_node_t *node = (locfs_node_t *) fn->data;
     
    455455}
    456456
    457 static int locfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
     457static errno_t locfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
    458458{
    459459        return ENOTSUP;
    460460}
    461461
    462 static int locfs_mounted(service_id_t service_id, const char *opts,
     462static errno_t locfs_mounted(service_id_t service_id, const char *opts,
    463463    fs_index_t *index, aoff64_t *size)
    464464{
     
    468468}
    469469
    470 static int locfs_unmounted(service_id_t service_id)
     470static errno_t locfs_unmounted(service_id_t service_id)
    471471{
    472472        return ENOTSUP;
    473473}
    474474
    475 static int
     475static errno_t
    476476locfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
    477477    size_t *rbytes)
     
    590590               
    591591                /* Wait for reply from the driver. */
    592                 int rc;
     592                errno_t rc;
    593593                async_wait_for(msg, &rc);
    594594
    595595                /* Do not propagate EHANGUP back to VFS. */
    596                 if ((int) rc == EHANGUP)
     596                if ((errno_t) rc == EHANGUP)
    597597                        rc = ENOTSUP;
    598598               
     
    604604}
    605605
    606 static int
     606static errno_t
    607607locfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
    608608    size_t *wbytes, aoff64_t *nsize)
     
    654654               
    655655                /* Wait for reply from the driver. */
    656                 int rc;
     656                errno_t rc;
    657657                async_wait_for(msg, &rc);
    658658
    659659                /* Do not propagate EHANGUP back to VFS. */
    660                 if ((int) rc == EHANGUP)
     660                if ((errno_t) rc == EHANGUP)
    661661                        rc = ENOTSUP;
    662662               
     
    669669}
    670670
    671 static int
     671static errno_t
    672672locfs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
    673673{
     
    675675}
    676676
    677 static int locfs_close(service_id_t service_id, fs_index_t index)
     677static errno_t locfs_close(service_id_t service_id, fs_index_t index)
    678678{
    679679        if (index == 0)
     
    715715}
    716716
    717 static int locfs_sync(service_id_t service_id, fs_index_t index)
     717static errno_t locfs_sync(service_id_t service_id, fs_index_t index)
    718718{
    719719        if (index == 0)
     
    752752               
    753753                /* Wait for reply from the driver */
    754                 int rc;
     754                errno_t rc;
    755755                async_wait_for(msg, &rc);
    756756               
     
    761761}
    762762
    763 static int locfs_destroy(service_id_t service_id, fs_index_t index)
     763static errno_t locfs_destroy(service_id_t service_id, fs_index_t index)
    764764{
    765765        return ENOTSUP;
Note: See TracChangeset for help on using the changeset viewer.