1 /* Super block table. The root file system and every mounted file system
2 * has an entry here. The entry holds information about the sizes of the bit
5 * A super_block slot is free if s_dev == NO_DEV.
12 /* super_block (on-disk part) was taken from linux/include/linux/ext2_fs.h */
13 EXTERN
struct super_block
{
14 u32_t s_inodes_count
; /* Inodes count */
15 u32_t s_blocks_count
; /* Blocks count */
16 u32_t s_r_blocks_count
; /* Reserved blocks count */
17 u32_t s_free_blocks_count
; /* Free blocks count */
18 u32_t s_free_inodes_count
; /* Free inodes count */
19 u32_t s_first_data_block
; /* First Data Block */
20 u32_t s_log_block_size
; /* Block size */
21 u32_t s_log_frag_size
; /* Fragment size */
22 u32_t s_blocks_per_group
; /* # Blocks per group */
23 u32_t s_frags_per_group
; /* # Fragments per group */
24 u32_t s_inodes_per_group
; /* # Inodes per group */
25 u32_t s_mtime
; /* Mount time */
26 u32_t s_wtime
; /* Write time */
27 u16_t s_mnt_count
; /* Mount count */
28 u16_t s_max_mnt_count
; /* Maximal mount count */
29 u16_t s_magic
; /* Magic signature */
30 u16_t s_state
; /* File system state */
31 u16_t s_errors
; /* Behaviour when detecting errors */
32 u16_t s_minor_rev_level
; /* minor revision level */
33 u32_t s_lastcheck
; /* time of last check */
34 u32_t s_checkinterval
; /* max. time between checks */
35 u32_t s_creator_os
; /* OS */
36 u32_t s_rev_level
; /* Revision level */
37 u16_t s_def_resuid
; /* Default uid for reserved blocks */
38 u16_t s_def_resgid
; /* Default gid for reserved blocks */
40 * These fields are for EXT2_DYNAMIC_REV superblocks only.
42 * Note: the difference between the compatible feature set and
43 * the incompatible feature set is that if there is a bit set
44 * in the incompatible feature set that the kernel doesn't
45 * know about, it should refuse to mount the filesystem.
47 * e2fsck's requirements are more strict; if it doesn't know
48 * about a feature in either the compatible or incompatible
49 * feature set, it must abort and not try to meddle with
50 * things it doesn't understand...
52 u32_t s_first_ino
; /* First non-reserved inode */
53 u16_t s_inode_size
; /* size of inode structure */
54 u16_t s_block_group_nr
; /* block group # of this superblock */
55 u32_t s_feature_compat
; /* compatible feature set */
56 u32_t s_feature_incompat
; /* incompatible feature set */
57 u32_t s_feature_ro_compat
; /* readonly-compatible feature set */
58 u8_t s_uuid
[16]; /* 128-bit uuid for volume */
59 char s_volume_name
[16]; /* volume name */
60 char s_last_mounted
[64]; /* directory where last mounted */
61 u32_t s_algorithm_usage_bitmap
; /* For compression */
63 * Performance hints. Directory preallocation should only
64 * happen if the EXT2_COMPAT_PREALLOC flag is on.
66 u8_t s_prealloc_blocks
; /* Nr of blocks to try to preallocate*/
67 u8_t s_prealloc_dir_blocks
; /* Nr to preallocate for dirs */
70 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
72 u8_t s_journal_uuid
[16]; /* uuid of journal superblock */
73 u32_t s_journal_inum
; /* inode number of journal file */
74 u32_t s_journal_dev
; /* device number of journal file */
75 u32_t s_last_orphan
; /* start of list of inodes to delete */
76 u32_t s_hash_seed
[4]; /* HTREE hash seed */
77 u8_t s_def_hash_version
; /* Default hash version to use */
78 u8_t s_reserved_char_pad
;
79 u16_t s_reserved_word_pad
;
80 u32_t s_default_mount_opts
;
81 u32_t s_first_meta_bg
; /* First metablock block group */
82 u32_t s_reserved
[190]; /* Padding to the end of the block */
84 /* The following items are only used when the super_block is in memory. */
85 u32_t s_inodes_per_block
; /* Number of inodes per block */
86 u32_t s_itb_per_group
; /* Number of inode table blocks per group */
87 u32_t s_gdb_count
; /* Number of group descriptor blocks */
88 u32_t s_desc_per_block
; /* Number of group descriptors per block */
89 u32_t s_groups_count
; /* Number of groups in the fs */
90 u8_t s_blocksize_bits
; /* Used to calculate offsets
92 * always s_log_block_size+10.
94 struct group_desc
*s_group_desc
; /* Group descriptors read into RAM */
96 u16_t s_block_size
; /* block size in bytes. */
97 u16_t s_sectors_in_block
; /* s_block_size / 512 */
98 u32_t s_max_size
; /* maximum file size on this device */
99 dev_t s_dev
; /* whose super block is this? */
100 int s_rd_only
; /* set to 1 if file sys mounted read only */
101 block_t s_bsearch
; /* all data blocks below this block are in use*/
102 int s_igsearch
; /* all groups below this one have no free inodes */
103 u32_t s_dirs_counter
;
105 } *superblock
, *ondisk_superblock
;
108 /* Structure of a blocks group descriptor.
109 * On disk stored in little endian format.
113 u32_t block_bitmap
; /* Blocks bitmap block */
114 u32_t inode_bitmap
; /* Inodes bitmap block */
115 u32_t inode_table
; /* Inodes table block */
116 u16_t free_blocks_count
; /* Free blocks count */
117 u16_t free_inodes_count
; /* Free inodes count */
118 u16_t used_dirs_count
; /* Directories count */
123 #define IMAP 0 /* operating on the inode bit map */
124 #define BMAP 1 /* operating on the block bit map */
125 #define IMAPD 2 /* operating on the inode bit map, inode is dir */
127 #endif /* EXT2_SUPER_H */