Changeset c25e39b in mainline
- Timestamp:
- 2011-10-31T15:21:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9a0982
- Parents:
- c83a55c
- Location:
- uspace
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_block_group.c
rc83a55c rc25e39b 33 33 /** 34 34 * @file libext4_block_group.c 35 * @brief TODO35 * @brief Ext4 block group structure operations 36 36 */ 37 37 -
uspace/lib/ext4/libext4_block_group.h
rc83a55c rc25e39b 51 51 uint16_t itable_unused_lo; // Unused inodes count 52 52 uint16_t checksum; // crc16(sb_uuid+group+desc) 53 /* -------------- */ 53 54 uint32_t block_bitmap_hi; // Blocks bitmap block MSB 54 55 uint32_t inode_bitmap_hi; // Inodes bitmap block MSB … … 66 67 } ext4_block_group_ref_t; 67 68 68 // TODO check value 69 #define EXT4_BLOCK_GROUP_DESCRIPTOR_SIZE 32 69 #define EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE 32 70 70 71 71 extern uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *); -
uspace/lib/ext4/libext4_directory.c
rc83a55c rc25e39b 33 33 /** 34 34 * @file libext4_directory.c 35 * @brief TODO35 * @brief Ext4 directory structure operations. 36 36 */ 37 37 -
uspace/lib/ext4/libext4_directory_index.c
rc83a55c rc25e39b 33 33 /** 34 34 * @file libext4_directory_index.c 35 * @brief TODO35 * @brief Ext4 directory index operations. 36 36 */ 37 37 -
uspace/lib/ext4/libext4_extent.c
rc83a55c rc25e39b 33 33 /** 34 34 * @file libext4_extent.c 35 * @brief TODO35 * @brief Ext4 extent structures operations. 36 36 */ 37 37 -
uspace/lib/ext4/libext4_filesystem.c
rc83a55c rc25e39b 127 127 } 128 128 129 // Feature checkers130 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 161 129 int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid, 162 130 ext4_block_group_ref_t **ref) … … 173 141 } 174 142 143 //EXT4FS_DBG("desc size = \%u", (uint32_t)ext4_superblock_get_desc_size(fs->superblock)); 144 175 145 descriptors_per_block = ext4_superblock_get_block_size(fs->superblock) 176 / EXT4_BLOCK_GROUP_DESCRIPTOR_SIZE;146 / ext4_superblock_get_desc_size(fs->superblock); 177 147 178 148 /* Block group descriptor table starts at the next block after superblock */ … … 181 151 /* Find the block containing the descriptor we are looking for */ 182 152 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); 184 154 185 155 rc = block_get(&newref->block, fs->device, block_id, 0); … … 302 272 303 273 /* 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)) { 306 276 current_block = ext4_inode_get_extent_block(inode, iblock, fs->device); 307 277 *fblock = current_block; -
uspace/lib/ext4/libext4_filesystem.h
rc83a55c rc25e39b 47 47 #define EXT4_REV0_INODE_SIZE 128 48 48 49 /* Compatible features */50 // TODO features comments !!!51 #define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x000152 #define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x000253 #define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x000454 #define EXT4_FEATURE_COMPAT_EXT_ATTR 0x000855 #define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x001056 #define EXT4_FEATURE_COMPAT_DIR_INDEX 0x002057 58 /* Read-only compatible features */59 // TODO features comments !!!60 #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x000161 #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x000262 #define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x000463 #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x000864 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x001065 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x002066 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x004067 68 /* Incompatible features */69 // TODO features comments !!!70 #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x000171 #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x000272 #define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */73 #define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */74 #define EXT4_FEATURE_INCOMPAT_META_BG 0x001075 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */76 #define EXT4_FEATURE_INCOMPAT_64BIT 0x008077 #define EXT4_FEATURE_INCOMPAT_MMP 0x010078 #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x020079 #define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */80 #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */81 82 83 // TODO MODIFY features corresponding with implementation84 #define EXT4_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR85 86 #define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \87 EXT4_FEATURE_INCOMPAT_RECOVER| \88 EXT4_FEATURE_INCOMPAT_META_BG| \89 EXT4_FEATURE_INCOMPAT_EXTENTS| \90 EXT4_FEATURE_INCOMPAT_64BIT| \91 EXT4_FEATURE_INCOMPAT_FLEX_BG)92 93 #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \94 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \95 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \96 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \97 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \98 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\99 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)100 101 49 102 50 extern int ext4_filesystem_init(ext4_filesystem_t *, service_id_t); … … 104 52 extern int ext4_filesystem_check_sanity(ext4_filesystem_t *fs); 105 53 extern int ext4_filesystem_check_features(ext4_filesystem_t *, bool *); 106 extern bool ext4_filesystem_has_feature_compatible(ext4_filesystem_t *, uint32_t);107 extern bool ext4_filesystem_has_feature_incompatible(ext4_filesystem_t *, uint32_t);108 extern bool ext4_filesystem_has_feature_read_only(ext4_filesystem_t *, uint32_t);109 54 extern int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *, uint32_t, 110 55 ext4_block_group_ref_t **); -
uspace/lib/ext4/libext4_hash.c
rc83a55c rc25e39b 33 33 /** 34 34 * @file libext4_hash.c 35 * @brief TODO35 * @brief Hashing algorithms for ext4 HTree. 36 36 */ 37 37 -
uspace/lib/ext4/libext4_inode.c
rc83a55c rc25e39b 33 33 /** 34 34 * @file libext4_inode.c 35 * @brief Ext4 inode operations.35 * @brief Ext4 inode structure operations. 36 36 */ 37 37 … … 135 135 return 0; 136 136 } 137 EXT4FS_DBG("get block");138 139 137 140 138 header = (ext4_extent_header_t *)block->data; -
uspace/lib/ext4/libext4_superblock.c
rc83a55c rc25e39b 190 190 } 191 191 192 uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *sb) 193 { 194 uint16_t size = uint16_t_le2host(sb->desc_size); 195 196 if (size < EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE) { 197 size = EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE; 198 } 199 200 return size; 201 } 202 192 203 uint32_t ext4_superblock_get_flags(ext4_superblock_t *sb) 193 204 { … … 197 208 198 209 /* 199 * More complex superblock functions210 * More complex superblock operations 200 211 */ 201 212 … … 207 218 return false; 208 219 } 220 221 // Feature checkers 222 bool ext4_superblock_has_feature_compatible(ext4_superblock_t *sb, uint32_t feature) 223 { 224 if (ext4_superblock_get_features_compatible(sb) & feature) { 225 return true; 226 } 227 return false; 228 } 229 230 bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *sb, uint32_t feature) 231 { 232 if (ext4_superblock_get_features_incompatible(sb) & feature) { 233 return true; 234 } 235 return false; 236 } 237 238 bool ext4_superblock_has_feature_read_only(ext4_superblock_t *sb, uint32_t feature) 239 { 240 if (ext4_superblock_get_features_read_only(sb) & feature) { 241 return true; 242 } 243 return false; 244 } 245 209 246 210 247 int ext4_superblock_read_direct(service_id_t service_id, -
uspace/lib/ext4/libext4_superblock.h
rc83a55c rc25e39b 151 151 #define EXT4_SUPERBLOCK_FLAGS_TEST_FILESYS 0x0004 /* to test development code */ 152 152 153 /* Compatible features */ 154 #define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001 155 #define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002 156 #define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004 157 #define EXT4_FEATURE_COMPAT_EXT_ATTR 0x0008 158 #define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010 159 #define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020 160 161 /* Read-only compatible features */ 162 #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 163 #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 164 #define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 165 #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 166 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 167 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 168 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 169 170 /* Incompatible features */ 171 #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 172 #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 173 #define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ 174 #define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ 175 #define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 176 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ 177 #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 178 #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 179 #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 180 #define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */ 181 #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */ 182 183 // TODO MODIFY features corresponding with implementation 184 #define EXT4_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR 185 186 #define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ 187 EXT4_FEATURE_INCOMPAT_RECOVER| \ 188 EXT4_FEATURE_INCOMPAT_META_BG| \ 189 EXT4_FEATURE_INCOMPAT_EXTENTS| \ 190 EXT4_FEATURE_INCOMPAT_64BIT| \ 191 EXT4_FEATURE_INCOMPAT_FLEX_BG) 192 193 #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 194 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ 195 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ 196 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ 197 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ 198 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\ 199 EXT4_FEATURE_RO_COMPAT_HUGE_FILE) 200 201 153 202 154 203 extern uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *); … … 205 254 uint8_t s_def_hash_version; // Default hash version to use 206 255 uint8_t s_jnl_backup_type; 207 uint16_t s_desc_size; // Size of group descriptor 256 */ 257 258 extern uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *); 259 260 /* 208 261 uint32_t s_default_mount_opts; // Default mount options 209 262 uint32_t s_first_meta_bg; // First metablock block group … … 243 296 /* More complex superblock functions */ 244 297 extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t); 298 extern bool ext4_superblock_has_feature_compatible(ext4_superblock_t *, uint32_t); 299 extern bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *, uint32_t); 300 extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *, uint32_t); 245 301 extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **); 246 302 extern int ext4_superblock_check_sanity(ext4_superblock_t *); -
uspace/srv/fs/ext4fs/ext4fs_ops.c
rc83a55c rc25e39b 224 224 } 225 225 226 // TODO check super block COMPAT FEATURES227 if (ext4_inode_has_flag(eparent->inode_ref->inode, EXT4_INODE_FLAG_INDEX)) {226 if (ext4_superblock_has_feature_compatible(fs->superblock, EXT4_FEATURE_COMPAT_DIR_INDEX) && 227 ext4_inode_has_flag(eparent->inode_ref->inode, EXT4_INODE_FLAG_INDEX)) { 228 228 229 229 rc = ext4_directory_dx_find_entry(&it, fs, eparent->inode_ref, component_size, component);
Note:
See TracChangeset
for help on using the changeset viewer.