1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31#ifndef _VXFS_SUPER_H_
32#define _VXFS_SUPER_H_
33
34
35
36
37
38
39
40#include <linux/types.h>
41
42
43
44
45#define VXFS_SUPER_MAGIC 0xa501FCF5
46
47
48
49
50#define VXFS_ROOT_INO 2
51
52
53
54
55#define VXFS_NEFREE 32
56
57enum vxfs_byte_order {
58 VXFS_BO_LE,
59 VXFS_BO_BE,
60};
61
62typedef __u16 __bitwise __fs16;
63typedef __u32 __bitwise __fs32;
64typedef __u64 __bitwise __fs64;
65
66
67
68
69struct vxfs_sb {
70
71
72
73
74
75
76 __fs32 vs_magic;
77 __fs32 vs_version;
78 __fs32 vs_ctime;
79 __fs32 vs_cutime;
80 __fs32 __unused1;
81 __fs32 __unused2;
82 __fs32 vs_old_logstart;
83 __fs32 vs_old_logend;
84 __fs32 vs_bsize;
85 __fs32 vs_size;
86 __fs32 vs_dsize;
87 __fs32 vs_old_ninode;
88 __fs32 vs_old_nau;
89 __fs32 __unused3;
90 __fs32 vs_old_defiextsize;
91 __fs32 vs_old_ilbsize;
92 __fs32 vs_immedlen;
93 __fs32 vs_ndaddr;
94 __fs32 vs_firstau;
95 __fs32 vs_emap;
96 __fs32 vs_imap;
97 __fs32 vs_iextop;
98 __fs32 vs_istart;
99 __fs32 vs_bstart;
100 __fs32 vs_femap;
101 __fs32 vs_fimap;
102 __fs32 vs_fiextop;
103 __fs32 vs_fistart;
104 __fs32 vs_fbstart;
105 __fs32 vs_nindir;
106 __fs32 vs_aulen;
107 __fs32 vs_auimlen;
108 __fs32 vs_auemlen;
109 __fs32 vs_auilen;
110 __fs32 vs_aupad;
111 __fs32 vs_aublocks;
112 __fs32 vs_maxtier;
113 __fs32 vs_inopb;
114 __fs32 vs_old_inopau;
115 __fs32 vs_old_inopilb;
116 __fs32 vs_old_ndiripau;
117 __fs32 vs_iaddrlen;
118 __fs32 vs_bshift;
119 __fs32 vs_inoshift;
120 __fs32 vs_bmask;
121 __fs32 vs_boffmask;
122 __fs32 vs_old_inomask;
123 __fs32 vs_checksum;
124
125
126
127
128 __fs32 vs_free;
129 __fs32 vs_ifree;
130 __fs32 vs_efree[VXFS_NEFREE];
131 __fs32 vs_flags;
132 __u8 vs_mod;
133 __u8 vs_clean;
134 __fs16 __unused4;
135 __fs32 vs_firstlogid;
136 __fs32 vs_wtime;
137 __fs32 vs_wutime;
138 __u8 vs_fname[6];
139 __u8 vs_fpack[6];
140 __fs32 vs_logversion;
141 __u32 __unused5;
142
143
144
145
146 __fs32 vs_oltext[2];
147 __fs32 vs_oltsize;
148 __fs32 vs_iauimlen;
149 __fs32 vs_iausize;
150 __fs32 vs_dinosize;
151 __fs32 vs_old_dniaddr;
152 __fs32 vs_checksum2;
153
154
155
156
157};
158
159
160
161
162
163struct vxfs_sb_info {
164 struct vxfs_sb *vsi_raw;
165 struct buffer_head *vsi_bp;
166 struct inode *vsi_fship;
167 struct inode *vsi_ilist;
168 struct inode *vsi_stilist;
169 u_long vsi_iext;
170 ino_t vsi_fshino;
171 daddr_t vsi_oltext;
172 daddr_t vsi_oltsize;
173 enum vxfs_byte_order byte_order;
174};
175
176static inline u16 fs16_to_cpu(struct vxfs_sb_info *sbi, __fs16 a)
177{
178 if (sbi->byte_order == VXFS_BO_BE)
179 return be16_to_cpu((__force __be16)a);
180 else
181 return le16_to_cpu((__force __le16)a);
182}
183
184static inline u32 fs32_to_cpu(struct vxfs_sb_info *sbi, __fs32 a)
185{
186 if (sbi->byte_order == VXFS_BO_BE)
187 return be32_to_cpu((__force __be32)a);
188 else
189 return le32_to_cpu((__force __le32)a);
190}
191
192static inline u64 fs64_to_cpu(struct vxfs_sb_info *sbi, __fs64 a)
193{
194 if (sbi->byte_order == VXFS_BO_BE)
195 return be64_to_cpu((__force __be64)a);
196 else
197 return le64_to_cpu((__force __le64)a);
198}
199
200
201
202
203
204
205enum vxfs_mode {
206 VXFS_ISUID = 0x00000800,
207 VXFS_ISGID = 0x00000400,
208 VXFS_ISVTX = 0x00000200,
209 VXFS_IREAD = 0x00000100,
210 VXFS_IWRITE = 0x00000080,
211 VXFS_IEXEC = 0x00000040,
212
213 VXFS_IFIFO = 0x00001000,
214 VXFS_IFCHR = 0x00002000,
215 VXFS_IFDIR = 0x00004000,
216 VXFS_IFNAM = 0x00005000,
217 VXFS_IFBLK = 0x00006000,
218 VXFS_IFREG = 0x00008000,
219 VXFS_IFCMP = 0x00009000,
220 VXFS_IFLNK = 0x0000a000,
221 VXFS_IFSOC = 0x0000c000,
222
223
224 VXFS_IFFSH = 0x10000000,
225 VXFS_IFILT = 0x20000000,
226 VXFS_IFIAU = 0x30000000,
227 VXFS_IFCUT = 0x40000000,
228 VXFS_IFATT = 0x50000000,
229 VXFS_IFLCT = 0x60000000,
230 VXFS_IFIAT = 0x70000000,
231 VXFS_IFEMR = 0x80000000,
232 VXFS_IFQUO = 0x90000000,
233 VXFS_IFPTI = 0xa0000000,
234 VXFS_IFLAB = 0x11000000,
235 VXFS_IFOLT = 0x12000000,
236 VXFS_IFLOG = 0x13000000,
237 VXFS_IFEMP = 0x14000000,
238 VXFS_IFEAU = 0x15000000,
239 VXFS_IFAUS = 0x16000000,
240 VXFS_IFDEV = 0x17000000,
241
242};
243
244#define VXFS_TYPE_MASK 0xfffff000
245
246#define VXFS_IS_TYPE(ip,type) (((ip)->vii_mode & VXFS_TYPE_MASK) == (type))
247#define VXFS_ISFIFO(x) VXFS_IS_TYPE((x),VXFS_IFIFO)
248#define VXFS_ISCHR(x) VXFS_IS_TYPE((x),VXFS_IFCHR)
249#define VXFS_ISDIR(x) VXFS_IS_TYPE((x),VXFS_IFDIR)
250#define VXFS_ISNAM(x) VXFS_IS_TYPE((x),VXFS_IFNAM)
251#define VXFS_ISBLK(x) VXFS_IS_TYPE((x),VXFS_IFBLK)
252#define VXFS_ISLNK(x) VXFS_IS_TYPE((x),VXFS_IFLNK)
253#define VXFS_ISREG(x) VXFS_IS_TYPE((x),VXFS_IFREG)
254#define VXFS_ISCMP(x) VXFS_IS_TYPE((x),VXFS_IFCMP)
255#define VXFS_ISSOC(x) VXFS_IS_TYPE((x),VXFS_IFSOC)
256
257#define VXFS_ISFSH(x) VXFS_IS_TYPE((x),VXFS_IFFSH)
258#define VXFS_ISILT(x) VXFS_IS_TYPE((x),VXFS_IFILT)
259
260
261
262
263enum {
264 VXFS_ORG_NONE = 0,
265 VXFS_ORG_EXT4 = 1,
266 VXFS_ORG_IMMED = 2,
267 VXFS_ORG_TYPED = 3,
268};
269
270#define VXFS_IS_ORG(ip,org) ((ip)->vii_orgtype == (org))
271#define VXFS_ISNONE(ip) VXFS_IS_ORG((ip), VXFS_ORG_NONE)
272#define VXFS_ISEXT4(ip) VXFS_IS_ORG((ip), VXFS_ORG_EXT4)
273#define VXFS_ISIMMED(ip) VXFS_IS_ORG((ip), VXFS_ORG_IMMED)
274#define VXFS_ISTYPED(ip) VXFS_IS_ORG((ip), VXFS_ORG_TYPED)
275
276
277
278
279#define VXFS_SBI(sbp) \
280 ((struct vxfs_sb_info *)(sbp)->s_fs_info)
281
282#endif
283