Changeset 8958a26 in mainline
- Timestamp:
- 2011-10-11T19:06:10Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1a7756a
- Parents:
- acd869e
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_extent.c
racd869e r8958a26 39 39 #include "libext4_extent.h" 40 40 41 uint32_t ext4_extent_get_first_block(ext4_extent_t *extent) 42 { 43 return uint32_t_le2host(extent->first_block); 44 } 45 46 uint16_t ext4_extent_get_block_count(ext4_extent_t *extent) 47 { 48 return uint16_t_le2host(extent->block_count); 49 } 50 51 uint64_t ext4_extent_get_start(ext4_extent_t *extent) 52 { 53 return ((uint64_t)uint16_t_le2host(extent->start_hi)) << 32 | 54 ((uint64_t)uint32_t_le2host(extent->start_lo)); 55 56 } 57 41 58 uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *header) 42 59 { -
uspace/lib/ext4/libext4_extent.h
racd869e r8958a26 69 69 70 70 #define EXT4_EXTENT_MAGIC 0xF30A 71 #define EXT4_EXTENT_FIRST(header) \ 72 ((ext4_extent_t *) (((void *) (header)) + sizeof(ext4_extent_header_t))) 73 74 extern uint32_t ext4_extent_get_first_block(ext4_extent_t *); 75 extern uint16_t ext4_extent_get_block_count(ext4_extent_t *); 76 extern uint64_t ext4_extent_get_start(ext4_extent_t *); 71 77 72 78 extern uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *); -
uspace/lib/ext4/libext4_filesystem.c
racd869e r8958a26 301 301 block_t *block; 302 302 303 // TODO extents 303 /* Handle inode using extents */ 304 // TODO check "extents" feature in superblock ??? 304 305 if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_EXTENTS)) { 305 EXT4FS_DBG("Inode contains Extent");306 // TODO307 /*308 306 current_block = ext4_inode_get_extent_block(inode, iblock); 309 307 *fblock = current_block; 310 308 return EOK; 311 */312 309 313 310 } -
uspace/lib/ext4/libext4_inode.c
racd869e r8958a26 104 104 uint32_t ext4_inode_get_extent_block(ext4_inode_t *inode, uint64_t idx) 105 105 { 106 //ext4_extent_header_t *header = ext4_inode_get_extent_header(inode); 107 // TODO search required block 106 ext4_extent_header_t *header = ext4_inode_get_extent_header(inode); 107 108 if (ext4_extent_header_get_depth(header) == 0) { 109 110 ext4_extent_t *extent = EXT4_EXTENT_FIRST(header); 111 112 // TODO more effective searching? 113 for (uint16_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i) { 114 115 uint32_t first = ext4_extent_get_first_block(extent); 116 uint16_t count = ext4_extent_get_block_count(extent); 117 uint64_t block = 0; 118 119 if ((idx >= first) && (idx < first + count)) { 120 block = ext4_extent_get_start(extent) + idx; 121 block -= ext4_extent_get_first_block(extent); 122 return block; 123 } 124 // Go to the next extent 125 ++extent; 126 } 127 } 128 129 // TODO binary search for depth > 0 130 EXT4FS_DBG("NOT IMPLEMENTED !!!"); 108 131 return 0; 109 132 -
uspace/srv/fs/ext4fs/ext4fs_ops.c
racd869e r8958a26 718 718 719 719 ext4_filesystem_put_inode_ref(inode_ref); 720 720 721 return rc; 721 722 } 722 723 723 bool ext4fs_is_dots(const uint8_t *name, size_t name_size) { 724 bool ext4fs_is_dots(const uint8_t *name, size_t name_size) 725 { 724 726 if (name_size == 1 && name[0] == '.') { 725 727 return true; … … 745 747 746 748 // TODO check if directory uses HTree 747 if (ext4_filesystem_has_feature_compatible(inst->filesystem, EXT4_FEATURE_COMPAT_DIR_INDEX) 748 && ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_INDEX)) { 749 if (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_INDEX)) { 749 750 EXT4FS_DBG("Directory using HTree"); 750 751 } … … 802 803 if (found) { 803 804 rc = ext4_directory_iterator_next(&it); 804 if (rc != EOK) 805 if (rc != EOK) { 805 806 return rc; 807 } 806 808 next = it.current_offset; 807 809 } 808 810 809 811 rc = ext4_directory_iterator_fini(&it); 810 if (rc != EOK) 811 return rc; 812 if (rc != EOK) { 813 return rc; 814 } 812 815 813 816 if (found) { … … 832 835 block_t *block; 833 836 uint8_t *buffer; 834 835 // TODO Check extent836 if (ext4_filesystem_has_feature_incompatible(inst->filesystem, EXT4_FEATURE_INCOMPAT_EXTENTS)837 && ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) {838 EXT4FS_DBG("Extent found");839 }840 837 841 838 file_size = ext4_inode_get_size(inst->filesystem->superblock, … … 901 898 902 899 rc = block_put(block); 903 if (rc != EOK) 904 return rc; 900 if (rc != EOK) { 901 return rc; 902 } 905 903 906 904 *rbytes = bytes;
Note:
See TracChangeset
for help on using the changeset viewer.