]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/xfs_dinode.h
Merge whitespace changes over
[thirdparty/xfsprogs-dev.git] / include / xfs_dinode.h
1 /*
2 * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
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 #ifndef __XFS_DINODE_H__
33 #define __XFS_DINODE_H__
34
35 struct xfs_buf;
36 struct xfs_mount;
37
38 #define XFS_DINODE_VERSION_1 1
39 #define XFS_DINODE_VERSION_2 2
40 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION)
41 int xfs_dinode_good_version(int v);
42 #define XFS_DINODE_GOOD_VERSION(v) xfs_dinode_good_version(v)
43 #else
44 #define XFS_DINODE_GOOD_VERSION(v) (((v) == XFS_DINODE_VERSION_1) || \
45 ((v) == XFS_DINODE_VERSION_2))
46 #endif
47 #define XFS_DINODE_MAGIC 0x494e /* 'IN' */
48
49 /*
50 * Disk inode structure.
51 * This is just the header; the inode is expanded to fill a variable size
52 * with the last field expanding. It is split into the core and "other"
53 * because we only need the core part in the in-core inode.
54 */
55 typedef struct xfs_timestamp {
56 __int32_t t_sec; /* timestamp seconds */
57 __int32_t t_nsec; /* timestamp nanoseconds */
58 } xfs_timestamp_t;
59
60 /*
61 * Note: Coordinate changes to this structure with the XFS_DI_* #defines
62 * below and the offsets table in xfs_ialloc_log_di().
63 */
64 typedef struct xfs_dinode_core
65 {
66 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
67 __uint16_t di_mode; /* mode and type of file */
68 __int8_t di_version; /* inode version */
69 __int8_t di_format; /* format of di_c data */
70 __uint16_t di_onlink; /* old number of links to file */
71 __uint32_t di_uid; /* owner's user id */
72 __uint32_t di_gid; /* owner's group id */
73 __uint32_t di_nlink; /* number of links to file */
74 __uint16_t di_projid; /* owner's project id */
75 __uint8_t di_pad[10]; /* unused, zeroed space */
76 xfs_timestamp_t di_atime; /* time last accessed */
77 xfs_timestamp_t di_mtime; /* time last modified */
78 xfs_timestamp_t di_ctime; /* time created/inode modified */
79 xfs_fsize_t di_size; /* number of bytes in file */
80 xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */
81 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
82 xfs_extnum_t di_nextents; /* number of extents in data fork */
83 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
84 __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
85 __int8_t di_aformat; /* format of attr fork's data */
86 __uint32_t di_dmevmask; /* DMIG event mask */
87 __uint16_t di_dmstate; /* DMIG state info */
88 __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
89 __uint32_t di_gen; /* generation number */
90 } xfs_dinode_core_t;
91
92 typedef struct xfs_dinode
93 {
94 xfs_dinode_core_t di_core;
95 /*
96 * In adding anything between the core and the union, be
97 * sure to update the macros like XFS_LITINO below and
98 * XFS_BMAP_RBLOCK_DSIZE in xfs_bmap_btree.h.
99 */
100 xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */
101 union {
102 xfs_bmdr_block_t di_bmbt; /* btree root block */
103 xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */
104 xfs_dir_shortform_t di_dirsf; /* shortform directory */
105 xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */
106 char di_c[1]; /* local contents */
107 xfs_dev_t di_dev; /* device for IFCHR/IFBLK */
108 uuid_t di_muuid; /* mount point value */
109 char di_symlink[1]; /* local symbolic link */
110 } di_u;
111 union {
112 xfs_bmdr_block_t di_abmbt; /* btree root block */
113 xfs_bmbt_rec_32_t di_abmx[1]; /* extent list */
114 xfs_attr_shortform_t di_attrsf; /* shortform attribute list */
115 } di_a;
116 } xfs_dinode_t;
117
118 /*
119 * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
120 * Since the pathconf interface is signed, we use 2^31 - 1 instead.
121 * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.
122 */
123 #define XFS_MAXLINK ((1U << 31) - 1U)
124 #define XFS_MAXLINK_1 65535U
125
126 /*
127 * Bit names for logging disk inodes only
128 */
129 #define XFS_DI_MAGIC 0x0000001
130 #define XFS_DI_MODE 0x0000002
131 #define XFS_DI_VERSION 0x0000004
132 #define XFS_DI_FORMAT 0x0000008
133 #define XFS_DI_ONLINK 0x0000010
134 #define XFS_DI_UID 0x0000020
135 #define XFS_DI_GID 0x0000040
136 #define XFS_DI_NLINK 0x0000080
137 #define XFS_DI_PROJID 0x0000100
138 #define XFS_DI_PAD 0x0000200
139 #define XFS_DI_ATIME 0x0000400
140 #define XFS_DI_MTIME 0x0000800
141 #define XFS_DI_CTIME 0x0001000
142 #define XFS_DI_SIZE 0x0002000
143 #define XFS_DI_NBLOCKS 0x0004000
144 #define XFS_DI_EXTSIZE 0x0008000
145 #define XFS_DI_NEXTENTS 0x0010000
146 #define XFS_DI_NAEXTENTS 0x0020000
147 #define XFS_DI_FORKOFF 0x0040000
148 #define XFS_DI_AFORMAT 0x0080000
149 #define XFS_DI_DMEVMASK 0x0100000
150 #define XFS_DI_DMSTATE 0x0200000
151 #define XFS_DI_FLAGS 0x0400000
152 #define XFS_DI_GEN 0x0800000
153 #define XFS_DI_NEXT_UNLINKED 0x1000000
154 #define XFS_DI_U 0x2000000
155 #define XFS_DI_A 0x4000000
156 #define XFS_DI_NUM_BITS 27
157 #define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1)
158 #define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A))
159
160 /*
161 * Values for di_format
162 */
163 typedef enum xfs_dinode_fmt
164 {
165 XFS_DINODE_FMT_DEV, /* CHR, BLK: di_dev */
166 XFS_DINODE_FMT_LOCAL, /* DIR, REG: di_c */
167 /* LNK: di_symlink */
168 XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */
169 XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */
170 XFS_DINODE_FMT_UUID /* MNT: di_uuid */
171 } xfs_dinode_fmt_t;
172
173 /*
174 * Inode minimum and maximum sizes.
175 */
176 #define XFS_DINODE_MIN_LOG 8
177 #define XFS_DINODE_MAX_LOG 11
178 #define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG)
179 #define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG)
180
181 /*
182 * Inode size for given fs.
183 */
184 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO)
185 int xfs_litino(struct xfs_mount *mp);
186 #define XFS_LITINO(mp) xfs_litino(mp)
187 #else
188 #define XFS_LITINO(mp) ((mp)->m_litino)
189 #endif
190 #define XFS_BROOT_SIZE_ADJ \
191 (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t))
192
193 /*
194 * Fork identifiers. Here so utilities can use them without including
195 * xfs_inode.h.
196 */
197 #define XFS_DATA_FORK 0
198 #define XFS_ATTR_FORK 1
199
200 /*
201 * Inode data & attribute fork sizes, per inode.
202 */
203 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q)
204 int xfs_cfork_q_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch);
205 int xfs_cfork_q(xfs_dinode_core_t *dcp);
206 #define XFS_CFORK_Q_ARCH(dcp,arch) xfs_cfork_q_arch(dcp,arch)
207 #define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp)
208 #else
209 #define XFS_CFORK_Q_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch))
210 #define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0)
211
212 #endif
213 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF)
214 int xfs_cfork_boff_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch);
215 int xfs_cfork_boff(xfs_dinode_core_t *dcp);
216 #define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch)
217 #define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp)
218 #else
219 #define XFS_CFORK_BOFF_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3))
220 #define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
221
222 #endif
223 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE)
224 int xfs_cfork_dsize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch);
225 int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
226 #define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch)
227 #define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp)
228 #else
229 #define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) \
230 (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_CFORK_BOFF_ARCH(dcp, arch) : XFS_LITINO(mp))
231 #define XFS_CFORK_DSIZE(dcp,mp) \
232 (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp))
233
234 #endif
235 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE)
236 int xfs_cfork_asize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch);
237 int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
238 #define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch)
239 #define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp)
240 #else
241 #define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) \
242 (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_ARCH(dcp, arch) : 0)
243 #define XFS_CFORK_ASIZE(dcp,mp) \
244 (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0)
245
246 #endif
247 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE)
248 int xfs_cfork_size_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w, xfs_arch_t arch);
249 int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
250 #define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch)
251 #define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w)
252 #else
253 #define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) \
254 ((w) == XFS_DATA_FORK ? \
255 XFS_CFORK_DSIZE_ARCH(dcp, mp, arch) : XFS_CFORK_ASIZE_ARCH(dcp, mp, arch))
256 #define XFS_CFORK_SIZE(dcp,mp,w) \
257 ((w) == XFS_DATA_FORK ? \
258 XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp))
259
260 #endif
261
262 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE)
263 int xfs_dfork_dsize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch);
264 int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp);
265 #define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch)
266 #define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp)
267 #else
268 #define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch)
269 #define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT)
270
271 #endif
272 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE)
273 int xfs_dfork_asize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch);
274 int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp);
275 #define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch)
276 #define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp)
277 #else
278 #define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch)
279 #define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT)
280
281 #endif
282 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE)
283 int xfs_dfork_size_arch(xfs_dinode_t *dip, struct xfs_mount *mp, int w, xfs_arch_t arch);
284 int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w);
285 #define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch)
286 #define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w)
287 #else
288 #define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch)
289 #define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT)
290
291 #endif
292
293 /*
294 * Macros for accessing per-fork disk inode information.
295 */
296 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q)
297 int xfs_dfork_q_arch(xfs_dinode_t *dip, xfs_arch_t arch);
298 int xfs_dfork_q(xfs_dinode_t *dip);
299 #define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch)
300 #define XFS_DFORK_Q(dip) xfs_dfork_q(dip)
301 #else
302 #define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch)
303 #define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT)
304
305 #endif
306 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF)
307 int xfs_dfork_boff_arch(xfs_dinode_t *dip, xfs_arch_t arch);
308 int xfs_dfork_boff(xfs_dinode_t *dip);
309 #define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch)
310 #define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip)
311 #else
312 #define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch)
313 #define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT)
314
315 #endif
316 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR)
317 char *xfs_dfork_dptr_arch(xfs_dinode_t *dip, xfs_arch_t arch);
318 char *xfs_dfork_dptr(xfs_dinode_t *dip);
319 #define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch)
320 #define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip)
321 #else
322 #define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c)
323 #define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT)
324
325 #endif
326 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR)
327 char *xfs_dfork_aptr_arch(xfs_dinode_t *dip, xfs_arch_t arch);
328 char *xfs_dfork_aptr(xfs_dinode_t *dip);
329 #define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch)
330 #define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip)
331 #else
332 #define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch))
333 #define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT)
334
335 #endif
336 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR)
337 char *xfs_dfork_ptr_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch);
338 char *xfs_dfork_ptr(xfs_dinode_t *dip, int w);
339 #define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch)
340 #define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w)
341 #else
342 #define XFS_DFORK_PTR_ARCH(dip,w,arch) \
343 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR_ARCH(dip, arch) : XFS_DFORK_APTR_ARCH(dip, arch))
344 #define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT)
345
346 #endif
347 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT)
348 int xfs_cfork_format_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch);
349 int xfs_cfork_format(xfs_dinode_core_t *dcp, int w);
350 #define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch)
351 #define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w)
352 #else
353 #define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \
354 ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_format, arch) : INT_GET((dcp)->di_aformat, arch))
355 #define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT)
356
357 #endif
358 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET)
359 void xfs_cfork_fmt_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch);
360 void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n);
361 #define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch)
362 #define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n)
363 #else
364 #define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \
365 ((w) == XFS_DATA_FORK ? \
366 (INT_SET((dcp)->di_format, arch, (n))) : \
367 (INT_SET((dcp)->di_aformat, arch, (n))))
368 #define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT)
369
370 #endif
371 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS)
372 int xfs_cfork_nextents_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch);
373 int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
374 #define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch)
375 #define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w)
376 #else
377 #define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) \
378 ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_nextents, arch) : INT_GET((dcp)->di_anextents, arch))
379 #define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT)
380
381 #endif
382 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET)
383 void xfs_cfork_next_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch);
384 void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n);
385 #define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch)
386 #define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n)
387 #else
388 #define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \
389 ((w) == XFS_DATA_FORK ? \
390 (INT_SET((dcp)->di_nextents, arch, (n))) : \
391 (INT_SET((dcp)->di_anextents, arch, (n))))
392 #define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT)
393
394 #endif
395 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FORMAT)
396 int xfs_dfork_format_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch);
397 int xfs_dfork_format(xfs_dinode_t *dip, int w);
398 #define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch)
399 #define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w)
400 #else
401 #define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch)
402 #define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT)
403
404 #endif
405 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FMT_SET)
406 void xfs_dfork_fmt_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch);
407 void xfs_dfork_fmt_set(xfs_dinode_t *dip, int w, int n);
408 #define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch)
409 #define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n)
410 #else
411 #define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch)
412 #define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT)
413
414 #endif
415 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS)
416 int xfs_dfork_nextents_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch);
417 int xfs_dfork_nextents(xfs_dinode_t *dip, int w);
418 #define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch)
419 #define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w)
420 #else
421 #define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch)
422 #define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT)
423
424 #endif
425 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXT_SET)
426 void xfs_dfork_next_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch);
427 void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n);
428 #define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch)
429 #define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n)
430 #else
431 #define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch)
432 #define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT)
433
434 #endif
435
436 /*
437 * File types (mode field)
438 */
439 #define IFMT 0170000 /* type of file */
440 #define IFIFO 0010000 /* named pipe (fifo) */
441 #define IFCHR 0020000 /* character special */
442 #define IFDIR 0040000 /* directory */
443 #define IFBLK 0060000 /* block special */
444 #define IFREG 0100000 /* regular */
445 #define IFLNK 0120000 /* symbolic link */
446 #define IFSOCK 0140000 /* socket */
447 #define IFMNT 0160000 /* mount point */
448
449 /*
450 * File execution and access modes.
451 */
452 #define ISUID 04000 /* set user id on execution */
453 #define ISGID 02000 /* set group id on execution */
454 #define ISVTX 01000 /* sticky directory */
455 #define IREAD 0400 /* read, write, execute permissions */
456 #define IWRITE 0200
457 #define IEXEC 0100
458
459 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE)
460 xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
461 #define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
462 #else
463 #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp)))
464 #endif
465
466 /*
467 * Values for di_flags
468 * There should be a one-to-one correspondence between these flags and the
469 * XFS_XFLAG_s.
470 */
471 #define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */
472 #define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */
473 #define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */
474 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
475 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
476 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
477 #define XFS_DIFLAG_ALL \
478 (XFS_DIFLAG_REALTIME|XFS_DIFLAG_PREALLOC|XFS_DIFLAG_NEWRTBM)
479
480 #endif /* __XFS_DINODE_H__ */