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

    r36f0738 rb7fd2a0  
    3434#include "mfs.h"
    3535
    36 static int
     36static errno_t
    3737rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock,
    3838    bool write_mode, uint32_t w_block);
    3939
    40 static int
     40static errno_t
    4141reset_zone_content(struct mfs_instance *inst, uint32_t zone);
    4242
    43 static int
     43static errno_t
    4444alloc_zone_and_clear(struct mfs_instance *inst, uint32_t *zone);
    4545
    46 static int
     46static errno_t
    4747read_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t **ind_zone);
    4848
    49 static int
     49static errno_t
    5050write_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t *ind_zone);
    5151
     
    6161 * @return      EOK on success or an error code.
    6262 */
    63 int
     63errno_t
    6464mfs_read_map(uint32_t *b, const struct mfs_node *mnode, uint32_t pos)
    6565{
    66         int r;
     66        errno_t r;
    6767        const struct mfs_sb_info *sbi = mnode->instance->sbi;
    6868        const int block_size = sbi->block_size;
     
    8383}
    8484
    85 int
     85errno_t
    8686mfs_write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone,
    8787    uint32_t *old_zone)
     
    100100}
    101101
    102 static int
     102static errno_t
    103103rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock,
    104104    bool write_mode, uint32_t w_block)
     
    107107        int ptrs_per_block;
    108108        uint32_t *ind_zone = NULL, *ind2_zone = NULL;
    109         int r = EOK;
     109        errno_t r = EOK;
    110110
    111111        struct mfs_ino_info *ino_i = mnode->ino_i;
     
    238238 * @return              EOK on success or an error code.
    239239 */
    240 int
     240errno_t
    241241mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size)
    242242{
     
    245245        struct mfs_ino_info *ino_i = mnode->ino_i;
    246246        int nr_direct, ptrs_per_block, rblock;
    247         int r;
     247        errno_t r;
    248248        int i;
    249249
     
    312312}
    313313
    314 static int
     314static errno_t
    315315reset_zone_content(struct mfs_instance *inst, uint32_t zone)
    316316{
    317317        block_t *b;
    318         int r;
     318        errno_t r;
    319319
    320320        r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NOREAD);
     
    328328}
    329329
    330 static int
     330static errno_t
    331331alloc_zone_and_clear(struct mfs_instance *inst, uint32_t *zone)
    332332{
    333         int r;
     333        errno_t r;
    334334
    335335        r = mfs_alloc_zone(inst, zone);
     
    341341}
    342342
    343 static int
     343static errno_t
    344344read_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t **ind_zone)
    345345{
    346346        struct mfs_sb_info *sbi = inst->sbi;
    347         int r;
     347        errno_t r;
    348348        unsigned i;
    349349        block_t *b;
     
    376376}
    377377
    378 static int
     378static errno_t
    379379write_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t *ind_zone)
    380380{
    381381        struct mfs_sb_info *sbi = inst->sbi;
    382         int r;
     382        errno_t r;
    383383        unsigned i;
    384384        block_t *b;
Note: See TracChangeset for help on using the changeset viewer.