Changeset 3d93289a in mainline
- Timestamp:
- 2012-04-18T07:18:56Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0c37135
- Parents:
- 7b16549
- Location:
- uspace/lib/ext4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_block_group.c
r7b16549 r3d93289a 39 39 #include "libext4.h" 40 40 41 /** Get address of block with data block bitmap. 42 * 43 * @param bg pointer to block group 44 * @param sb pointer to superblock 45 * @return address of block with block bitmap 46 */ 41 47 uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *bg, 42 48 ext4_superblock_t *sb) … … 50 56 } 51 57 58 /** Set address of block with data block bitmap. 59 * 60 * @param bg pointer to block group 61 * @param sb pointer to superblock 62 * @param block_bitmap address of block with block bitmap 63 */ 52 64 void ext4_block_group_set_block_bitmap(ext4_block_group_t *bg, 53 65 ext4_superblock_t *sb, uint64_t block_bitmap) … … 60 72 } 61 73 74 /** Get address of block with i-node bitmap. 75 * 76 * @param bg pointer to block group 77 * @param sb pointer to superblock 78 * @return address of block with i-node bitmap 79 */ 62 80 uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *bg, 63 81 ext4_superblock_t *sb) … … 72 90 } 73 91 92 /** Set address of block with i-node bitmap. 93 * 94 * @param bg pointer to block group 95 * @param sb pointer to superblock 96 * @param inode_bitmap address of block with i-node bitmap 97 */ 74 98 void ext4_block_group_set_inode_bitmap(ext4_block_group_t *bg, 75 99 ext4_superblock_t *sb, uint64_t inode_bitmap) … … 82 106 } 83 107 108 /** Get address of the first block of the i-node table. 109 * 110 * @param bg pointer to block group 111 * @param sb pointer to superblock 112 * @return address of first block of i-node table 113 */ 84 114 uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *bg, 85 115 ext4_superblock_t *sb) … … 93 123 } 94 124 125 /** Set address of the first block of the i-node table. 126 * 127 * @param bg pointer to block group 128 * @param sb pointer to superblock 129 * @param inode_table_first address of first block of i-node table 130 */ 95 131 void ext4_block_group_set_inode_table_first_block(ext4_block_group_t *bg, 96 ext4_superblock_t *sb, uint64_t ino_tbl_first) 97 { 98 bg->inode_table_first_block_lo = host2uint32_t_le((ino_tbl_first << 32) >> 32); 99 100 if (ext4_superblock_get_desc_size(sb) > EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE) { 101 bg->inode_table_first_block_hi = host2uint32_t_le(ino_tbl_first >> 32); 102 } 103 } 104 132 ext4_superblock_t *sb, uint64_t inode_table_first) 133 { 134 bg->inode_table_first_block_lo = 135 host2uint32_t_le((inode_table_first << 32) >> 32); 136 137 if (ext4_superblock_get_desc_size(sb) > 138 EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE) { 139 140 bg->inode_table_first_block_hi = 141 host2uint32_t_le(inode_table_first >> 32); 142 } 143 } 144 145 /** Get number of free blocks in block group. 146 * 147 * @param bg pointer to block group 148 * @param sb pointer to superblock 149 * @return number of free blocks in block group 150 */ 105 151 uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *bg, 106 152 ext4_superblock_t *sb) 107 153 { 108 if (ext4_superblock_get_desc_size(sb) > EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE) { 154 if (ext4_superblock_get_desc_size(sb) > 155 EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE) { 156 109 157 return ((uint32_t)uint16_t_le2host(bg->free_blocks_count_hi) << 16) | 110 158 uint16_t_le2host(bg->free_blocks_count_lo); … … 114 162 } 115 163 164 /** Set number of free blocks in block group. 165 * 166 * @param bg pointer to block group 167 * @param sb pointer to superblock 168 * @param value number of free blocks in block group 169 */ 116 170 void ext4_block_group_set_free_blocks_count(ext4_block_group_t *bg, 117 171 ext4_superblock_t *sb, uint32_t value) … … 123 177 } 124 178 179 /** Get number of free i-nodes in block group. 180 * 181 * @param bg pointer to block group 182 * @param sb pointer to superblock 183 * @return number of free i-nodes in block group 184 */ 125 185 uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *bg, 126 186 ext4_superblock_t *sb) … … 134 194 } 135 195 196 /** Set number of free i-nodes in block group. 197 * 198 * @param bg pointer to block group 199 * @param sb pointer to superblock 200 * @param value number of free i-nodes in block group 201 */ 136 202 void ext4_block_group_set_free_inodes_count(ext4_block_group_t *bg, 137 203 ext4_superblock_t *sb, uint32_t value) … … 143 209 } 144 210 145 211 /** Get number of used directories in block group. 212 * 213 * @param bg pointer to block group 214 * @param sb pointer to superblock 215 * @return number of used directories in block group 216 */ 146 217 uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *bg, 147 218 ext4_superblock_t *sb) … … 155 226 } 156 227 228 /** Set number of used directories in block group. 229 * 230 * @param bg pointer to block group 231 * @param sb pointer to superblock 232 * @param value number of used directories in block group 233 */ 157 234 void ext4_block_group_set_used_dirs_count(ext4_block_group_t *bg, 158 235 ext4_superblock_t *sb, uint32_t count) … … 164 241 } 165 242 243 /** Get flags of block group. 244 * 245 * @param bg pointer to block group 246 * @return flags of block group 247 */ 166 248 uint16_t ext4_block_group_get_flags(ext4_block_group_t *bg) 167 249 { … … 169 251 } 170 252 253 /** Set flags for block group. 254 * 255 * @param bg pointer to block group 256 * @param flags flags for block group 257 */ 171 258 void ext4_block_group_set_flags(ext4_block_group_t *bg, uint16_t flags) 172 259 { … … 174 261 } 175 262 263 /** Get number of unused i-nodes. 264 * 265 * @param bg pointer to block group 266 * @param sb pointer to superblock 267 * @return number of unused i-nodes 268 */ 176 269 uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *bg, 177 270 ext4_superblock_t *sb) … … 185 278 } 186 279 280 /** Set number of unused i-nodes. 281 * 282 * @param bg pointer to block group 283 * @param sb pointer to superblock 284 * @param value number of unused i-nodes 285 */ 187 286 void ext4_block_group_set_itable_unused(ext4_block_group_t *bg, 188 287 ext4_superblock_t *sb, uint32_t value) … … 195 294 } 196 295 296 /** Get checksum of block group. 297 * 298 * @param bg pointer to block group 299 * @return checksum of block group 300 */ 197 301 uint16_t ext4_block_group_get_checksum(ext4_block_group_t *bg) 198 302 { … … 200 304 } 201 305 306 /** Set checksum of block group. 307 * 308 * @param bg pointer to block group 309 * @param checksum cheksum of block group 310 */ 202 311 void ext4_block_group_set_checksum(ext4_block_group_t *bg, uint16_t checksum) 203 312 { … … 205 314 } 206 315 207 // Flags operations 316 /** Check if block group has a flag. 317 * 318 * @param bg pointer to block group 319 * @param flag flag to be checked 320 * @return true if flag is set to 1 321 */ 208 322 bool ext4_block_group_has_flag(ext4_block_group_t *bg, uint32_t flag) 209 323 { … … 214 328 } 215 329 330 /** Set (add) flag of block group. 331 * 332 * @param bg pointer to block group 333 * @param flag flag to be set 334 */ 335 void ext4_block_group_set_flag(ext4_block_group_t *bg, uint32_t set_flag) 336 { 337 uint32_t flags = ext4_block_group_get_flags(bg); 338 flags = flags | set_flag; 339 ext4_block_group_set_flags(bg, flags); 340 } 341 342 /** Clear (remove) flag of block group. 343 * 344 * @param bg pointer to block group 345 * @param flag flag to be cleared 346 */ 216 347 void ext4_block_group_clear_flag(ext4_block_group_t *bg, uint32_t clear_flag) 217 348 { -
uspace/lib/ext4/libext4_block_group.h
r7b16549 r3d93289a 74 74 75 75 extern bool ext4_block_group_has_flag(ext4_block_group_t *, uint32_t); 76 extern void ext4_block_group_set_flag(ext4_block_group_t *, uint32_t); 76 77 extern void ext4_block_group_clear_flag(ext4_block_group_t *, uint32_t); 77 78
Note:
See TracChangeset
for help on using the changeset viewer.