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/directory_index.c

    r36f0738 rb7fd2a0  
    236236 *
    237237 */
    238 int ext4_directory_dx_init(ext4_inode_ref_t *dir)
     238errno_t ext4_directory_dx_init(ext4_inode_ref_t *dir)
    239239{
    240240        /* Load block 0, where will be index root located */
    241241        uint32_t fblock;
    242         int rc = ext4_filesystem_get_inode_data_block_index(dir, 0,
     242        errno_t rc = ext4_filesystem_get_inode_data_block_index(dir, 0,
    243243            &fblock);
    244244        if (rc != EOK)
     
    322322 *
    323323 */
    324 static int ext4_directory_hinfo_init(ext4_hash_info_t *hinfo,
     324static errno_t ext4_directory_hinfo_init(ext4_hash_info_t *hinfo,
    325325    block_t *root_block, ext4_superblock_t *sb, size_t name_len,
    326326    const char *name)
     
    384384 *
    385385 */
    386 static int ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo,
     386static errno_t ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo,
    387387    ext4_inode_ref_t *inode_ref, block_t *root_block,
    388388    ext4_directory_dx_block_t **dx_block, ext4_directory_dx_block_t *dx_blocks)
     
    443443               
    444444                uint32_t fblock;
    445                 int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
     445                errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
    446446                    next_block, &fblock);
    447447                if (rc != EOK)
     
    484484 *
    485485 */
    486 static int ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref,
     486static errno_t ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref,
    487487    uint32_t hash, ext4_directory_dx_block_t *dx_block,
    488488    ext4_directory_dx_block_t *dx_blocks)
     
    520520                uint32_t block_addr;
    521521               
    522                 int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
     522                errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
    523523                    block_idx, &block_addr);
    524524                if (rc != EOK)
     
    556556 *
    557557 */
    558 int ext4_directory_dx_find_entry(ext4_directory_search_result_t *result,
     558errno_t ext4_directory_dx_find_entry(ext4_directory_search_result_t *result,
    559559    ext4_inode_ref_t *inode_ref, size_t name_len, const char *name)
    560560{
    561561        /* Load direct block 0 (index root) */
    562562        uint32_t root_block_addr;
    563         int rc2;
    564         int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
     563        errno_t rc2;
     564        errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
    565565            &root_block_addr);
    566566        if (rc != EOK)
     
    728728 *
    729729 */
    730 static int ext4_directory_dx_split_data(ext4_inode_ref_t *inode_ref,
     730static errno_t ext4_directory_dx_split_data(ext4_inode_ref_t *inode_ref,
    731731    ext4_hash_info_t *hinfo, block_t *old_data_block,
    732732    ext4_directory_dx_block_t *index_block, block_t **new_data_block)
    733733{
    734         int rc = EOK;
     734        errno_t rc = EOK;
    735735       
    736736        /* Allocate buffer for directory entries */
     
    897897 *
    898898 */
    899 static int ext4_directory_dx_split_index(ext4_inode_ref_t *inode_ref,
     899static errno_t ext4_directory_dx_split_index(ext4_inode_ref_t *inode_ref,
    900900                ext4_directory_dx_block_t *dx_blocks, ext4_directory_dx_block_t *dx_block)
    901901{
     
    937937                uint32_t new_fblock;
    938938                uint32_t new_iblock;
    939                 int rc = ext4_filesystem_append_inode_block(inode_ref,
     939                errno_t rc = ext4_filesystem_append_inode_block(inode_ref,
    940940                    &new_fblock, &new_iblock);
    941941                if (rc != EOK)
     
    10451045 *
    10461046 */
    1047 int ext4_directory_dx_add_entry(ext4_inode_ref_t *parent,
     1047errno_t ext4_directory_dx_add_entry(ext4_inode_ref_t *parent,
    10481048    ext4_inode_ref_t *child, const char *name)
    10491049{
    1050         int rc2 = EOK;
     1050        errno_t rc2 = EOK;
    10511051       
    10521052        /* Get direct block 0 (index root) */
    10531053        uint32_t root_block_addr;
    1054         int rc = ext4_filesystem_get_inode_data_block_index(parent, 0,
     1054        errno_t rc = ext4_filesystem_get_inode_data_block_index(parent, 0,
    10551055            &root_block_addr);
    10561056        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.