]> git.ipfire.org Git - thirdparty/util-linux.git/blob - mount/linux_fs.h
Imported from util-linux-2.10s tarball.
[thirdparty/util-linux.git] / mount / linux_fs.h
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
7 #ifndef _IO
8 /* pre-1.3.45 */
9 #define BLKGETSIZE 0x1260 /* return device size */
10 #else
11 /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
12 #define BLKGETSIZE _IO(0x12,96)
13 #endif
14 #endif
15
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 {
19 u_char s_dummy[16];
20 u_char s_magic[2];
21 };
22 #define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
23
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 */
28 char id[ISODCL(2,6)];
29 char version[ISODCL(7,7)];
30 char data[ISODCL(8,2048)];
31 };
32
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)];
40 };
41
42 #define EXT_SUPER_MAGIC 0x137D
43 struct ext_super_block {
44 u_char s_dummy[56];
45 u_char s_magic[2];
46 };
47 #define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
48
49 #define EXT2_PRE_02B_MAGIC 0xEF51
50 #define EXT2_SUPER_MAGIC 0xEF53
51 struct ext2_super_block {
52 u_char s_dummy1[56];
53 u_char s_magic[2];
54 u_char s_dummy2[46];
55 u_char s_uuid[16];
56 u_char s_volume_name[16];
57 };
58 #define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
59
60 #define _XIAFS_SUPER_MAGIC 0x012FD16D
61 struct xiafs_super_block {
62 u_char s_boot_segment[512]; /* 1st sector reserved for boot */
63 u_char s_dummy[60];
64 u_char s_magic[4];
65 };
66 #define xiafsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
67 (((uint) s.s_magic[2]) << 16) + \
68 (((uint) s.s_magic[3]) << 24))
69
70 /* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */
71 #define UFS_SUPER_MAGIC 0x00011954
72 struct ufs_super_block {
73 u_char s_dummy[0x55c];
74 u_char s_magic[4];
75 };
76 #define ufsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
77 (((uint) s.s_magic[2]) << 16) + \
78 (((uint) s.s_magic[3]) << 24))
79
80 /* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */
81 #define NTFS_SUPER_MAGIC "NTFS"
82 struct ntfs_super_block {
83 u_char s_dummy[3];
84 u_char s_magic[4];
85 };
86
87 /* From inspection of a few FAT filesystems - aeb */
88 /* Unfortunately I find almost the same thing on an extended partition;
89 it looks like a primary has some directory entries where the extended
90 has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */
91 struct fat_super_block {
92 u_char s_dummy[3];
93 u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
94 /* mtools-3.9.4 writes "MTOOL394" */
95 u_char s_dummy2[32];
96 u_char s_label[11]; /* for DOS? */
97 u_char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */
98 /* OS/2 BM has "FAT " here. */
99 u_char s_dummy3[9];
100 u_char s_label2[11]; /* for Windows? */
101 u_char s_fs2[8]; /* garbage or "FAT32 " */
102 };
103
104 #define XFS_SUPER_MAGIC "XFSB"
105 #define XFS_SUPER_MAGIC2 "BSFX"
106 struct xfs_super_block {
107 u_char s_magic[4];
108 u_char s_dummy[28];
109 u_char s_uuid[16];
110 u_char s_dummy2[60];
111 u_char s_fname[12];
112 };
113
114 #define CRAMFS_SUPER_MAGIC 0x28cd3d45
115 struct cramfs_super_block {
116 u_char s_magic[4];
117 u_char s_dummy[12];
118 u_char s_id[16];
119 };
120 #define cramfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
121 (((uint) s.s_magic[2]) << 16) + \
122 (((uint) s.s_magic[3]) << 24))
123
124 #define HFS_SUPER_MAGIC 0x4244
125 struct hfs_super_block {
126 u_char s_magic[2];
127 u_char s_dummy[18];
128 u_char s_blksize[4];
129 };
130 #define hfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
131 #define hfsblksize(s) ((uint) s.s_blksize[0] + \
132 (((uint) s.s_blksize[1]) << 8) + \
133 (((uint) s.s_blksize[2]) << 16) + \
134 (((uint) s.s_blksize[3]) << 24))
135
136 #define HPFS_SUPER_MAGIC 0xf995e849
137 struct hpfs_super_block {
138 u_char s_magic[4];
139 u_char s_magic2[4];
140 };
141 #define hpfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \
142 (((uint) s.s_magic[2]) << 16) + \
143 (((uint) s.s_magic[3]) << 24))
144
145 struct adfs_super_block {
146 u_char s_dummy[448];
147 u_char s_blksize[1];
148 u_char s_dummy2[62];
149 u_char s_checksum[1];
150 };
151 #define adfsblksize(s) ((uint) s.s_blksize[0])