Changeset f6fa2c2 in mainline for uspace/lib/ext2
- Timestamp:
- 2011-02-14T20:24:40Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3949e8a0
- Parents:
- c00e729
- Location:
- uspace/lib/ext2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext2/libext2.h
rc00e729 rf6fa2c2 41 41 42 42 typedef struct ext2_superblock { 43 uint8_t unused[20]; 43 uint32_t total_inode_count; // Total number of inodes 44 uint32_t total_block_count; // Total number of blocks 45 uint32_t reserved_block_count; // Total number of reserved blocks 46 uint32_t free_block_count; // Total number of free blocks 47 uint32_t free_inode_count; // Total number of free inodes 44 48 uint32_t first_block; // Block containing the superblock (either 0 or 1) 45 49 uint32_t block_size_log2; // log_2(block_size) … … 51 55 uint16_t magic; // Magic value 52 56 uint16_t state; // State (mounted/unmounted) 57 uint16_t error_behavior; // What to do when errors are encountered 53 58 uint16_t rev_minor; // Minor revision level 54 uint8_t unused3[ 12];55 uint32_t creator_os;59 uint8_t unused3[8]; 60 uint32_t os; // OS that created the filesystem 56 61 uint32_t rev_major; // Major revision level 57 uint8_t unused4[ 8];62 uint8_t unused4[4]; 58 63 59 64 // Following is for ext2 revision 1 only … … 96 101 inline uint16_t ext2_superblock_get_rev_minor(ext2_superblock_t *); 97 102 inline uint32_t ext2_superblock_get_rev_major(ext2_superblock_t *); 98 inline uint32_t ext2_superblock_get_ creator_os(ext2_superblock_t *);103 inline uint32_t ext2_superblock_get_os(ext2_superblock_t *); 99 104 inline uint32_t ext2_superblock_get_first_inode(ext2_superblock_t *); 100 105 inline uint16_t ext2_superblock_get_inode_size(ext2_superblock_t *); 106 inline uint32_t ext2_superblock_get_total_inode_count(ext2_superblock_t *); 107 inline uint32_t ext2_superblock_get_total_block_count(ext2_superblock_t *); 108 inline uint32_t ext2_superblock_get_reserved_block_count(ext2_superblock_t *); 109 inline uint32_t ext2_superblock_get_free_block_count(ext2_superblock_t *); 110 inline uint32_t ext2_superblock_get_free_inode_count(ext2_superblock_t *); 101 111 102 112 extern int ext2_superblock_read_direct(devmap_handle_t, ext2_superblock_t **); -
uspace/lib/ext2/libext2_superblock.c
rc00e729 rf6fa2c2 186 186 } 187 187 188 /** 189 * Get total inode count 190 * 191 * @param sb pointer to superblock 192 */ 193 inline uint32_t ext2_superblock_get_total_inode_count(ext2_superblock_t *sb) 194 { 195 return uint32_t_le2host(sb->total_inode_count); 196 } 197 198 /** 199 * Get total block count 200 * 201 * @param sb pointer to superblock 202 */ 203 inline uint32_t ext2_superblock_get_total_block_count(ext2_superblock_t *sb) 204 { 205 return uint32_t_le2host(sb->total_block_count); 206 } 207 208 /** 209 * Get amount of blocks reserved for the superuser 210 * 211 * @param sb pointer to superblock 212 */ 213 inline uint32_t ext2_superblock_get_reserved_block_count(ext2_superblock_t *sb) 214 { 215 return uint32_t_le2host(sb->reserved_block_count); 216 } 217 218 /** 219 * Get amount of free blocks 220 * 221 * @param sb pointer to superblock 222 */ 223 inline uint32_t ext2_superblock_get_free_block_count(ext2_superblock_t *sb) 224 { 225 return uint32_t_le2host(sb->free_block_count); 226 } 227 228 /** 229 * Get amount of free inodes 230 * 231 * @param sb pointer to superblock 232 */ 233 inline uint32_t ext2_superblock_get_free_inode_count(ext2_superblock_t *sb) 234 { 235 return uint32_t_le2host(sb->free_inode_count); 236 } 237 238 /** 239 * Get id of operating system that created the filesystem 240 * 241 * @param sb pointer to superblock 242 */ 243 inline uint32_t ext2_superblock_get_os(ext2_superblock_t *sb) 244 { 245 return uint32_t_le2host(sb->os); 246 } 188 247 189 248 /** Read a superblock directly from device (i.e. no libblock cache)
Note:
See TracChangeset
for help on using the changeset viewer.