Changeset 3712434 in mainline for uspace/lib/ext4/libext4_superblock.c
- Timestamp:
- 2011-10-05T12:48:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9b9d37bb
- Parents:
- 3711e7e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_superblock.c
r3711e7e r3712434 42 42 #include "libext4.h" 43 43 44 /** 45 * TODO doxy 46 */ 44 uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *sb) 45 { 46 return uint32_t_le2host(sb->inodes_count); 47 } 48 49 uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *sb) 50 { 51 return ((uint64_t)uint32_t_le2host(sb->blocks_count_hi) << 32) | 52 uint32_t_le2host(sb->blocks_count_lo); 53 } 54 55 uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *sb) 56 { 57 return ((uint64_t)uint32_t_le2host(sb->reserved_blocks_count_hi) << 32) | 58 uint32_t_le2host(sb->reserved_blocks_count_lo); 59 } 60 61 uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *sb) 62 { 63 return ((uint64_t)uint32_t_le2host(sb->free_blocks_count_hi) << 32) | 64 uint32_t_le2host(sb->free_blocks_count_lo); 65 } 66 67 uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *sb) 68 { 69 return uint32_t_le2host(sb->free_inodes_count); 70 } 71 72 uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *sb) 73 { 74 return uint32_t_le2host(sb->first_data_block); 75 } 76 77 uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *sb) 78 { 79 return uint32_t_le2host(sb->log_block_size); 80 } 81 82 uint32_t ext4_superblock_get_block_size(ext4_superblock_t *sb) 83 { 84 return 1024 << ext4_superblock_get_log_block_size(sb); 85 } 86 87 88 uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *sb) 89 { 90 return uint32_t_le2host(sb->blocks_per_group); 91 } 92 93 uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *sb) 94 { 95 return uint32_t_le2host(sb->inodes_per_group); 96 } 97 98 uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *sb) 99 { 100 return uint32_t_le2host(sb->mount_time); 101 } 102 103 uint32_t ext4_superblock_get_write_time(ext4_superblock_t *sb) 104 { 105 return uint32_t_le2host(sb->write_time); 106 } 107 108 uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *sb) 109 { 110 return uint16_t_le2host(sb->mount_count); 111 } 112 113 uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *sb) 114 { 115 return uint16_t_le2host(sb->max_mount_count); 116 } 117 47 118 uint16_t ext4_superblock_get_magic(ext4_superblock_t *sb) 48 119 { … … 50 121 } 51 122 52 /** 53 * TODO doxy 54 */ 55 uint32_t ext4_superblock_get_first_block(ext4_superblock_t *sb) 56 { 57 return uint32_t_le2host(sb->first_data_block); 58 } 59 60 /** 61 * TODO doxy 62 */ 63 uint32_t ext4_superblock_get_block_size_log2(ext4_superblock_t *sb) 64 { 65 return uint32_t_le2host(sb->log_block_size); 66 } 67 68 /** 69 * TODO doxy 70 */ 71 uint32_t ext4_superblock_get_block_size(ext4_superblock_t *sb) 72 { 73 return 1024 << ext4_superblock_get_block_size_log2(sb); 74 } 75 76 /** 77 * TODO doxy 78 */ 123 uint16_t ext4_superblock_get_state(ext4_superblock_t *sb) 124 { 125 return uint16_t_le2host(sb->state); 126 } 127 128 uint16_t ext4_superblock_get_errors(ext4_superblock_t *sb) 129 { 130 return uint16_t_le2host(sb->errors); 131 } 132 133 134 uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *sb) 135 { 136 return uint16_t_le2host(sb->minor_rev_level); 137 } 138 139 uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *sb) 140 { 141 return uint32_t_le2host(sb->last_check_time); 142 } 143 144 uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *sb){ 145 return uint32_t_le2host(sb->check_interval); 146 } 147 148 uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *sb) 149 { 150 return uint32_t_le2host(sb->creator_os); 151 } 152 79 153 uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *sb) 80 154 { … … 82 156 } 83 157 84 /**85 * TODO doxy86 */87 158 uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *sb) 88 159 { … … 93 164 } 94 165 95 /** 96 * TODO doxy 166 uint16_t ext4_superblock_get_block_group_number(ext4_superblock_t *sb) 167 { 168 return uint16_t_le2host(sb->block_group_number); 169 } 170 171 uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *sb) 172 { 173 return uint32_t_le2host(sb->features_compatible); 174 } 175 176 uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *sb) 177 { 178 return uint32_t_le2host(sb->features_incompatible); 179 } 180 181 uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *sb) 182 { 183 return uint32_t_le2host(sb->features_read_only); 184 } 185 186 187 /* 188 * More complex superblock functions 97 189 */ 98 uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *sb) 99 { 100 return uint32_t_le2host(sb->inodes_per_group); 101 } 102 103 /** 104 * TODO doxy 105 */ 106 uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *sb) 107 { 108 return uint32_t_le2host(sb->features_compatible); 109 } 110 111 /** 112 * TODO doxy 113 */ 114 uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *sb) 115 { 116 return uint32_t_le2host(sb->features_incompatible); 117 } 118 119 /** 120 * TODO doxy 121 */ 122 uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *sb) 123 { 124 return uint32_t_le2host(sb->features_read_only); 125 } 126 127 128 /** 129 * TODO doxy 130 */ 190 131 191 int ext4_superblock_read_direct(service_id_t service_id, 132 192 ext4_superblock_t **superblock) … … 153 213 } 154 214 155 /**156 * TODO doxy157 */158 215 int ext4_superblock_check_sanity(ext4_superblock_t *sb) 159 216 {
Note:
See TracChangeset
for help on using the changeset viewer.