Changeset b7fd2a0 in mainline for uspace/srv/fs/exfat/exfat_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/exfat/exfat_ops.c

    r36f0738 rb7fd2a0  
    7272 */
    7373
    74 static int exfat_root_get(fs_node_t **, service_id_t);
    75 static int exfat_match(fs_node_t **, fs_node_t *, const char *);
    76 static int exfat_node_get(fs_node_t **, service_id_t, fs_index_t);
    77 static int exfat_node_open(fs_node_t *);
    78 /* static int exfat_node_put(fs_node_t *); */
    79 static int exfat_create_node(fs_node_t **, service_id_t, int);
    80 static int exfat_destroy_node(fs_node_t *);
    81 static int exfat_link(fs_node_t *, fs_node_t *, const char *);
    82 static int exfat_unlink(fs_node_t *, fs_node_t *, const char *);
    83 static int exfat_has_children(bool *, fs_node_t *);
     74static errno_t exfat_root_get(fs_node_t **, service_id_t);
     75static errno_t exfat_match(fs_node_t **, fs_node_t *, const char *);
     76static errno_t exfat_node_get(fs_node_t **, service_id_t, fs_index_t);
     77static errno_t exfat_node_open(fs_node_t *);
     78/* static errno_t exfat_node_put(fs_node_t *); */
     79static errno_t exfat_create_node(fs_node_t **, service_id_t, int);
     80static errno_t exfat_destroy_node(fs_node_t *);
     81static errno_t exfat_link(fs_node_t *, fs_node_t *, const char *);
     82static errno_t exfat_unlink(fs_node_t *, fs_node_t *, const char *);
     83static errno_t exfat_has_children(bool *, fs_node_t *);
    8484static fs_index_t exfat_index_get(fs_node_t *);
    8585static aoff64_t exfat_size_get(fs_node_t *);
     
    8888static bool exfat_is_file(fs_node_t *node);
    8989static service_id_t exfat_service_get(fs_node_t *node);
    90 static int exfat_size_block(service_id_t, uint32_t *);
    91 static int exfat_total_block_count(service_id_t, uint64_t *);
    92 static int exfat_free_block_count(service_id_t, uint64_t *);
     90static errno_t exfat_size_block(service_id_t, uint32_t *);
     91static errno_t exfat_total_block_count(service_id_t, uint64_t *);
     92static errno_t exfat_free_block_count(service_id_t, uint64_t *);
    9393
    9494/*
     
    114114}
    115115
    116 static int exfat_node_sync(exfat_node_t *node)
    117 {
    118         int rc;
     116static errno_t exfat_node_sync(exfat_node_t *node)
     117{
     118        errno_t rc;
    119119        exfat_directory_t di;
    120120        exfat_file_dentry_t df;
     
    155155}
    156156
    157 static int exfat_node_fini_by_service_id(service_id_t service_id)
    158 {
    159         int rc;
     157static errno_t exfat_node_fini_by_service_id(service_id_t service_id)
     158{
     159        errno_t rc;
    160160
    161161        /*
     
    211211}
    212212
    213 static int exfat_node_get_new(exfat_node_t **nodepp)
     213static errno_t exfat_node_get_new(exfat_node_t **nodepp)
    214214{
    215215        fs_node_t *fn;
    216216        exfat_node_t *nodep;
    217         int rc;
     217        errno_t rc;
    218218
    219219        fibril_mutex_lock(&ffn_mutex);
     
    269269}
    270270
    271 static int exfat_node_get_new_by_pos(exfat_node_t **nodepp,
     271static errno_t exfat_node_get_new_by_pos(exfat_node_t **nodepp,
    272272    service_id_t service_id, exfat_cluster_t pfc, unsigned pdi)
    273273{
     
    287287 * @param idxp          Locked index structure.
    288288 */
    289 static int exfat_node_get_core(exfat_node_t **nodepp, exfat_idx_t *idxp)
     289static errno_t exfat_node_get_core(exfat_node_t **nodepp, exfat_idx_t *idxp)
    290290{
    291291        exfat_dentry_t *d;
    292292        exfat_node_t *nodep = NULL;
    293293        exfat_directory_t di;
    294         int rc;
     294        errno_t rc;
    295295
    296296        if (idxp->nodep) {
     
    398398}
    399399
    400 int exfat_node_expand(service_id_t service_id, exfat_node_t *nodep,
     400errno_t exfat_node_expand(service_id_t service_id, exfat_node_t *nodep,
    401401    exfat_cluster_t clusters)
    402402{
    403403        exfat_bs_t *bs;
    404         int rc;
     404        errno_t rc;
    405405        bs = block_bb_get(service_id);
    406406
     
    443443}
    444444
    445 static int exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep,
     445static errno_t exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep,
    446446    aoff64_t size)
    447447{
    448448        exfat_bs_t *bs;
    449         int rc;
     449        errno_t rc;
    450450        bs = block_bb_get(service_id);
    451451
     
    491491 */
    492492
    493 int exfat_root_get(fs_node_t **rfn, service_id_t service_id)
     493errno_t exfat_root_get(fs_node_t **rfn, service_id_t service_id)
    494494{
    495495        return exfat_node_get(rfn, service_id, EXFAT_ROOT_IDX);
    496496}
    497497
    498 int exfat_bitmap_get(fs_node_t **rfn, service_id_t service_id)
     498errno_t exfat_bitmap_get(fs_node_t **rfn, service_id_t service_id)
    499499{
    500500        return exfat_node_get(rfn, service_id, EXFAT_BITMAP_IDX);
    501501}
    502502
    503 int exfat_uctable_get(fs_node_t **rfn, service_id_t service_id)
     503errno_t exfat_uctable_get(fs_node_t **rfn, service_id_t service_id)
    504504{
    505505        return exfat_node_get(rfn, service_id, EXFAT_UCTABLE_IDX);
     
    507507
    508508
    509 int exfat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
     509errno_t exfat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
    510510{
    511511        exfat_node_t *parentp = EXFAT_NODE(pfn);
     
    514514        exfat_stream_dentry_t ds;
    515515        service_id_t service_id;
    516         int rc;
     516        errno_t rc;
    517517
    518518        fibril_mutex_lock(&parentp->idx->lock);
     
    565565
    566566/** Instantiate a exFAT in-core node. */
    567 int exfat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
     567errno_t exfat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
    568568{
    569569        exfat_node_t *nodep;
    570570        exfat_idx_t *idxp;
    571         int rc;
     571        errno_t rc;
    572572
    573573        idxp = exfat_idx_get_by_index(service_id, index);
     
    584584}
    585585
    586 int exfat_node_open(fs_node_t *fn)
     586errno_t exfat_node_open(fs_node_t *fn)
    587587{
    588588        /*
     
    593593}
    594594
    595 int exfat_node_put(fs_node_t *fn)
     595errno_t exfat_node_put(fs_node_t *fn)
    596596{
    597597        if (fn == NULL)
     
    625625}
    626626
    627 int exfat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
     627errno_t exfat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
    628628{
    629629        exfat_idx_t *idxp;
    630630        exfat_node_t *nodep;
    631631        exfat_bs_t *bs;
    632         int rc;
     632        errno_t rc;
    633633
    634634        bs = block_bb_get(service_id);
     
    677677}
    678678
    679 int exfat_destroy_node(fs_node_t *fn)
     679errno_t exfat_destroy_node(fs_node_t *fn)
    680680{
    681681        exfat_node_t *nodep = EXFAT_NODE(fn);
    682682        exfat_bs_t *bs;
    683683        bool has_children;
    684         int rc;
     684        errno_t rc;
    685685
    686686        /*
     
    718718}
    719719
    720 int exfat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
     720errno_t exfat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
    721721{
    722722        exfat_node_t *parentp = EXFAT_NODE(pfn);
    723723        exfat_node_t *childp = EXFAT_NODE(cfn);
    724724        exfat_directory_t di;
    725         int rc;
     725        errno_t rc;
    726726
    727727        fibril_mutex_lock(&childp->lock);
     
    783783}
    784784
    785 int exfat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
     785errno_t exfat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
    786786{
    787787        exfat_node_t *parentp = EXFAT_NODE(pfn);
    788788        exfat_node_t *childp = EXFAT_NODE(cfn);
    789789        bool has_children;
    790         int rc;
     790        errno_t rc;
    791791
    792792        if (!parentp)
     
    838838}
    839839
    840 int exfat_has_children(bool *has_children, fs_node_t *fn)
     840errno_t exfat_has_children(bool *has_children, fs_node_t *fn)
    841841{
    842842        exfat_directory_t di;
    843843        exfat_dentry_t *d;
    844844        exfat_node_t *nodep = EXFAT_NODE(fn);
    845         int rc;
     845        errno_t rc;
    846846
    847847        *has_children = false;
     
    915915}
    916916
    917 int exfat_size_block(service_id_t service_id, uint32_t *size)
     917errno_t exfat_size_block(service_id_t service_id, uint32_t *size)
    918918{
    919919        exfat_bs_t *bs;
     
    924924}
    925925
    926 int exfat_total_block_count(service_id_t service_id, uint64_t *count)
     926errno_t exfat_total_block_count(service_id_t service_id, uint64_t *count)
    927927{
    928928        exfat_bs_t *bs;
     
    933933}
    934934
    935 int exfat_free_block_count(service_id_t service_id, uint64_t *count)
     935errno_t exfat_free_block_count(service_id_t service_id, uint64_t *count)
    936936{
    937937        fs_node_t *node = NULL;
     
    941941        uint64_t block_count;
    942942        unsigned sector;
    943         int rc;
     943        errno_t rc;
    944944
    945945        rc = exfat_total_block_count(service_id, &block_count);
     
    10151015};
    10161016
    1017 static int exfat_fs_open(service_id_t service_id, enum cache_mode cmode,
     1017static errno_t exfat_fs_open(service_id_t service_id, enum cache_mode cmode,
    10181018    fs_node_t **rrfn, exfat_idx_t **rridxp, vfs_fs_probe_info_t *info)
    10191019{
    1020         int rc;
     1020        errno_t rc;
    10211021        exfat_node_t *rootp = NULL, *bitmapp = NULL, *uctablep = NULL;
    10221022        exfat_bs_t *bs;
     
    12671267*/
    12681268
    1269 static int exfat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
    1270 {
    1271         int rc;
     1269static errno_t exfat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
     1270{
     1271        errno_t rc;
    12721272        exfat_idx_t *ridxp;
    12731273        fs_node_t *rfn;
     
    12811281}
    12821282
    1283 static int
     1283static errno_t
    12841284exfat_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
    12851285    aoff64_t *size)
    12861286{
    1287         int rc;
     1287        errno_t rc;
    12881288        enum cache_mode cmode;
    12891289        exfat_idx_t *ridxp;
     
    13061306}
    13071307
    1308 static int exfat_unmounted(service_id_t service_id)
     1308static errno_t exfat_unmounted(service_id_t service_id)
    13091309{
    13101310        fs_node_t *rfn;
    1311         int rc;
     1311        errno_t rc;
    13121312
    13131313        rc = exfat_root_get(&rfn, service_id);
     
    13191319}
    13201320
    1321 static int
     1321static errno_t
    13221322exfat_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
    13231323    size_t *rbytes)
     
    13281328        size_t bytes = 0;
    13291329        block_t *b;
    1330         int rc;
     1330        errno_t rc;
    13311331
    13321332        rc = exfat_node_get(&fn, service_id, index);
     
    14381438}
    14391439
    1440 static int exfat_close(service_id_t service_id, fs_index_t index)
    1441 {
    1442         return EOK;
    1443 }
    1444 
    1445 static int exfat_sync(service_id_t service_id, fs_index_t index)
     1440static errno_t exfat_close(service_id_t service_id, fs_index_t index)
     1441{
     1442        return EOK;
     1443}
     1444
     1445static errno_t exfat_sync(service_id_t service_id, fs_index_t index)
    14461446{
    14471447        fs_node_t *fn;
    1448         int rc = exfat_node_get(&fn, service_id, index);
     1448        errno_t rc = exfat_node_get(&fn, service_id, index);
    14491449        if (rc != EOK)
    14501450                return rc;
     
    14611461}
    14621462
    1463 static int
     1463static errno_t
    14641464exfat_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
    14651465    size_t *wbytes, aoff64_t *nsize)
     
    14721472        aoff64_t boundary;
    14731473        int flags = BLOCK_FLAGS_NONE;
    1474         int rc;
     1474        errno_t rc;
    14751475
    14761476        rc = exfat_node_get(&fn, service_id, index);
     
    15481548}
    15491549
    1550 static int
     1550static errno_t
    15511551exfat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
    15521552{
     
    15541554        exfat_node_t *nodep;
    15551555        exfat_bs_t *bs;
    1556         int rc;
     1556        errno_t rc;
    15571557
    15581558        rc = exfat_node_get(&fn, service_id, index);
     
    15841584        }
    15851585
    1586         int rc2 = exfat_node_put(fn);
     1586        errno_t rc2 = exfat_node_put(fn);
    15871587        if (rc == EOK && rc2 != EOK)
    15881588                rc = rc2;
     
    15911591}
    15921592
    1593 static int exfat_destroy(service_id_t service_id, fs_index_t index)
     1593static errno_t exfat_destroy(service_id_t service_id, fs_index_t index)
    15941594{
    15951595        fs_node_t *fn;
    15961596        exfat_node_t *nodep;
    1597         int rc;
     1597        errno_t rc;
    15981598
    15991599        rc = exfat_node_get(&fn, service_id, index);
Note: See TracChangeset for help on using the changeset viewer.