Changeset 343ccfd in mainline
- Timestamp:
- 2011-11-20T12:56:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ebeaaa06
- Parents:
- fe27eb4
- Location:
- uspace/lib/ext4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_directory.c
rfe27eb4 r343ccfd 49 49 } 50 50 51 void ext4_directory_entry_ll_set_inode(ext4_directory_entry_ll_t *de, 52 uint32_t inode) 53 { 54 de->inode = host2uint32_t_le(inode); 55 } 56 51 57 uint16_t ext4_directory_entry_ll_get_entry_length( 52 58 ext4_directory_entry_ll_t *de) 53 59 { 54 60 return uint16_t_le2host(de->entry_length); 61 } 62 63 void ext4_directory_entry_ll_set_entry_length(ext4_directory_entry_ll_t *de, 64 uint16_t length) 65 { 66 de->entry_length = host2uint16_t_le(length); 55 67 } 56 68 … … 60 72 if (ext4_superblock_get_rev_level(sb) == 0 && 61 73 ext4_superblock_get_minor_rev_level(sb) < 5) { 62 return ((uint16_t)de->name_length_high) << 8 | 63 ((uint16_t)de->name_length); 64 } 65 return de->name_length; 66 } 67 68 uint8_t ext4_directory_dx_root_info_get_hash_version(ext4_directory_dx_root_info_t *root_info) 69 { 70 return root_info->hash_version; 71 } 72 73 uint8_t ext4_directory_dx_root_info_get_info_length(ext4_directory_dx_root_info_t *root_info) 74 { 75 return root_info->info_length; 76 } 77 78 uint8_t ext4_directory_dx_root_info_get_indirect_levels(ext4_directory_dx_root_info_t *root_info) 79 { 80 return root_info->indirect_levels; 81 } 82 83 uint16_t ext4_directory_dx_countlimit_get_limit(ext4_directory_dx_countlimit_t *countlimit) 84 { 85 return uint16_t_le2host(countlimit->limit); 86 } 87 uint16_t ext4_directory_dx_countlimit_get_count(ext4_directory_dx_countlimit_t *countlimit) 88 { 89 return uint16_t_le2host(countlimit->count); 90 } 91 92 uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *entry) 93 { 94 return uint32_t_le2host(entry->hash); 95 } 96 97 uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *entry) 98 { 99 return uint32_t_le2host(entry->block); 100 } 101 74 75 return de->name_length; 76 } 77 78 return ((uint16_t)de->name_length_high) << 8 | 79 ((uint16_t)de->name_length); 80 81 82 } 83 84 void ext4_directory_entry_ll_set_name_length(ext4_superblock_t *sb, 85 ext4_directory_entry_ll_t *de, uint16_t length) 86 { 87 88 de->name_length = (length << 8) >> 8; 89 90 if (ext4_superblock_get_rev_level(sb) > 0 || 91 ext4_superblock_get_minor_rev_level(sb) >= 5) { 92 93 de->name_length_high = length >> 8; 94 } 95 96 } 102 97 103 98 -
uspace/lib/ext4/libext4_directory.h
rfe27eb4 r343ccfd 63 63 64 64 extern uint32_t ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *); 65 extern void ext4_directory_entry_ll_set_inode(ext4_directory_entry_ll_t *, 66 uint32_t); 65 67 extern uint16_t ext4_directory_entry_ll_get_entry_length( 66 68 ext4_directory_entry_ll_t *); 69 extern void ext4_directory_entry_ll_set_entry_length( 70 ext4_directory_entry_ll_t *, uint16_t); 67 71 extern uint16_t ext4_directory_entry_ll_get_name_length( 68 72 ext4_superblock_t *, ext4_directory_entry_ll_t *); 73 extern void ext4_directory_entry_ll_set_name_length(ext4_superblock_t *, 74 ext4_directory_entry_ll_t *, uint16_t); 69 75 70 76 extern int ext4_directory_iterator_init(ext4_directory_iterator_t *, -
uspace/lib/ext4/libext4_directory_index.c
rfe27eb4 r343ccfd 36 36 */ 37 37 38 #include <byteorder.h> 38 39 #include <errno.h> 39 40 #include "libext4.h" 41 42 43 uint8_t ext4_directory_dx_root_info_get_hash_version( 44 ext4_directory_dx_root_info_t *root_info) 45 { 46 return root_info->hash_version; 47 } 48 49 void ext4_directory_dx_root_info_set_hash_version( 50 ext4_directory_dx_root_info_t *root_info, uint8_t version) 51 { 52 root_info->hash_version = version; 53 } 54 55 uint8_t ext4_directory_dx_root_info_get_info_length( 56 ext4_directory_dx_root_info_t *root_info) 57 { 58 return root_info->info_length; 59 } 60 61 void ext4_directory_dx_root_info_set_info_length( 62 ext4_directory_dx_root_info_t *root_info, uint8_t info_length) 63 { 64 root_info->info_length = info_length; 65 } 66 67 uint8_t ext4_directory_dx_root_info_get_indirect_levels( 68 ext4_directory_dx_root_info_t *root_info) 69 { 70 return root_info->indirect_levels; 71 } 72 73 void ext4_directory_dx_root_info_set_indirect_levels( 74 ext4_directory_dx_root_info_t *root_info, uint8_t levels) 75 { 76 root_info->indirect_levels = levels; 77 } 78 79 uint16_t ext4_directory_dx_countlimit_get_limit( 80 ext4_directory_dx_countlimit_t *countlimit) 81 { 82 return uint16_t_le2host(countlimit->limit); 83 } 84 85 void ext4_directory_dx_countlimit_set_limit( 86 ext4_directory_dx_countlimit_t *countlimit, uint16_t limit) 87 { 88 countlimit->limit = host2uint16_t_le(limit); 89 } 90 91 uint16_t ext4_directory_dx_countlimit_get_count( 92 ext4_directory_dx_countlimit_t *countlimit) 93 { 94 return uint16_t_le2host(countlimit->count); 95 } 96 97 void ext4_directory_dx_countlimit_set_count( 98 ext4_directory_dx_countlimit_t *countlimit, uint16_t count) 99 { 100 countlimit->count = host2uint16_t_le(count); 101 } 102 103 uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *entry) 104 { 105 return uint32_t_le2host(entry->hash); 106 } 107 108 void ext4_directory_dx_entry_set_hash(ext4_directory_dx_entry_t *entry, 109 uint32_t hash) 110 { 111 entry->hash = host2uint32_t_le(hash); 112 } 113 114 uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *entry) 115 { 116 return uint32_t_le2host(entry->block); 117 } 118 119 void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *entry, 120 uint32_t block) 121 { 122 entry->block = host2uint32_t_le(block); 123 } 124 125 126 /**************************************************************************/ 127 40 128 41 129 static int ext4_directory_hinfo_init(ext4_hash_info_t *hinfo, block_t *root_block, -
uspace/lib/ext4/libext4_directory_index.h
rfe27eb4 r343ccfd 91 91 92 92 93 extern uint8_t ext4_directory_dx_root_info_get_hash_version(ext4_directory_dx_root_info_t *); 94 extern uint8_t ext4_directory_dx_root_info_get_info_length(ext4_directory_dx_root_info_t *); 95 extern uint8_t ext4_directory_dx_root_info_get_indirect_levels(ext4_directory_dx_root_info_t *); 93 extern uint8_t ext4_directory_dx_root_info_get_hash_version( 94 ext4_directory_dx_root_info_t *); 95 extern void ext4_directory_dx_root_info_set_hash_version( 96 ext4_directory_dx_root_info_t *, uint8_t); 97 extern uint8_t ext4_directory_dx_root_info_get_info_length( 98 ext4_directory_dx_root_info_t *); 99 extern void ext4_directory_dx_root_info_set_info_length( 100 ext4_directory_dx_root_info_t *, uint8_t); 101 extern uint8_t ext4_directory_dx_root_info_get_indirect_levels( 102 ext4_directory_dx_root_info_t *); 103 extern void ext4_directory_dx_root_info_set_indirect_levels( 104 ext4_directory_dx_root_info_t *, uint8_t); 96 105 97 extern uint16_t ext4_directory_dx_countlimit_get_limit(ext4_directory_dx_countlimit_t *); 98 extern uint16_t ext4_directory_dx_countlimit_get_count(ext4_directory_dx_countlimit_t *); 106 extern uint16_t ext4_directory_dx_countlimit_get_limit( 107 ext4_directory_dx_countlimit_t *); 108 extern void ext4_directory_dx_countlimit_set_limit( 109 ext4_directory_dx_countlimit_t *, uint16_t); 110 extern uint16_t ext4_directory_dx_countlimit_get_count( 111 ext4_directory_dx_countlimit_t *); 112 extern void ext4_directory_dx_countlimit_set_count( 113 ext4_directory_dx_countlimit_t *, uint16_t); 99 114 100 115 extern uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *); 116 extern void ext4_directory_dx_entry_set_hash(ext4_directory_dx_entry_t *, 117 uint32_t); 101 118 extern uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *); 119 void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *, uint32_t); 120 121 /*********************************************************************************/ 102 122 103 123 extern int ext4_directory_dx_find_entry(ext4_directory_iterator_t *, -
uspace/lib/ext4/libext4_extent.c
rfe27eb4 r343ccfd 44 44 } 45 45 46 void ext4_extent_set_first_block(ext4_extent_t *extent, uint32_t first_block) 47 { 48 extent->first_block = host2uint32_t_le(first_block); 49 } 50 46 51 uint16_t ext4_extent_get_block_count(ext4_extent_t *extent) 47 52 { 48 53 return uint16_t_le2host(extent->block_count); 54 } 55 56 void ext4_extent_set_block_count(ext4_extent_t *extent, uint16_t block_count) 57 { 58 extent->block_count = host2uint16_t_le(block_count); 49 59 } 50 60 … … 53 63 return ((uint64_t)uint16_t_le2host(extent->start_hi)) << 32 | 54 64 ((uint64_t)uint32_t_le2host(extent->start_lo)); 65 } 55 66 67 void ext4_extent_set_start(ext4_extent_t *extent, uint64_t start) 68 { 69 extent->start_lo = host2uint32_t_le((start << 32) >> 32); 70 extent->start_hi = host2uint16_t_le((uint16_t)(start >> 32)); 56 71 } 57 72 … … 61 76 } 62 77 78 void ext4_extent_index_set_first_block(ext4_extent_index_t *index, 79 uint32_t first) 80 { 81 index->first_block = host2uint32_t_le(first); 82 } 83 63 84 uint64_t ext4_extent_index_get_leaf(ext4_extent_index_t *index) 64 85 { 65 86 return ((uint64_t)uint16_t_le2host(index->leaf_hi)) << 32 | 66 ((uint64_t)uint32_t_le2host(index->leaf_lo)); 87 ((uint64_t)uint32_t_le2host(index->leaf_lo)); 88 } 89 90 void ext4_extent_index_set_leaf(ext4_extent_index_t *index, uint64_t leaf) 91 { 92 index->leaf_lo = host2uint32_t_le((leaf << 32) >> 32); 93 index->leaf_hi = host2uint16_t_le((uint16_t)(leaf >> 32)); 67 94 } 68 95 … … 72 99 } 73 100 101 void ext4_extent_header_set_magic(ext4_extent_header_t *header, uint16_t magic) 102 { 103 header->magic = host2uint16_t_le(magic); 104 } 105 74 106 uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *header) 75 107 { 76 108 return uint16_t_le2host(header->entries_count); 109 } 110 111 void ext4_extent_header_set_entries_count(ext4_extent_header_t *header, 112 uint16_t count) 113 { 114 header->entries_count = host2uint16_t_le(count); 77 115 } 78 116 … … 82 120 } 83 121 122 void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *header, 123 uint16_t max_count) 124 { 125 header->max_entries_count = host2uint16_t_le(max_count); 126 } 127 84 128 uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *header) 85 129 { 86 130 return uint16_t_le2host(header->depth); 131 } 132 133 void ext4_extent_header_set_depth(ext4_extent_header_t *header, uint16_t depth) 134 { 135 header->depth = host2uint16_t_le(depth); 87 136 } 88 137 … … 92 141 } 93 142 143 void ext4_extent_header_set_generation(ext4_extent_header_t *header, 144 uint32_t generation) 145 { 146 header->generation = host2uint32_t_le(generation); 147 } 148 94 149 /** 95 150 * @} -
uspace/lib/ext4/libext4_extent.h
rfe27eb4 r343ccfd 75 75 76 76 extern uint32_t ext4_extent_get_first_block(ext4_extent_t *); 77 extern void ext4_extent_set_first_block(ext4_extent_t *, uint32_t); 77 78 extern uint16_t ext4_extent_get_block_count(ext4_extent_t *); 79 extern void ext4_extent_set_block_count(ext4_extent_t *, uint16_t); 78 80 extern uint64_t ext4_extent_get_start(ext4_extent_t *); 81 extern void ext4_extent_set_start(ext4_extent_t *, uint64_t); 79 82 80 83 extern uint32_t ext4_extent_index_get_first_block(ext4_extent_index_t *); 84 extern void ext4_extent_index_set_first_block(ext4_extent_index_t *, uint32_t); 81 85 extern uint64_t ext4_extent_index_get_leaf(ext4_extent_index_t *); 86 extern void ext4_extent_index_set_leaf(ext4_extent_index_t *, uint64_t); 82 87 83 88 extern uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *); 89 extern void ext4_extent_header_set_magic(ext4_extent_header_t *, uint16_t); 84 90 extern uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *); 91 extern void ext4_extent_header_set_entries_count(ext4_extent_header_t *, 92 uint16_t); 85 93 extern uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *); 94 extern void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *, 95 uint16_t); 86 96 extern uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *); 97 extern void ext4_extent_header_set_depth(ext4_extent_header_t *, uint16_t); 87 98 extern uint32_t ext4_extent_header_get_generation(ext4_extent_header_t *); 99 extern void ext4_extent_header_set_generation(ext4_extent_header_t *, uint32_t); 88 100 89 101 #endif -
uspace/lib/ext4/libext4_inode.c
rfe27eb4 r343ccfd 236 236 } 237 237 238 uint64_t ext4_get_inode_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb) 239 { 240 if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX) { 241 return ((uint32_t)uint16_t_le2host(inode->osd2.linux2.file_acl_high)) << 16 | 242 (uint32_t_le2host(inode->file_acl_lo)); 243 } 244 245 return uint32_t_le2host(inode->file_acl_lo); 246 } 247 248 void ext4_set_inode_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb, 249 uint64_t file_acl) 250 { 251 inode->file_acl_lo = host2uint32_t_le((file_acl << 32) >> 32); 252 253 if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX) { 254 inode->osd2.linux2.file_acl_high = host2uint16_t_le(file_acl >> 32); 255 } 256 } 257 238 258 /***********************************************************************/ 239 259 -
uspace/lib/ext4/libext4_inode.h
rfe27eb4 r343ccfd 84 84 uint32_t author; 85 85 } hurd2; 86 struct {87 uint16_t reserved1; /* Obsoleted fragment number/size which are removed in ext4 */88 uint16_t file_acl_high;89 uint32_t reserved2[2];90 } masix2;91 86 } __attribute__ ((packed)) osd2; 92 87 … … 173 168 extern uint32_t ext4_inode_get_generation(ext4_inode_t *); 174 169 extern void ext4_inode_set_generation(ext4_inode_t *, uint32_t); 175 /* 176 uint32_t file_acl_lo; // File ACL 170 extern uint64_t ext4_get_inode_file_acl(ext4_inode_t *, ext4_superblock_t *); 171 extern void ext4_set_inode_file_acl(ext4_inode_t *, ext4_superblock_t *, uint64_t); 172 /* 177 173 uint16_t extra_isize; 178 174 uint32_t ctime_extra; // Extra change time (nsec << 2 | epoch)
Note:
See TracChangeset
for help on using the changeset viewer.