2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of version 2 of the GNU General Public License as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it would be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* Further, this software is distributed without any warranty that it is
13
* free of the rightful claim of any third person regarding infringement
14
* or the like. Any license provided herein, whether implied or
15
* otherwise, applies only to this software file. Patent licenses, if
16
* any, provided herein do not apply to combinations of this program with
17
* other software, or any other product whatsoever.
19
* You should have received a copy of the GNU General Public License along
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33
#undef XFS_SUPER_MAGIC
36
* From mount(8) source by Andries Brouwer. Hacked for XFS by mkp.
37
* Recent sync's to mount source:
38
* - util-linux-2.10o ... 06 Sep 00
39
* - util-linux-2.10r ... 06 Dec 00
40
* - util-linux-2.11g ... 02 Jul 01
43
/* Including <linux/fs.h> became more and more painful.
44
Below a very abbreviated version of some declarations,
45
only designed to be able to check a magic number
46
in case no filesystem type was given. */
48
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
49
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
50
struct minix_super_block {
54
#define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
56
#define ISODCL(from, to) (to - from + 1)
57
#define ISO_STANDARD_ID "CD001"
58
struct iso_volume_descriptor {
59
char type[ISODCL(1,1)]; /* 711 */
61
char version[ISODCL(7,7)];
62
char data[ISODCL(8,2048)];
65
#define HS_STANDARD_ID "CDROM"
66
struct hs_volume_descriptor {
67
char foo[ISODCL ( 1, 8)]; /* 733 */
68
char type[ISODCL ( 9, 9)]; /* 711 */
69
char id[ISODCL ( 10, 14)];
70
char version[ISODCL ( 15, 15)]; /* 711 */
71
char data[ISODCL(16,2048)];
74
#define EXT_SUPER_MAGIC 0x137D
75
struct ext_super_block {
79
#define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
81
#define EXT2_PRE_02B_MAGIC 0xEF51
82
#define EXT2_SUPER_MAGIC 0xEF53
83
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
84
struct ext2_super_block {
88
u_char s_feature_compat[4];
89
u_char s_feature_incompat[4];
90
u_char s_feature_ro_compat[4];
92
u_char s_volume_name[16];
94
u_char s_journal_inum[4]; /* ext3 only */
96
#define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
98
struct reiserfs_super_block
100
u_char s_block_count[4];
101
u_char s_free_blocks[4];
102
u_char s_root_block[4];
103
u_char s_journal_block[4];
104
u_char s_journal_dev[4];
105
u_char s_orig_journal_size[4];
106
u_char s_journal_trans_max[4];
107
u_char s_journal_block_count[4];
108
u_char s_journal_max_batch[4];
109
u_char s_journal_max_commit_age[4];
110
u_char s_journal_max_trans_age[4];
111
u_char s_blocksize[2];
112
u_char s_oid_maxsize[2];
113
u_char s_oid_cursize[2];
117
#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
118
#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
119
#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
120
/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
121
#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
123
#define _XIAFS_SUPER_MAGIC 0x012FD16D
124
struct xiafs_super_block {
125
u_char s_boot_segment[512]; /* 1st sector reserved for boot */
129
#define xiafsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
130
(((uint) s.s_magic[2]) << 16) + \
131
(((uint) s.s_magic[3]) << 24))
133
/* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */
134
#define UFS_SUPER_MAGIC 0x00011954
135
struct ufs_super_block {
136
u_char s_dummy[0x55c];
139
#define ufsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
140
(((uint) s.s_magic[2]) << 16) + \
141
(((uint) s.s_magic[3]) << 24))
143
/* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */
144
#define NTFS_SUPER_MAGIC "NTFS"
145
struct ntfs_super_block {
150
/* From inspection of a few FAT filesystems - aeb */
151
/* Unfortunately I find almost the same thing on an extended partition;
152
it looks like a primary has some directory entries where the extended
153
has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */
154
struct fat_super_block {
156
u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
157
/* mtools-3.9.4 writes "MTOOL394" */
159
u_char s_label[11]; /* for DOS? */
160
u_char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */
161
/* OS/2 BM has "FAT " here. */
163
u_char s_label2[11]; /* for Windows? */
164
u_char s_fs2[8]; /* garbage or "FAT32 " */
167
#define XFS_SUPER_MAGIC "XFSB"
168
struct xfs_super_block {
176
#define CRAMFS_SUPER_MAGIC 0x28cd3d45
177
struct cramfs_super_block {
182
#define cramfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
183
(((uint) s.s_magic[2]) << 16) + \
184
(((uint) s.s_magic[3]) << 24))
186
#define HFS_SUPER_MAGIC 0x4244
187
struct hfs_super_block {
192
#define hfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
193
#define hfsblksize(s) ((uint) s.s_blksize[0] + \
194
(((uint) s.s_blksize[1]) << 8) + \
195
(((uint) s.s_blksize[2]) << 16) + \
196
(((uint) s.s_blksize[3]) << 24))
198
#define HPFS_SUPER_MAGIC 0xf995e849
199
struct hpfs_super_block {
203
#define hpfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
204
(((uint) s.s_magic[2]) << 16) + \
205
(((uint) s.s_magic[3]) << 24))
207
struct adfs_super_block {
211
u_char s_checksum[1];
213
#define adfsblksize(s) ((uint) s.s_blksize[0])