]>
Commit | Line | Data |
---|---|---|
2b6fc908 KZ |
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. */ | |
5 | ||
6 | #ifndef BLKGETSIZE | |
5c36a0eb KZ |
7 | #ifndef _IO |
8 | /* pre-1.3.45 */ | |
2b6fc908 | 9 | #define BLKGETSIZE 0x1260 /* return device size */ |
5c36a0eb KZ |
10 | #else |
11 | /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ | |
12 | #define BLKGETSIZE _IO(0x12,96) | |
13 | #endif | |
2b6fc908 KZ |
14 | #endif |
15 | ||
612721db KZ |
16 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1, 14 char names */ |
17 | #define MINIX_SUPER_MAGIC2 0x138F /* minix v1, 30 char names */ | |
18 | #define MINIX2_SUPER_MAGIC 0x2468 /* minix v2, 14 char names */ | |
19 | #define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2, 30 char names */ | |
2b6fc908 KZ |
20 | struct minix_super_block { |
21 | u_char s_dummy[16]; | |
22 | u_char s_magic[2]; | |
23 | }; | |
24 | #define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) | |
25 | ||
26 | #define ISODCL(from, to) (to - from + 1) | |
27 | #define ISO_STANDARD_ID "CD001" | |
28 | struct iso_volume_descriptor { | |
29 | char type[ISODCL(1,1)]; /* 711 */ | |
30 | char id[ISODCL(2,6)]; | |
31 | char version[ISODCL(7,7)]; | |
32 | char data[ISODCL(8,2048)]; | |
33 | }; | |
34 | ||
35 | #define HS_STANDARD_ID "CDROM" | |
36 | struct hs_volume_descriptor { | |
37 | char foo[ISODCL ( 1, 8)]; /* 733 */ | |
38 | char type[ISODCL ( 9, 9)]; /* 711 */ | |
39 | char id[ISODCL ( 10, 14)]; | |
40 | char version[ISODCL ( 15, 15)]; /* 711 */ | |
41 | char data[ISODCL(16,2048)]; | |
42 | }; | |
43 | ||
44 | #define EXT_SUPER_MAGIC 0x137D | |
45 | struct ext_super_block { | |
46 | u_char s_dummy[56]; | |
47 | u_char s_magic[2]; | |
48 | }; | |
49 | #define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) | |
50 | ||
51 | #define EXT2_PRE_02B_MAGIC 0xEF51 | |
52 | #define EXT2_SUPER_MAGIC 0xEF53 | |
364cda48 | 53 | #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 |
2b6fc908 | 54 | struct ext2_super_block { |
364cda48 KZ |
55 | u_char s_dummy1[56]; |
56 | u_char s_magic[2]; | |
57 | u_char s_dummy2[34]; | |
58 | u_char s_feature_compat[4]; | |
59 | u_char s_feature_incompat[4]; | |
60 | u_char s_feature_ro_compat[4]; | |
61 | u_char s_uuid[16]; | |
62 | u_char s_volume_name[16]; | |
63 | u_char s_dummy3[88]; | |
64 | u_char s_journal_inum[4]; /* ext3 only */ | |
2b6fc908 KZ |
65 | }; |
66 | #define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) | |
67 | ||
e8f26419 KZ |
68 | struct reiserfs_super_block |
69 | { | |
70 | u_char s_block_count[4]; | |
71 | u_char s_free_blocks[4]; | |
72 | u_char s_root_block[4]; | |
73 | u_char s_journal_block[4]; | |
74 | u_char s_journal_dev[4]; | |
75 | u_char s_orig_journal_size[4]; | |
76 | u_char s_journal_trans_max[4]; | |
77 | u_char s_journal_block_count[4]; | |
78 | u_char s_journal_max_batch[4]; | |
79 | u_char s_journal_max_commit_age[4]; | |
80 | u_char s_journal_max_trans_age[4]; | |
81 | u_char s_blocksize[2]; | |
82 | u_char s_oid_maxsize[2]; | |
83 | u_char s_oid_cursize[2]; | |
84 | u_char s_state[2]; | |
85 | u_char s_magic[12]; | |
86 | }; | |
87 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" | |
88 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" | |
89 | #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) | |
90 | /* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ | |
91 | #define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) | |
92 | ||
2b6fc908 KZ |
93 | #define _XIAFS_SUPER_MAGIC 0x012FD16D |
94 | struct xiafs_super_block { | |
95 | u_char s_boot_segment[512]; /* 1st sector reserved for boot */ | |
96 | u_char s_dummy[60]; | |
97 | u_char s_magic[4]; | |
98 | }; | |
99 | #define xiafsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ | |
100 | (((uint) s.s_magic[2]) << 16) + \ | |
101 | (((uint) s.s_magic[3]) << 24)) | |
5c36a0eb KZ |
102 | |
103 | /* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */ | |
104 | #define UFS_SUPER_MAGIC 0x00011954 | |
105 | struct ufs_super_block { | |
106 | u_char s_dummy[0x55c]; | |
107 | u_char s_magic[4]; | |
108 | }; | |
109 | #define ufsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ | |
110 | (((uint) s.s_magic[2]) << 16) + \ | |
111 | (((uint) s.s_magic[3]) << 24)) | |
7eda085c KZ |
112 | |
113 | /* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */ | |
114 | #define NTFS_SUPER_MAGIC "NTFS" | |
115 | struct ntfs_super_block { | |
116 | u_char s_dummy[3]; | |
117 | u_char s_magic[4]; | |
118 | }; | |
119 | ||
120 | /* From inspection of a few FAT filesystems - aeb */ | |
121 | /* Unfortunately I find almost the same thing on an extended partition; | |
122 | it looks like a primary has some directory entries where the extended | |
123 | has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */ | |
124 | struct fat_super_block { | |
125 | u_char s_dummy[3]; | |
126 | u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */ | |
eb63b9b8 | 127 | /* mtools-3.9.4 writes "MTOOL394" */ |
7eda085c KZ |
128 | u_char s_dummy2[32]; |
129 | u_char s_label[11]; /* for DOS? */ | |
130 | u_char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */ | |
131 | /* OS/2 BM has "FAT " here. */ | |
132 | u_char s_dummy3[9]; | |
133 | u_char s_label2[11]; /* for Windows? */ | |
134 | u_char s_fs2[8]; /* garbage or "FAT32 " */ | |
135 | }; | |
66ee8158 KZ |
136 | |
137 | #define XFS_SUPER_MAGIC "XFSB" | |
66ee8158 KZ |
138 | struct xfs_super_block { |
139 | u_char s_magic[4]; | |
140 | u_char s_dummy[28]; | |
141 | u_char s_uuid[16]; | |
142 | u_char s_dummy2[60]; | |
143 | u_char s_fname[12]; | |
144 | }; | |
145 | ||
146 | #define CRAMFS_SUPER_MAGIC 0x28cd3d45 | |
147 | struct cramfs_super_block { | |
148 | u_char s_magic[4]; | |
149 | u_char s_dummy[12]; | |
150 | u_char s_id[16]; | |
151 | }; | |
152 | #define cramfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ | |
153 | (((uint) s.s_magic[2]) << 16) + \ | |
154 | (((uint) s.s_magic[3]) << 24)) | |
155 | ||
156 | #define HFS_SUPER_MAGIC 0x4244 | |
157 | struct hfs_super_block { | |
158 | u_char s_magic[2]; | |
159 | u_char s_dummy[18]; | |
160 | u_char s_blksize[4]; | |
161 | }; | |
162 | #define hfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) | |
163 | #define hfsblksize(s) ((uint) s.s_blksize[0] + \ | |
164 | (((uint) s.s_blksize[1]) << 8) + \ | |
165 | (((uint) s.s_blksize[2]) << 16) + \ | |
166 | (((uint) s.s_blksize[3]) << 24)) | |
167 | ||
168 | #define HPFS_SUPER_MAGIC 0xf995e849 | |
169 | struct hpfs_super_block { | |
170 | u_char s_magic[4]; | |
171 | u_char s_magic2[4]; | |
172 | }; | |
173 | #define hpfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ | |
174 | (((uint) s.s_magic[2]) << 16) + \ | |
175 | (((uint) s.s_magic[3]) << 24)) | |
176 | ||
177 | struct adfs_super_block { | |
178 | u_char s_dummy[448]; | |
179 | u_char s_blksize[1]; | |
180 | u_char s_dummy2[62]; | |
181 | u_char s_checksum[1]; | |
182 | }; | |
183 | #define adfsblksize(s) ((uint) s.s_blksize[0]) | |
e8f26419 KZ |
184 | |
185 | /* found in first 4 bytes of block 1 */ | |
186 | struct vxfs_super_block { | |
187 | u_char s_magic[4]; | |
188 | }; | |
189 | #define vxfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ | |
190 | (((uint) s.s_magic[2]) << 16) + \ | |
191 | (((uint) s.s_magic[3]) << 24)) | |
192 | #define VXFS_SUPER_MAGIC 0xa501FCF5 | |
193 | ||
194 | struct jfs_super_block { | |
195 | char s_magic[4]; | |
196 | }; | |
197 | #define JFS_SUPER1_OFF 0x8000 | |
198 | #define JFS_MAGIC "JFS1" | |
199 | ||
200 | #define SYSV_SUPER_MAGIC 0xfd187e20 | |
201 | ||
202 | struct sysv_super_block { | |
203 | u_char s_dummy1[504]; | |
204 | u_char s_magic[4]; | |
205 | u_char type[4]; | |
206 | }; | |
207 | ||
208 | #define sysvmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ | |
209 | (((uint) s.s_magic[2]) << 16) + \ | |
210 | (((uint) s.s_magic[3]) << 24)) |