aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dinode.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dinode.h')
-rw-r--r--fs/xfs/xfs_dinode.h205
1 files changed, 28 insertions, 177 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index f5c932b064e6..c5a0e537ff1a 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -1,33 +1,19 @@
1/* 1/*
2 * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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 */ 17 */
32#ifndef __XFS_DINODE_H__ 18#ifndef __XFS_DINODE_H__
33#define __XFS_DINODE_H__ 19#define __XFS_DINODE_H__
@@ -37,13 +23,8 @@ struct xfs_mount;
37 23
38#define XFS_DINODE_VERSION_1 1 24#define XFS_DINODE_VERSION_1 1
39#define XFS_DINODE_VERSION_2 2 25#define XFS_DINODE_VERSION_2 2
40#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION) 26#define XFS_DINODE_GOOD_VERSION(v) \
41int xfs_dinode_good_version(int v); 27 (((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2))
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' */ 28#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
48 29
49/* 30/*
@@ -184,75 +165,30 @@ typedef enum xfs_dinode_fmt
184/* 165/*
185 * Inode size for given fs. 166 * Inode size for given fs.
186 */ 167 */
187#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO)
188int xfs_litino(struct xfs_mount *mp);
189#define XFS_LITINO(mp) xfs_litino(mp)
190#else
191#define XFS_LITINO(mp) ((mp)->m_litino) 168#define XFS_LITINO(mp) ((mp)->m_litino)
192#endif
193#define XFS_BROOT_SIZE_ADJ \ 169#define XFS_BROOT_SIZE_ADJ \
194 (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t)) 170 (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t))
195 171
196/* 172/*
197 * Fork identifiers. Here so utilities can use them without including
198 * xfs_inode.h.
199 */
200#define XFS_DATA_FORK 0
201#define XFS_ATTR_FORK 1
202
203/*
204 * Inode data & attribute fork sizes, per inode. 173 * Inode data & attribute fork sizes, per inode.
205 */ 174 */
206#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q)
207int xfs_cfork_q_disk(xfs_dinode_core_t *dcp);
208int xfs_cfork_q(xfs_dinode_core_t *dcp);
209#define XFS_CFORK_Q_DISK(dcp) xfs_cfork_q_disk(dcp)
210#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp)
211#else
212#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
213#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) 175#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0)
176#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
214 177
215#endif
216#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF)
217int xfs_cfork_boff_disk(xfs_dinode_core_t *dcp);
218int xfs_cfork_boff(xfs_dinode_core_t *dcp);
219#define XFS_CFORK_BOFF_DISK(dcp) xfs_cfork_boff_disk(dcp)
220#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp)
221#else
222#define XFS_CFORK_BOFF_DISK(dcp) ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
223#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) 178#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
179#define XFS_CFORK_BOFF_DISK(dcp) \
180 ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
224 181
225#endif
226#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE)
227int xfs_cfork_dsize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
228int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
229#define XFS_CFORK_DSIZE_DISK(dcp,mp) xfs_cfork_dsize_disk(dcp,mp)
230#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp)
231#else
232#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ 182#define XFS_CFORK_DSIZE_DISK(dcp,mp) \
233 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) 183 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp))
234#define XFS_CFORK_DSIZE(dcp,mp) \ 184#define XFS_CFORK_DSIZE(dcp,mp) \
235 (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) 185 (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp))
236 186
237#endif
238#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE)
239int xfs_cfork_asize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
240int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
241#define XFS_CFORK_ASIZE_DISK(dcp,mp) xfs_cfork_asize_disk(dcp,mp)
242#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp)
243#else
244#define XFS_CFORK_ASIZE_DISK(dcp,mp) \ 187#define XFS_CFORK_ASIZE_DISK(dcp,mp) \
245 (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) 188 (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0)
246#define XFS_CFORK_ASIZE(dcp,mp) \ 189#define XFS_CFORK_ASIZE(dcp,mp) \
247 (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) 190 (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0)
248 191
249#endif
250#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE)
251int xfs_cfork_size_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
252int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
253#define XFS_CFORK_SIZE_DISK(dcp,mp,w) xfs_cfork_size_disk(dcp,mp,w)
254#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w)
255#else
256#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ 192#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \
257 ((w) == XFS_DATA_FORK ? \ 193 ((w) == XFS_DATA_FORK ? \
258 XFS_CFORK_DSIZE_DISK(dcp, mp) : \ 194 XFS_CFORK_DSIZE_DISK(dcp, mp) : \
@@ -261,93 +197,26 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
261 ((w) == XFS_DATA_FORK ? \ 197 ((w) == XFS_DATA_FORK ? \
262 XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) 198 XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp))
263 199
264#endif 200#define XFS_DFORK_DSIZE(dip,mp) \
265 201 XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp)
266#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) 202#define XFS_DFORK_ASIZE(dip,mp) \
267int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); 203 XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
268#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) 204#define XFS_DFORK_SIZE(dip,mp,w) \
269#else 205 XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
270#define XFS_DFORK_DSIZE(dip,mp) XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp)
271
272#endif
273#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE)
274int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp);
275#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp)
276#else
277#define XFS_DFORK_ASIZE(dip,mp) XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
278 206
279#endif
280#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE)
281int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w);
282#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w)
283#else
284#define XFS_DFORK_SIZE(dip,mp,w) XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
285
286#endif
287
288/*
289 * Macros for accessing per-fork disk inode information.
290 */
291#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q)
292int xfs_dfork_q(xfs_dinode_t *dip);
293#define XFS_DFORK_Q(dip) xfs_dfork_q(dip)
294#else
295#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) 207#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core)
296
297#endif
298#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF)
299int xfs_dfork_boff(xfs_dinode_t *dip);
300#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip)
301#else
302#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) 208#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core)
303
304#endif
305#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR)
306char *xfs_dfork_dptr(xfs_dinode_t *dip);
307#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip)
308#else
309#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) 209#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c)
310 210#define XFS_DFORK_APTR(dip) \
311#endif 211 ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
312#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR)
313char *xfs_dfork_aptr(xfs_dinode_t *dip);
314#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip)
315#else
316#define XFS_DFORK_APTR(dip) ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
317
318#endif
319#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR)
320char *xfs_dfork_ptr(xfs_dinode_t *dip, int w);
321#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w)
322#else
323#define XFS_DFORK_PTR(dip,w) \ 212#define XFS_DFORK_PTR(dip,w) \
324 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) 213 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
325 214#define XFS_CFORK_FORMAT(dcp,w) \
326#endif
327#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT)
328int xfs_cfork_format(xfs_dinode_core_t *dcp, int w);
329#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w)
330#else
331#define XFS_CFORK_FORMAT(dcp,w) \
332 ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat) 215 ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat)
333
334#endif
335#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET)
336void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n);
337#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n)
338#else
339#define XFS_CFORK_FMT_SET(dcp,w,n) \ 216#define XFS_CFORK_FMT_SET(dcp,w,n) \
340 ((w) == XFS_DATA_FORK ? \ 217 ((w) == XFS_DATA_FORK ? \
341 ((dcp)->di_format = (n)) : \ 218 ((dcp)->di_format = (n)) : ((dcp)->di_aformat = (n)))
342 ((dcp)->di_aformat = (n)))
343 219
344#endif
345#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS)
346int xfs_cfork_nextents_disk(xfs_dinode_core_t *dcp, int w);
347int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
348#define XFS_CFORK_NEXTENTS_DISK(dcp,w) xfs_cfork_nextents_disk(dcp,w)
349#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w)
350#else
351#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ 220#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \
352 ((w) == XFS_DATA_FORK ? \ 221 ((w) == XFS_DATA_FORK ? \
353 INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ 222 INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \
@@ -355,31 +224,13 @@ int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
355#define XFS_CFORK_NEXTENTS(dcp,w) \ 224#define XFS_CFORK_NEXTENTS(dcp,w) \
356 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) 225 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents)
357 226
358#endif
359#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET)
360void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n);
361#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n)
362#else
363#define XFS_CFORK_NEXT_SET(dcp,w,n) \ 227#define XFS_CFORK_NEXT_SET(dcp,w,n) \
364 ((w) == XFS_DATA_FORK ? \ 228 ((w) == XFS_DATA_FORK ? \
365 ((dcp)->di_nextents = (n)) : \ 229 ((dcp)->di_nextents = (n)) : ((dcp)->di_anextents = (n)))
366 ((dcp)->di_anextents = (n)))
367
368#endif
369 230
370#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS)
371int xfs_dfork_nextents(xfs_dinode_t *dip, int w);
372#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w)
373#else
374#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) 231#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w)
375#endif
376 232
377#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE) 233#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp))
378xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
379#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
380#else
381#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp)))
382#endif
383 234
384/* 235/*
385 * Values for di_flags 236 * Values for di_flags