]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libdisk/fstype.h
Update copyright dates (again)
[thirdparty/xfsprogs-dev.git] / libdisk / fstype.h
CommitLineData
f937adac 1/*
0d3e0b37 2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
f937adac
NS
3 *
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.
7 *
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.
11 *
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.
18 *
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.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32
33#undef XFS_SUPER_MAGIC
34
35/*
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
41 */
42
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. */
47
48#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
49#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
50struct minix_super_block {
51 u_char s_dummy[16];
52 u_char s_magic[2];
53};
54#define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
55
56#define ISODCL(from, to) (to - from + 1)
57#define ISO_STANDARD_ID "CD001"
58struct iso_volume_descriptor {
59 char type[ISODCL(1,1)]; /* 711 */
60 char id[ISODCL(2,6)];
61 char version[ISODCL(7,7)];
62 char data[ISODCL(8,2048)];
63};
64
65#define HS_STANDARD_ID "CDROM"
66struct 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)];
72};
73
74#define EXT_SUPER_MAGIC 0x137D
75struct ext_super_block {
76 u_char s_dummy[56];
77 u_char s_magic[2];
78};
79#define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
80
81#define EXT2_PRE_02B_MAGIC 0xEF51
82#define EXT2_SUPER_MAGIC 0xEF53
83#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
84struct ext2_super_block {
85 u_char s_dummy1[56];
86 u_char s_magic[2];
87 u_char s_dummy2[34];
88 u_char s_feature_compat[4];
89 u_char s_feature_incompat[4];
90 u_char s_feature_ro_compat[4];
91 u_char s_uuid[16];
92 u_char s_volume_name[16];
93 u_char s_dummy3[88];
94 u_char s_journal_inum[4]; /* ext3 only */
95};
96#define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
97
98struct reiserfs_super_block
99{
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];
114 u_char s_state[2];
115 u_char s_magic[12];
116};
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)
122
123#define _XIAFS_SUPER_MAGIC 0x012FD16D
124struct xiafs_super_block {
125 u_char s_boot_segment[512]; /* 1st sector reserved for boot */
126 u_char s_dummy[60];
127 u_char s_magic[4];
128};
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))
132
133/* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */
134#define UFS_SUPER_MAGIC 0x00011954
135struct ufs_super_block {
136 u_char s_dummy[0x55c];
137 u_char s_magic[4];
138};
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))
142
143/* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */
144#define NTFS_SUPER_MAGIC "NTFS"
145struct ntfs_super_block {
146 u_char s_dummy[3];
147 u_char s_magic[4];
148};
149
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 */
154struct fat_super_block {
155 u_char s_dummy[3];
156 u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
157 /* mtools-3.9.4 writes "MTOOL394" */
158 u_char s_dummy2[32];
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. */
162 u_char s_dummy3[9];
163 u_char s_label2[11]; /* for Windows? */
164 u_char s_fs2[8]; /* garbage or "FAT32 " */
165};
166
167#define XFS_SUPER_MAGIC "XFSB"
168struct xfs_super_block {
169 u_char s_magic[4];
170 u_char s_dummy[28];
171 u_char s_uuid[16];
172 u_char s_dummy2[60];
173 u_char s_fname[12];
174};
175
176#define CRAMFS_SUPER_MAGIC 0x28cd3d45
177struct cramfs_super_block {
178 u_char s_magic[4];
179 u_char s_dummy[12];
180 u_char s_id[16];
181};
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))
185
186#define HFS_SUPER_MAGIC 0x4244
187struct hfs_super_block {
188 u_char s_magic[2];
189 u_char s_dummy[18];
190 u_char s_blksize[4];
191};
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))
197
198#define HPFS_SUPER_MAGIC 0xf995e849
199struct hpfs_super_block {
200 u_char s_magic[4];
201 u_char s_magic2[4];
202};
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))
206
207struct adfs_super_block {
208 u_char s_dummy[448];
209 u_char s_blksize[1];
210 u_char s_dummy2[62];
211 u_char s_checksum[1];
212};
213#define adfsblksize(s) ((uint) s.s_blksize[0])