1 /* Including <linux/fs.h> became more and more painful.
2 Below a very abbreviated version of some declarations,
3 only designed to be able to check a magic number
4 in case no filesystem type was given. */
9 #define BLKGETSIZE 0x1260 /* return device size */
11 /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
12 #define BLKGETSIZE _IO(0x12,96)
16 #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
17 #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
18 struct minix_super_block
{
22 #define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
24 #define ISODCL(from, to) (to - from + 1)
25 #define ISO_STANDARD_ID "CD001"
26 struct iso_volume_descriptor
{
27 char type
[ISODCL(1,1)]; /* 711 */
29 char version
[ISODCL(7,7)];
30 char data
[ISODCL(8,2048)];
33 #define HS_STANDARD_ID "CDROM"
34 struct hs_volume_descriptor
{
35 char foo
[ISODCL ( 1, 8)]; /* 733 */
36 char type
[ISODCL ( 9, 9)]; /* 711 */
37 char id
[ISODCL ( 10, 14)];
38 char version
[ISODCL ( 15, 15)]; /* 711 */
39 char data
[ISODCL(16,2048)];
42 #define EXT_SUPER_MAGIC 0x137D
43 struct ext_super_block
{
47 #define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
49 #define EXT2_PRE_02B_MAGIC 0xEF51
50 #define EXT2_SUPER_MAGIC 0xEF53
51 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
52 struct ext2_super_block
{
56 u_char s_feature_compat
[4];
57 u_char s_feature_incompat
[4];
58 u_char s_feature_ro_compat
[4];
60 u_char s_volume_name
[16];
62 u_char s_journal_inum
[4]; /* ext3 only */
64 #define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
66 struct reiserfs_super_block
68 u_char s_block_count
[4];
69 u_char s_free_blocks
[4];
70 u_char s_root_block
[4];
71 u_char s_journal_block
[4];
72 u_char s_journal_dev
[4];
73 u_char s_orig_journal_size
[4];
74 u_char s_journal_trans_max
[4];
75 u_char s_journal_block_count
[4];
76 u_char s_journal_max_batch
[4];
77 u_char s_journal_max_commit_age
[4];
78 u_char s_journal_max_trans_age
[4];
79 u_char s_blocksize
[2];
80 u_char s_oid_maxsize
[2];
81 u_char s_oid_cursize
[2];
85 #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
86 #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
87 #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
88 /* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
89 #define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
91 #define _XIAFS_SUPER_MAGIC 0x012FD16D
92 struct xiafs_super_block
{
93 u_char s_boot_segment
[512]; /* 1st sector reserved for boot */
97 #define xiafsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
98 (((uint) s.s_magic[2]) << 16) + \
99 (((uint) s.s_magic[3]) << 24))
101 /* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */
102 #define UFS_SUPER_MAGIC 0x00011954
103 struct ufs_super_block
{
104 u_char s_dummy
[0x55c];
107 #define ufsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
108 (((uint) s.s_magic[2]) << 16) + \
109 (((uint) s.s_magic[3]) << 24))
111 /* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */
112 #define NTFS_SUPER_MAGIC "NTFS"
113 struct ntfs_super_block
{
118 /* From inspection of a few FAT filesystems - aeb */
119 /* Unfortunately I find almost the same thing on an extended partition;
120 it looks like a primary has some directory entries where the extended
121 has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */
122 struct fat_super_block
{
124 u_char s_os
[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
125 /* mtools-3.9.4 writes "MTOOL394" */
127 u_char s_label
[11]; /* for DOS? */
128 u_char s_fs
[8]; /* "FAT12 " or "FAT16 " or all zero */
129 /* OS/2 BM has "FAT " here. */
131 u_char s_label2
[11]; /* for Windows? */
132 u_char s_fs2
[8]; /* garbage or "FAT32 " */
135 #define XFS_SUPER_MAGIC "XFSB"
136 struct xfs_super_block
{
144 #define CRAMFS_SUPER_MAGIC 0x28cd3d45
145 struct cramfs_super_block
{
150 #define cramfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
151 (((uint) s.s_magic[2]) << 16) + \
152 (((uint) s.s_magic[3]) << 24))
154 #define HFS_SUPER_MAGIC 0x4244
155 struct hfs_super_block
{
160 #define hfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
161 #define hfsblksize(s) ((uint) s.s_blksize[0] + \
162 (((uint) s.s_blksize[1]) << 8) + \
163 (((uint) s.s_blksize[2]) << 16) + \
164 (((uint) s.s_blksize[3]) << 24))
166 #define HPFS_SUPER_MAGIC 0xf995e849
167 struct hpfs_super_block
{
171 #define hpfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
172 (((uint) s.s_magic[2]) << 16) + \
173 (((uint) s.s_magic[3]) << 24))
175 struct adfs_super_block
{
179 u_char s_checksum
[1];
181 #define adfsblksize(s) ((uint) s.s_blksize[0])
183 /* found in first 4 bytes of block 1 */
184 struct vxfs_super_block
{
187 #define vxfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
188 (((uint) s.s_magic[2]) << 16) + \
189 (((uint) s.s_magic[3]) << 24))
190 #define VXFS_SUPER_MAGIC 0xa501FCF5
192 struct jfs_super_block
{
195 #define JFS_SUPER1_OFF 0x8000
196 #define JFS_MAGIC "JFS1"
198 #define SYSV_SUPER_MAGIC 0xfd187e20
200 struct sysv_super_block
{
201 u_char s_dummy1
[504];
206 #define sysvmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
207 (((uint) s.s_magic[2]) << 16) + \
208 (((uint) s.s_magic[3]) << 24))