Changeset c25e39b in mainline for uspace/lib/ext4/libext4_filesystem.c


Ignore:
Timestamp:
2011-10-31T15:21:09Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a9a0982
Parents:
c83a55c
Message:

bugfix, TODO resolving

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_filesystem.c

    rc83a55c rc25e39b  
    127127}
    128128
    129 // Feature checkers
    130 bool ext4_filesystem_has_feature_compatible(ext4_filesystem_t *fs, uint32_t feature)
    131 {
    132         ext4_superblock_t *sb = fs->superblock;
    133 
    134         if (ext4_superblock_get_features_compatible(sb) & feature) {
    135                 return true;
    136         }
    137         return false;
    138 }
    139 
    140 bool ext4_filesystem_has_feature_incompatible(ext4_filesystem_t *fs, uint32_t feature)
    141 {
    142         ext4_superblock_t *sb = fs->superblock;
    143 
    144         if (ext4_superblock_get_features_incompatible(sb) & feature) {
    145                 return true;
    146         }
    147         return false;
    148 }
    149 
    150 bool ext4_filesystem_has_feature_read_only(ext4_filesystem_t *fs, uint32_t feature)
    151 {
    152         ext4_superblock_t *sb = fs->superblock;
    153 
    154         if (ext4_superblock_get_features_read_only(sb) & feature) {
    155                 return true;
    156         }
    157         return false;
    158 }
    159 
    160 
    161129int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
    162130    ext4_block_group_ref_t **ref)
     
    173141        }
    174142
     143        //EXT4FS_DBG("desc size = \%u", (uint32_t)ext4_superblock_get_desc_size(fs->superblock));
     144
    175145        descriptors_per_block = ext4_superblock_get_block_size(fs->superblock)
    176             / EXT4_BLOCK_GROUP_DESCRIPTOR_SIZE;
     146            / ext4_superblock_get_desc_size(fs->superblock);
    177147
    178148        /* Block group descriptor table starts at the next block after superblock */
     
    181151        /* Find the block containing the descriptor we are looking for */
    182152        block_id += bgid / descriptors_per_block;
    183         offset = (bgid % descriptors_per_block) * EXT4_BLOCK_GROUP_DESCRIPTOR_SIZE;
     153        offset = (bgid % descriptors_per_block) * ext4_superblock_get_desc_size(fs->superblock);
    184154
    185155        rc = block_get(&newref->block, fs->device, block_id, 0);
     
    302272
    303273        /* Handle inode using extents */
    304         // TODO check "extents" feature in superblock ???
    305         if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_EXTENTS)) {
     274        if (ext4_superblock_has_feature_compatible(fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
     275                        ext4_inode_has_flag(inode, EXT4_INODE_FLAG_EXTENTS)) {
    306276                current_block = ext4_inode_get_extent_block(inode, iblock, fs->device);
    307277                *fblock = current_block;
Note: See TracChangeset for help on using the changeset viewer.