Changeset 8158db7 in mainline
- Timestamp:
- 2011-10-19T11:44:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 246a5af
- Parents:
- 7bd2c19
- Location:
- uspace
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/Makefile
r7bd2c19 r8158db7 37 37 libext4_extent.c \ 38 38 libext4_filesystem.c \ 39 libext4_hash.c \ 39 40 libext4_inode.c \ 40 41 libext4_superblock.c -
uspace/lib/ext4/libext4.h
r7bd2c19 r8158db7 38 38 #include "libext4_extent.h" 39 39 #include "libext4_filesystem.h" 40 #include "libext4_hash.h" 40 41 #include "libext4_inode.h" 41 42 #include "libext4_superblock.h" -
uspace/lib/ext4/libext4_directory.c
r7bd2c19 r8158db7 246 246 247 247 int ext4_directory_dx_find_entry(ext4_directory_iterator_t *it, 248 ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, const char *name)248 ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, size_t len, const char *name) 249 249 { 250 250 int rc; … … 253 253 ext4_directory_dx_root_t *root; 254 254 uint32_t hash; 255 ext4_ directory_dx_hash_info_t hinfo;255 ext4_hash_info_t hinfo; 256 256 257 257 // get direct block 0 (index root) … … 315 315 316 316 hinfo.hash_version = ext4_directory_dx_root_info_get_hash_version(&root->info); 317 if ((hinfo.hash_version <= EXT4_ DIRECTORY_DX_HASH_TEA)317 if ((hinfo.hash_version <= EXT4_HASH_VERSION_TEA) 318 318 && (ext4_superblock_has_flag(fs->superblock, EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH))) { 319 319 // 3 is magic from ext4 linux implementation … … 324 324 hinfo.hash = 0; 325 325 if (name) { 326 ext4_ directory_hash(&hinfo, name);326 ext4_hash_string(&hinfo, len, name); 327 327 } 328 328 … … 387 387 } 388 388 389 void ext4_directory_hash(ext4_directory_dx_hash_info_t *hinfo, const char* name)390 {391 // TODO392 }393 389 394 390 /** -
uspace/lib/ext4/libext4_directory.h
r7bd2c19 r8158db7 96 96 } ext4_directory_dx_root_t; 97 97 98 typedef struct ext4_directory_dx_hash_info {99 uint32_t hash;100 uint32_t minor_hash;101 uint32_t hash_version;102 uint32_t *seed;103 } ext4_directory_dx_hash_info_t;104 105 98 106 99 #define EXT4_ERR_BAD_DX_DIR (-75000) 107 108 #define EXT4_DIRECTORY_DX_HASH_LEGACY 0 109 #define EXT4_DIRECTORY_DX_HASH_HALF_MD4 1 110 #define EXT4_DIRECTORY_DX_HASH_TEA 2 111 #define EXT4_DIRECTORY_DX_HASH_LEGACY_UNSIGNED 3 112 #define EXT4_DIRECTORY_DX_HASH_HALF_MD4_UNSIGNED 4 113 #define EXT4_DIRECTORY_DX_HASH_TEA_UNSIGNED 5 114 115 #define EXT4_DIRECTORY_HTREE_EOF 0x7fffffff 100 #define EXT4_DIRECTORY_HTREE_EOF (uint32_t)0x7fffffff 116 101 117 102 … … 138 123 extern int ext4_directory_iterator_fini(ext4_directory_iterator_t *); 139 124 extern int ext4_directory_dx_find_entry(ext4_directory_iterator_t *, 140 ext4_filesystem_t *, ext4_inode_ref_t *, const char *); 141 142 extern void ext4_directory_hash(ext4_directory_dx_hash_info_t *, const char* name); 125 ext4_filesystem_t *, ext4_inode_ref_t *, size_t, const char *); 143 126 144 127 #endif -
uspace/srv/fs/ext4fs/ext4fs_ops.c
r7bd2c19 r8158db7 216 216 } 217 217 218 // TODO check super block COMPAT FEATURES219 if (ext4_inode_has_flag(eparent->inode_ref->inode, EXT4_INODE_FLAG_INDEX)) {220 221 rc = ext4_directory_dx_find_entry(&it, fs, eparent->inode_ref, component);222 223 // Index isn't corrupted224 if (rc != EXT4_ERR_BAD_DX_DIR) {225 226 // TODO check return value227 if (rc != EOK) {228 return rc;229 }230 231 inode = ext4_directory_entry_ll_get_inode(it.current);232 return ext4fs_node_get_core(rfn, eparent->instance, inode);233 }234 235 }236 237 rc = ext4_directory_iterator_init(&it, fs, eparent->inode_ref, 0);238 if (rc != EOK) {239 return rc;240 }241 242 218 /* Find length of component in bytes 243 219 * TODO: check for library function call that does this … … 246 222 while (*(component+component_size) != 0) { 247 223 component_size++; 224 } 225 226 // TODO check super block COMPAT FEATURES 227 if (ext4_inode_has_flag(eparent->inode_ref->inode, EXT4_INODE_FLAG_INDEX)) { 228 229 rc = ext4_directory_dx_find_entry(&it, fs, eparent->inode_ref, component_size, component); 230 231 // Index isn't corrupted 232 if (rc != EXT4_ERR_BAD_DX_DIR) { 233 234 // TODO check return value 235 if (rc != EOK) { 236 return rc; 237 } 238 239 inode = ext4_directory_entry_ll_get_inode(it.current); 240 return ext4fs_node_get_core(rfn, eparent->instance, inode); 241 } 242 243 } 244 245 rc = ext4_directory_iterator_init(&it, fs, eparent->inode_ref, 0); 246 if (rc != EOK) { 247 return rc; 248 248 } 249 249
Note:
See TracChangeset
for help on using the changeset viewer.