1 /* Constants from kernel header for various FSes.
2    Copyright (C) 1998-2022 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _LINUX_FSINFO_H
20 #define _LINUX_FSINFO_H	1
21 
22 /* These definitions come from the kernel headers.  But we cannot
23    include the headers here because of type clashes.  If new
24    filesystem types will become available we have to add the
25    appropriate definitions here.  */
26 
27 /* Constant that identifies the `adfs' filesystem.  */
28 #define ADFS_SUPER_MAGIC	0xadf5
29 
30 /* Constant that identifies the `affs' filesystem.  */
31 #define AFFS_SUPER_MAGIC	0xadff
32 
33 /* Constant that identifies the `afs' filesystem.  */
34 #define AFS_SUPER_MAGIC		0x5346414F
35 
36 /* Constant that identifies the `anon_inodefs' filesystem.  */
37 #define ANON_INODE_FS_MAGIC	0x09041934
38 
39 /* Constant that identifies the `autofs' filesystem.  */
40 #define AUTOFS_SUPER_MAGIC	0x187
41 
42 /* Constant that identifies the `bdev' filesystem.  */
43 #define BDEVFS_MAGIC		0x62646576
44 
45 /* Constant that identifies the `bfs' filesystem.  */
46 #define BFS_MAGIC		0x1badface
47 
48 /* Constant that identifies the `binfmt_misc' filesystem.  */
49 #define BINFMTFS_MAGIC		0x42494e4d
50 
51 /* Constant that identifies the `btrfs' filesystem.  */
52 #define BTRFS_SUPER_MAGIC	0x9123683e
53 
54 /* Constant that identifies the `btrfs_test_fs' filesystem.  */
55 #define BTRFS_TEST_MAGIC	0x73727279
56 
57 /* Constant that identifies the `cgroup' filesystem.  */
58 #define CGROUP_SUPER_MAGIC	0x27e0eb
59 
60 /* Constant that identifies the `coda' filesystem.  */
61 #define CODA_SUPER_MAGIC	0x73757245
62 
63 /* Constant that identifies the `coherent' filesystem.  */
64 #define COH_SUPER_MAGIC		0x012ff7b7
65 
66 /* Constant that identifies the `cramfs' filesystem.  */
67 #define CRAMFS_MAGIC		0x28cd3d45
68 
69 /* Constant that identifies the `cramfs' filesystem w/opposite endianness.  */
70 #define CRAMFS_MAGIC_WEND	0x453dcd28
71 
72 /* Constant that identifies the `debugfs' filesystem.  */
73 #define DEBUGFS_MAGIC		0x64626720
74 
75 /* Constant that identifies the `devfs' filesystem.  */
76 #define DEVFS_SUPER_MAGIC	0x1373
77 
78 /* Constant that identifies the `devpts' filesystem.  */
79 #define DEVPTS_SUPER_MAGIC	0x1cd1
80 
81 /* Constants that identifies the `ecryptfs' filesystem.  */
82 #define ECRYPTFS_SUPER_MAGIC	0xf15f
83 
84 /* Constants that identifies the `efs' filesystem.  */
85 #define EFS_SUPER_MAGIC		0x414a53
86 #define EFS_MAGIC		0x072959
87 
88 /* Constants that identifies the `evivar' filesystem.  */
89 #define EFIVARFS_MAGIC		0xde5e81e4
90 
91 /* Constant that identifies the `ext2' filesystem.  */
92 #define EXT2_SUPER_MAGIC	0xef53
93 
94 /* Constant that identifies the `ext3' filesystem.  */
95 #define EXT3_SUPER_MAGIC	0xef53
96 
97 /* Constant that identifies the `ext3' filesystem.  */
98 #define EXT4_SUPER_MAGIC	0xef53
99 
100 /* Constant that identifies the `f2fs' filesystem.  */
101 #define F2FS_SUPER_MAGIC	0xf2f52010
102 
103 /* Constant that identifies the `futexfs' filesystem.  */
104 #define FUTEXFS_SUPER_MAGIC	0xBAD1DEA
105 
106 /* Constant that identifies the `hostfs' filesystem.  */
107 #define HOSTFS_SUPER_MAGIC	0x00c0ffee
108 
109 /* Constant that identifies the `hpfs' filesystem.  */
110 #define HPFS_SUPER_MAGIC	0xf995e849
111 
112 /* Constant that identifies the `hugetlbfs' filesystem.  */
113 #define HUGETLBFS_MAGIC 	0x958458f6
114 
115 /* Constant that identifies the `iso9660' filesystem.  */
116 #define ISOFS_SUPER_MAGIC	0x9660
117 
118 /* Constant that identifies the `jffs' filesystem.  */
119 #define JFFS_SUPER_MAGIC	0x07c0
120 
121 /* Constant that identifies the `jffs2' filesystem.  */
122 #define JFFS2_SUPER_MAGIC	0x72b6
123 
124 /* Constant that identifies the `jfs' filesystem.  */
125 #define JFS_SUPER_MAGIC		0x3153464a
126 
127 /* Constant that identifies the `logfs' filesystem.  */
128 #define LOGFS_MAGIC_U32		0xc97e8168u
129 
130 /* Constant that identifies the `lustre' filesystem.  */
131 #define LUSTRE_SUPER_MAGIC	0x0BD00BD0
132 
133 /* Constants that identify the `minix2' filesystem.  */
134 #define MINIX2_SUPER_MAGIC	0x2468
135 #define MINIX2_SUPER_MAGIC2	0x2478
136 
137 /* Constants that identify the `minix3' filesystem.  */
138 #define MINIX3_SUPER_MAGIC	0x4d5a
139 
140 /* Constants that identify the `minix' filesystem.  */
141 #define MINIX_SUPER_MAGIC	0x137f
142 #define MINIX_SUPER_MAGIC2	0x138F
143 
144 /* Constant that identifies the `msdos' filesystem.  */
145 #define MSDOS_SUPER_MAGIC	0x4d44
146 
147 /* Constant that identifies the `mtd_inodefs' filesystem.  */
148 #define MTD_INODE_FS_MAGIC	0x11307854
149 
150 /* Constant that identifies the `ncp' filesystem.  */
151 #define NCP_SUPER_MAGIC		0x564c
152 
153 /* Constant that identifies the `nilfs' filesystem.  */
154 #define NILFS_SUPER_MAGIC	0x3434
155 
156 /* Constant that identifies the `nfs' filesystem.  */
157 #define NFS_SUPER_MAGIC		0x6969
158 
159 /* Constant that identifies the `ntfs' filesystem.  */
160 #define NTFS_SUPER_MAGIC	0x5346544e
161 
162 /* Constant that identifies the `openpromfs' filesystem.  */
163 #define OPENPROM_SUPER_MAGIC	0x9fa1
164 
165 /* Constant that identifies the `pipefs' filesystem.  */
166 #define PIPEFS_MAGIC		0x50495045
167 
168 /* Constant that identifies the `proc' filesystem.  */
169 #define PROC_SUPER_MAGIC	0x9fa0
170 
171 /* Constant that identifies the `pstorefs' filesystem.  */
172 #define PSTOREFS_MAGIC		0x6165676C
173 
174 /* Constant that identifies the `qnx4' filesystem.  */
175 #define QNX4_SUPER_MAGIC	0x002f
176 
177 /* Constant that identifies the `qnx6' filesystem.  */
178 #define QNX6_SUPER_MAGIC	0x68191122
179 
180 /* Constant that identifies the `ramfs' filesystem.  */
181 #define RAMFS_MAGIC		0x858458f6
182 
183 /* Constant that identifies the `reiser' filesystem.  */
184 #define REISERFS_SUPER_MAGIC	0x52654973
185 
186 #define REISERFS_SUPER_MAGIC_STRING	"ReIsErFs"
187 #define REISER2FS_SUPER_MAGIC_STRING	"ReIsEr2Fs"
188 #define REISER2FS_JR_SUPER_MAGIC_STRING	"ReIsEr3Fs"
189 
190 /* Constant that identifies the `romfs' filesystem.  */
191 #define ROMFS_SUPER_MAGIC	0x7275
192 
193 /* Constant that identifies the `securityfs' filesystem.  */
194 #define SECURITYFS_MAGIC	0x73636673
195 
196 /* Constant that identifies the `selinuxfs' filesystem.  */
197 #define SELINUX_MAGIC		0xf97cff8c
198 
199 /* Constant that identifies the `smackfs' filesystem.  */
200 #define SMACK_MAGIC		0x43415d53	/* "SMAC" */
201 
202 /* Constant that identifies the `shm' filesystem.  */
203 #define SHMFS_SUPER_MAGIC	0x01021994
204 
205 /* Constant that identifies the `smb' filesystem.  */
206 #define SMB_SUPER_MAGIC		0x517b
207 
208 /* Constant that identifies the `sockfs' filesystem.  */
209 #define SOCKFS_MAGIC		0x534F434B
210 
211 /* Constant that identifies the `squashfs' filesystem.  */
212 #define SQUASHFS_MAGIC		0x73717368
213 
214 /* Constant that identifies the end of stacks allocated by the kernel.  */
215 #define STACK_END_MAGIC		0x57AC6E9D
216 
217 /* Constant that identifies the `sysfs' filesystem.  */
218 #define SYSFS_MAGIC		0x62656572
219 
220 /* Constants that identify the `sysV' filesystem.  */
221 #define SYSV2_SUPER_MAGIC	0x012ff7b6
222 #define SYSV4_SUPER_MAGIC	0x012ff7b5
223 
224 /* Constant that identifies the `tmpfs' filesystem.  */
225 #define TMPFS_MAGIC		0x01021994
226 
227 /* Constant that identifies the `udf' filesystem.  */
228 #define UDF_SUPER_MAGIC		0x15013346
229 
230 /* Constant that identify the `ufs' filesystem.  */
231 #define UFS_MAGIC		0x00011954
232 #define UFS_CIGAM		0x54190100 /* byteswapped MAGIC */
233 
234 /* Constant that identifies the `usbdevfs' filesystem.  */
235 #define USBDEVFS_SUPER_MAGIC	0x9fa2
236 #define USBDEVICE_SUPER_MAGIC	0x9fa2
237 
238 /* Constant that identifies the `9p' filesystem.  */
239 #define V9FS_MAGIC		0x01021997
240 
241 /* Constant that identifies the `vxfs' filesystem.  */
242 #define VXFS_SUPER_MAGIC	0xa501fcf5
243 
244 /* Constant that identifies the `xenfs' filesystem.  */
245 #define XENFS_SUPER_MAGIC	0xabba1974
246 
247 /* Constant that identifies the `xenix' filesystem.  */
248 #define XENIX_SUPER_MAGIC	0x012ff7b4
249 
250 /* Constant that identifies the `xfs' filesystem.  */
251 #define XFS_SUPER_MAGIC		0x58465342
252 
253 /* Maximum link counts.  */
254 #define COH_LINK_MAX		10000
255 #define EXT2_LINK_MAX		32000
256 #define EXT4_LINK_MAX		65000
257 #define F2FS_LINK_MAX		32000
258 #define LUSTRE_LINK_MAX		EXT4_LINK_MAX
259 #define MINIX2_LINK_MAX		65530
260 #define MINIX_LINK_MAX		250
261 #define REISERFS_LINK_MAX	64535
262 #define SYSV_LINK_MAX		126     /* 127? 251? */
263 #define UFS_LINK_MAX		EXT2_LINK_MAX
264 #define XENIX_LINK_MAX		126     /* ?? */
265 #define XFS_LINK_MAX		2147483647
266 
267 /* The Linux kernel header mentioned this as a kind of generic value.  */
268 #define LINUX_LINK_MAX	127
269 
270 
271 #endif	/* linux_fsinfo.h */
272