Changeset a54af66 in mainline for uspace/lib/ext2/libext2_inode.c


Ignore:
Timestamp:
2011-02-23T18:21:55Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad34feb
Parents:
f483a15
Message:

More strict inode type checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext2/libext2_inode.c

    rf483a15 ra54af66  
    5454
    5555/**
     56 * Check whether inode is of given type
     57 *
     58 * @param sb pointer to superblock structure
     59 * @param inode pointer to inode
     60 * @param type EXT2_INODE_MODE_TYPE_* constant to check
     61 */
     62inline bool ext2_inode_is_type(ext2_superblock_t *sb, ext2_inode_t *inode, uint32_t type)
     63{
     64        uint32_t mode = ext2_inode_get_mode(sb, inode);
     65        return (mode & EXT2_INODE_MODE_TYPE_MASK) == type;
     66}
     67
     68/**
    5669 * Get uid this inode is belonging to
    5770 *
     
    7992{
    8093        uint32_t major_rev = ext2_superblock_get_rev_major(sb);
    81         uint32_t mode = ext2_inode_get_mode(sb, inode);
    8294       
    83         if (major_rev > 0 && mode & EXT2_INODE_MODE_FILE) {
     95        if (major_rev > 0 && ext2_inode_is_type(sb, inode, EXT2_INODE_MODE_FILE)) {
    8496                return ((uint64_t)uint32_t_le2host(inode->size_high)) << 32 |
    8597                    ((uint64_t)uint32_t_le2host(inode->size));
Note: See TracChangeset for help on using the changeset viewer.