Changeset f6fa2c2 in mainline
- 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
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/ext2info/ext2info.c
rc00e729 rf6fa2c2 117 117 uint32_t first_inode; 118 118 uint16_t inode_size; 119 uint32_t total_blocks; 120 uint32_t reserved_blocks; 121 uint32_t free_blocks; 122 uint32_t total_inodes; 123 uint32_t free_inodes; 124 uint32_t os; 119 125 120 126 int pos; … … 132 138 first_inode = ext2_superblock_get_first_inode(superblock); 133 139 inode_size = ext2_superblock_get_inode_size(superblock); 140 total_blocks = ext2_superblock_get_total_block_count(superblock); 141 reserved_blocks = ext2_superblock_get_reserved_block_count(superblock); 142 free_blocks = ext2_superblock_get_free_block_count(superblock); 143 total_inodes = ext2_superblock_get_total_inode_count(superblock); 144 free_inodes = ext2_superblock_get_free_inode_count(superblock); 145 os = ext2_superblock_get_os(superblock); 134 146 135 147 printf("Superblock:\n"); … … 144 156 printf(" Revision: %u.%hu\n", rev_major, rev_minor); 145 157 printf(" State: %hu\n", state); 158 printf(" Creator OS: %u\n", os); 146 159 printf(" First block: %u\n", first_block); 147 160 printf(" Block size: %u bytes (%u KiB)\n", block_size, block_size/1024); 148 161 printf(" Blocks per group: %u\n", blocks_per_group); 162 printf(" Total blocks: %u\n", total_blocks); 163 printf(" Reserved blocks: %u\n", reserved_blocks); 164 printf(" Free blocks: %u\n", free_blocks); 149 165 printf(" Fragment size: %u bytes (%u KiB)\n", fragment_size, 150 166 fragment_size/1024); … … 152 168 printf(" First inode: %u\n", first_inode); 153 169 printf(" Inode size: %hu bytes\n", inode_size); 170 printf(" Total inodes: %u\n", total_inodes); 171 printf(" Free inodes: %u\n", free_inodes); 154 172 155 printf(" UUID: "); 156 for (pos = 0; pos < 16; pos++) { 157 printf("%02x", superblock->uuid[pos]); 173 174 if (rev_major == 1) { 175 printf(" UUID: "); 176 for (pos = 0; pos < 16; pos++) { 177 printf("%02x", superblock->uuid[pos]); 178 } 179 printf("\n"); 180 181 printf(" Volume label: "); 182 for (pos = 0; pos < 16; pos++) { 183 c = superblock->volume_name[pos]; 184 if (c >= 32 && c < 128) { 185 putchar(c); 186 } 187 else { 188 putchar(' '); 189 } 190 } 191 printf("\n"); 158 192 } 159 printf("\n");160 161 printf(" Volume label: ");162 for (pos = 0; pos < 16; pos++) {163 c = superblock->volume_name[pos];164 if (c >= 32 && c < 128) {165 putchar(c);166 }167 else {168 putchar(' ');169 }170 }171 printf("\n");172 193 173 194 } -
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.