Changeset b7fd2a0 in mainline for uspace/lib/ext4/src/balloc.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/lib/ext4/src/balloc.c

    r36f0738 rb7fd2a0  
    5353 *
    5454 */
    55 int ext4_balloc_free_block(ext4_inode_ref_t *inode_ref, uint32_t block_addr)
     55errno_t ext4_balloc_free_block(ext4_inode_ref_t *inode_ref, uint32_t block_addr)
    5656{
    5757        ext4_filesystem_t *fs = inode_ref->fs;
     
    6565        /* Load block group reference */
    6666        ext4_block_group_ref_t *bg_ref;
    67         int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
     67        errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
    6868        if (rc != EOK)
    6969                return rc;
     
    118118}
    119119
    120 static int ext4_balloc_free_blocks_internal(ext4_inode_ref_t *inode_ref,
     120static errno_t ext4_balloc_free_blocks_internal(ext4_inode_ref_t *inode_ref,
    121121    uint32_t first, uint32_t count)
    122122{
     
    134134        /* Load block group reference */
    135135        ext4_block_group_ref_t *bg_ref;
    136         int rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
     136        errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
    137137        if (rc != EOK)
    138138                return rc;
     
    198198 *
    199199 */
    200 int ext4_balloc_free_blocks(ext4_inode_ref_t *inode_ref,
     200errno_t ext4_balloc_free_blocks(ext4_inode_ref_t *inode_ref,
    201201    uint32_t first, uint32_t count)
    202202{
    203         int r;
     203        errno_t r;
    204204        uint32_t gid;
    205205        uint64_t limit;
     
    293293 *
    294294 */
    295 static int ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
     295static errno_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
    296296{
    297297        *goal = 0;
     
    307307        /* If inode has some blocks, get last block address + 1 */
    308308        if (inode_block_count > 0) {
    309                 int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
     309                errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
    310310                    inode_block_count - 1, goal);
    311311                if (rc != EOK)
     
    325325        /* Load block group reference */
    326326        ext4_block_group_ref_t *bg_ref;
    327         int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
     327        errno_t rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
    328328            block_group, &bg_ref);
    329329        if (rc != EOK)
     
    343343 *
    344344 */
    345 int ext4_balloc_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t *fblock)
     345errno_t ext4_balloc_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t *fblock)
    346346{
    347347        uint32_t allocated_block = 0;
     
    354354       
    355355        /* Find GOAL */
    356         int rc = ext4_balloc_find_goal(inode_ref, &goal);
     356        errno_t rc = ext4_balloc_find_goal(inode_ref, &goal);
    357357        if (rc != EOK)
    358358                return rc;
     
    625625 *
    626626 */
    627 int ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t fblock,
     627errno_t ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t fblock,
    628628    bool *free)
    629629{
    630         int rc;
     630        errno_t rc;
    631631       
    632632        ext4_filesystem_t *fs = inode_ref->fs;
Note: See TracChangeset for help on using the changeset viewer.