1 /* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file */
2 /*
3  *  GRUB  --  GRand Unified Bootloader
4  *  Copyright (C) 2000  Silicon Graphics, Inc.  All Rights Reserved.
5  *  Copyright (C) 2001,2004  Free Software Foundation, Inc.
6  *
7  *  This program is free software; you can redistribute it and/or modify it
8  *  under the terms of version 2 of the GNU General Public License as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it would be useful, but
12  *  WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  *
15  *  Further, this software is distributed without any warranty that it is
16  *  free of the rightful claim of any third person regarding infringement
17  *  or the like.  Any license provided herein, whether implied or
18  *  otherwise, applies only to this software file.  Patent licenses, if
19  *  any, provided herein do not apply to combinations of this program with
20  *  other software, or any other product whatsoever.
21  *
22  *  You should have received a copy of the GNU General Public License along
23  *  with this program; If not, see <http://www.gnu.org/licenses/>.
24  *
25  *  Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26  *  Mountain View, CA  94043, or:
27  *
28  *  http://www.sgi.com
29  *
30  *  For further information regarding this notice, see:
31  *
32  *  http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33  */
34 
35 typedef signed char	xfs_int8_t;
36 typedef unsigned char	xfs_uint8_t;
37 typedef short		xfs_int16_t;
38 typedef unsigned short	xfs_uint16_t;
39 typedef int		xfs_int32_t;
40 typedef unsigned int	xfs_uint32_t;
41 typedef long long	xfs_int64_t;
42 typedef unsigned long long xfs_uint64_t;
43 
44 typedef xfs_uint64_t	xfs_ino_t;
45 typedef	xfs_uint32_t	xfs_agino_t;
46 typedef xfs_int64_t	xfs_daddr_t;
47 typedef xfs_int64_t	xfs_off_t;
48 typedef xfs_uint8_t	uuid_t[16];
49 
50 
51 /* those are from xfs_types.h */
52 
53 typedef xfs_uint32_t	xfs_agblock_t;	/* blockno in alloc. group */
54 typedef	xfs_uint32_t	xfs_extlen_t;	/* extent length in blocks */
55 typedef	xfs_uint32_t	xfs_agnumber_t;	/* allocation group number */
56 typedef xfs_int32_t	xfs_extnum_t;	/* # of extents in a file */
57 typedef xfs_int16_t	xfs_aextnum_t;	/* # extents in an attribute fork */
58 typedef	xfs_int64_t	xfs_fsize_t;	/* bytes in a file */
59 
60 typedef	xfs_uint32_t	xfs_dablk_t;	/* dir/attr block number (in file) */
61 typedef	xfs_uint32_t	xfs_dahash_t;	/* dir/attr hash value */
62 
63 /*
64  * Disk based types:
65  */
66 typedef xfs_uint64_t	xfs_dfsbno_t;	/* blockno in filesystem (agno|agbno) */
67 typedef xfs_uint64_t	xfs_drfsbno_t;	/* blockno in filesystem (raw) */
68 typedef	xfs_uint64_t	xfs_drtbno_t;	/* extent (block) in realtime area */
69 typedef	xfs_uint64_t	xfs_dfiloff_t;	/* block number in a file */
70 
71 typedef	xfs_uint64_t	xfs_fsblock_t;	/* blockno in filesystem (agno|agbno) */
72 typedef	xfs_uint64_t	xfs_fileoff_t;	/* block number in a file */
73 typedef	xfs_uint64_t	xfs_filblks_t;	/* number of blocks in a file */
74 
75 
76 /* those are from xfs_sb.h */
77 
78 #define	XFS_SB_MAGIC		0x58465342	/* 'XFSB'*/
79 #define	XFS_SB_VERSION_4	4		/* 6.2+ - bitmask version */
80 #define	XFS_SB_VERSION_NUMBITS	0x000f
81 
82 typedef struct xfs_sb
83 {
84 	xfs_uint32_t	sb_magicnum;	/* magic number == XFS_SB_MAGIC */
85 	xfs_uint32_t	sb_blocksize;	/* logical block size, bytes */
86 	xfs_drfsbno_t	sb_dblocks;	/* number of data blocks */
87 	xfs_drfsbno_t	sb_rblocks;	/* number of realtime blocks */
88 	xfs_drtbno_t	sb_rextents;	/* number of realtime extents */
89 	uuid_t		sb_uuid;	/* file system unique id */
90 	xfs_dfsbno_t	sb_logstart;	/* starting block of log if internal */
91 	xfs_ino_t	sb_rootino;	/* root inode number */
92 	xfs_ino_t	sb_rbmino;	/* bitmap inode for realtime extents */
93 	xfs_ino_t	sb_rsumino;	/* summary inode for rt bitmap */
94 	xfs_agblock_t	sb_rextsize;	/* realtime extent size, blocks */
95 	xfs_agblock_t	sb_agblocks;	/* size of an allocation group */
96 	xfs_agnumber_t	sb_agcount;	/* number of allocation groups */
97 	xfs_extlen_t	sb_rbmblocks;	/* number of rt bitmap blocks */
98 	xfs_extlen_t	sb_logblocks;	/* number of log blocks */
99 	xfs_uint16_t	sb_versionnum;	/* header version == XFS_SB_VERSION */
100 	xfs_uint16_t	sb_sectsize;	/* volume sector size, bytes */
101 	xfs_uint16_t	sb_inodesize;	/* inode size, bytes */
102 	xfs_uint16_t	sb_inopblock;	/* inodes per block */
103 	char		sb_fname[12];	/* file system name */
104 	xfs_uint8_t	sb_blocklog;	/* log2 of sb_blocksize */
105 	xfs_uint8_t	sb_sectlog;	/* log2 of sb_sectsize */
106 	xfs_uint8_t	sb_inodelog;	/* log2 of sb_inodesize */
107 	xfs_uint8_t	sb_inopblog;	/* log2 of sb_inopblock */
108 	xfs_uint8_t	sb_agblklog;	/* log2 of sb_agblocks (rounded up) */
109 	xfs_uint8_t	sb_rextslog;	/* log2 of sb_rextents */
110 	xfs_uint8_t	sb_inprogress;	/* mkfs is in progress, don't mount */
111 	xfs_uint8_t	sb_imax_pct;	/* max % of fs for inode space */
112 					/* statistics */
113 	/*
114 	 * These fields must remain contiguous.  If you really
115 	 * want to change their layout, make sure you fix the
116 	 * code in xfs_trans_apply_sb_deltas().
117 	 */
118 	xfs_uint64_t	sb_icount;	/* allocated inodes */
119 	xfs_uint64_t	sb_ifree;	/* free inodes */
120 	xfs_uint64_t	sb_fdblocks;	/* free data blocks */
121 	xfs_uint64_t	sb_frextents;	/* free realtime extents */
122 	/*
123 	 * End contiguous fields.
124 	 */
125 	xfs_ino_t	sb_uquotino;	/* user quota inode */
126 	xfs_ino_t	sb_gquotino;	/* group quota inode */
127 	xfs_uint16_t	sb_qflags;	/* quota flags */
128 	xfs_uint8_t	sb_flags;	/* misc. flags */
129 	xfs_uint8_t	sb_shared_vn;	/* shared version number */
130 	xfs_extlen_t	sb_inoalignmt;	/* inode chunk alignment, fsblocks */
131 	xfs_uint32_t	sb_unit;	/* stripe or raid unit */
132 	xfs_uint32_t	sb_width;	/* stripe or raid width */
133 	xfs_uint8_t	sb_dirblklog;	/* log2 of dir block size (fsbs) */
134         xfs_uint8_t       sb_dummy[7];    /* padding */
135 } xfs_sb_t;
136 
137 /* Bound taken from xfs.c in GRUB2. It doesn't exist in the spec */
138 #define	XFS_SB_DIRBLK_NUMBITS	27
139 /* Implied by the XFS specification. The minimum block size is 512 octets */
140 #define	XFS_SB_BLOCKLOG_MIN	9
141 /* Implied by the XFS specification. The maximum block size is 65536 octets */
142 #define	XFS_SB_BLOCKLOG_MAX	16
143 /* Implied by the XFS specification. The minimum inode size is 256 octets */
144 #define	XFS_SB_INODELOG_MIN	8
145 /* Implied by the XFS specification. The maximum inode size is 2048 octets */
146 #define	XFS_SB_INODELOG_MAX	11
147 /* High bound for sb_agblklog */
148 #define	XFS_SB_AGBLKLOG_MAX	32
149 
150 /* those are from xfs_btree.h */
151 
152 /*
153  * Long form header: bmap btrees.
154  */
155 typedef struct xfs_btree_lblock
156 {
157 	xfs_uint32_t	bb_magic;	/* magic number for block type */
158 	xfs_uint16_t	bb_level;	/* 0 is a leaf */
159 	xfs_uint16_t	bb_numrecs;	/* current # of data records */
160 	xfs_dfsbno_t	bb_leftsib;	/* left sibling block or NULLDFSBNO */
161 	xfs_dfsbno_t	bb_rightsib;	/* right sibling block or NULLDFSBNO */
162 } xfs_btree_lblock_t;
163 
164 /*
165  * Combined header and structure, used by common code.
166  */
167 typedef struct xfs_btree_hdr
168 {
169 	xfs_uint32_t	bb_magic;	/* magic number for block type */
170 	xfs_uint16_t	bb_level;	/* 0 is a leaf */
171 	xfs_uint16_t	bb_numrecs;	/* current # of data records */
172 } xfs_btree_hdr_t;
173 
174 typedef struct xfs_btree_block
175 {
176 	xfs_btree_hdr_t	bb_h;		/* header */
177 	union		{
178 		struct	{
179 			xfs_agblock_t	bb_leftsib;
180 			xfs_agblock_t	bb_rightsib;
181 		}	s;		/* short form pointers */
182 		struct	{
183 			xfs_dfsbno_t	bb_leftsib;
184 			xfs_dfsbno_t	bb_rightsib;
185 		}	l;		/* long form pointers */
186 	}		bb_u;		/* rest */
187 } xfs_btree_block_t;
188 
189 /* those are from xfs_bmap_btree.h */
190 
191 /*
192  * Bmap root header, on-disk form only.
193  */
194 typedef struct xfs_bmdr_block
195 {
196 	xfs_uint16_t	bb_level;	/* 0 is a leaf */
197 	xfs_uint16_t	bb_numrecs;	/* current # of data records */
198 } xfs_bmdr_block_t;
199 
200 /*
201  * Bmap btree record and extent descriptor.
202  * For 32-bit kernels,
203  *  l0:31 is an extent flag (value 1 indicates non-normal).
204  *  l0:0-30 and l1:9-31 are startoff.
205  *  l1:0-8, l2:0-31, and l3:21-31 are startblock.
206  *  l3:0-20 are blockcount.
207  * For 64-bit kernels,
208  *  l0:63 is an extent flag (value 1 indicates non-normal).
209  *  l0:9-62 are startoff.
210  *  l0:0-8 and l1:21-63 are startblock.
211  *  l1:0-20 are blockcount.
212  */
213 
214 #define	BMBT_USE_64	1
215 
216 typedef struct xfs_bmbt_rec_32
217 {
218 	xfs_uint32_t		l0, l1, l2, l3;
219 } xfs_bmbt_rec_32_t;
220 typedef struct xfs_bmbt_rec_64
221 {
222 	xfs_uint64_t		l0, l1;
223 } xfs_bmbt_rec_64_t;
224 
225 #if BMBT_USE_64
226 typedef	xfs_uint64_t	xfs_bmbt_rec_base_t;	/* use this for casts */
227 typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
228 #else	/* !BMBT_USE_64 */
229 typedef	xfs_uint32_t	xfs_bmbt_rec_base_t;	/* use this for casts */
230 typedef xfs_bmbt_rec_32_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
231 #endif	/* BMBT_USE_64 */
232 
233 /*
234  * Key structure for non-leaf levels of the tree.
235  */
236 typedef struct xfs_bmbt_key
237 {
238 	xfs_dfiloff_t	br_startoff;	/* starting file offset */
239 } xfs_bmbt_key_t, xfs_bmdr_key_t;
240 
241 typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;	/* btree pointer type */
242 					/* btree block header type */
243 typedef	struct xfs_btree_lblock xfs_bmbt_block_t;
244 
245 
246 /* those are from xfs_dir2.h */
247 /*
248  * Directory version 2.
249  * There are 4 possible formats:
250  *	shortform
251  *	single block - data with embedded leaf at the end
252  *	multiple data blocks, single leaf+freeindex block
253  *	data blocks, node&leaf blocks (btree), freeindex blocks
254  *
255  *	The shortform format is in xfs_dir2_sf.h.
256  *	The single block format is in xfs_dir2_block.h.
257  *	The data block format is in xfs_dir2_data.h.
258  *	The leaf and freeindex block formats are in xfs_dir2_leaf.h.
259  *	Node blocks are the same as the other version, in xfs_da_btree.h.
260  */
261 
262 /*
263  * Byte offset in data block and shortform entry.
264  */
265 typedef	xfs_uint16_t	xfs_dir2_data_off_t;
266 
267 /*
268  * Byte offset in a directory.
269  */
270 typedef	xfs_off_t		xfs_dir2_off_t;
271 
272 /* those are from xfs_da_btree.h */
273 /*========================================================================
274  * Directory Structure when greater than XFS_LBSIZE(mp) bytes.
275  *========================================================================*/
276 
277 /*
278  * This structure is common to both leaf nodes and non-leaf nodes in the Btree.
279  *
280  * Is is used to manage a doubly linked list of all blocks at the same
281  * level in the Btree, and to identify which type of block this is.
282  */
283 #define	XFS_DIR2_LEAF1_MAGIC	0xd2f1	/* magic number: v2 dirlf single blks */
284 #define	XFS_DIR2_LEAFN_MAGIC	0xd2ff	/* magic number: v2 dirlf multi blks */
285 
286 typedef struct xfs_da_blkinfo {
287 	xfs_dablk_t forw;			/* previous block in list */
288 	xfs_dablk_t back;			/* following block in list */
289 	xfs_uint16_t magic;			/* validity check on block */
290 	xfs_uint16_t pad;				/* unused */
291 } xfs_da_blkinfo_t;
292 
293 /*
294  * This is the structure of the root and intermediate nodes in the Btree.
295  * The leaf nodes are defined above.
296  *
297  * Entries are not packed.
298  *
299  * Since we have duplicate keys, use a binary search but always follow
300  * all match in the block, not just the first match found.
301  */
302 
303 typedef struct xfs_da_intnode {
304 	struct xfs_da_node_hdr {	/* constant-structure header block */
305 		xfs_da_blkinfo_t info;	/* block type, links, etc. */
306 		xfs_uint16_t count;	/* count of active entries */
307 		xfs_uint16_t level;	/* level above leaves (leaf == 0) */
308 	} hdr;
309 	struct xfs_da_node_entry {
310 		xfs_dahash_t hashval;	/* hash value for this descendant */
311 		xfs_dablk_t before;	/* Btree block before this key */
312 	} btree[1];			/* variable sized array of keys */
313 } xfs_da_intnode_t;
314 
315 
316 /* those are from xfs_dir2_data.h */
317 /*
318  * Directory format 2, data block structures.
319  */
320 
321 /*
322  * Constants.
323  */
324 #define	XFS_DIR2_DATA_FREE_TAG	0xffff
325 #define	XFS_DIR2_DATA_FD_COUNT	3
326 
327 /*
328  * Structures.
329  */
330 
331 /*
332  * Describe a free area in the data block.
333  * The freespace will be formatted as a xfs_dir2_data_unused_t.
334  */
335 typedef struct xfs_dir2_data_free {
336 	xfs_dir2_data_off_t	offset;		/* start of freespace */
337 	xfs_dir2_data_off_t	length;		/* length of freespace */
338 } xfs_dir2_data_free_t;
339 
340 /*
341  * Header for the data blocks.
342  * Always at the beginning of a directory-sized block.
343  * The code knows that XFS_DIR2_DATA_FD_COUNT is 3.
344  */
345 typedef struct xfs_dir2_data_hdr {
346 	xfs_uint32_t		magic;		/* XFS_DIR2_DATA_MAGIC */
347 						/* or XFS_DIR2_BLOCK_MAGIC */
348 	xfs_dir2_data_free_t	bestfree[XFS_DIR2_DATA_FD_COUNT];
349 } xfs_dir2_data_hdr_t;
350 
351 /*
352  * Active entry in a data block.  Aligned to 8 bytes.
353  * Tag appears as the last 2 bytes.
354  */
355 typedef struct xfs_dir2_data_entry {
356 	xfs_ino_t		inumber;	/* inode number */
357 	xfs_uint8_t		namelen;	/* name length */
358 	xfs_uint8_t		name[1];	/* name bytes, no null */
359 						/* variable offset */
360 	xfs_dir2_data_off_t	tag;		/* starting offset of us */
361 } xfs_dir2_data_entry_t;
362 
363 /*
364  * Unused entry in a data block.  Aligned to 8 bytes.
365  * Tag appears as the last 2 bytes.
366  */
367 typedef struct xfs_dir2_data_unused {
368 	xfs_uint16_t		freetag;	/* XFS_DIR2_DATA_FREE_TAG */
369 	xfs_dir2_data_off_t	length;		/* total free length */
370 						/* variable offset */
371 	xfs_dir2_data_off_t	tag;		/* starting offset of us */
372 } xfs_dir2_data_unused_t;
373 
374 typedef union {
375 	xfs_dir2_data_entry_t	entry;
376 	xfs_dir2_data_unused_t	unused;
377 } xfs_dir2_data_union_t;
378 
379 
380 /* those are from xfs_dir2_leaf.h */
381 /*
382  * Directory version 2, leaf block structures.
383  */
384 
385 /*
386  * Leaf block header.
387  */
388 typedef struct xfs_dir2_leaf_hdr {
389 	xfs_da_blkinfo_t	info;		/* header for da routines */
390 	xfs_uint16_t		count;		/* count of entries */
391 	xfs_uint16_t		stale;		/* count of stale entries */
392 } xfs_dir2_leaf_hdr_t;
393 
394 
395 /* those are from xfs_dir2_block.h */
396 /*
397  * xfs_dir2_block.h
398  * Directory version 2, single block format structures
399  */
400 
401 /*
402  * The single block format is as follows:
403  * xfs_dir2_data_hdr_t structure
404  * xfs_dir2_data_entry_t and xfs_dir2_data_unused_t structures
405  * xfs_dir2_leaf_entry_t structures
406  * xfs_dir2_block_tail_t structure
407  */
408 
409 #define	XFS_DIR2_BLOCK_MAGIC	0x58443242	/* XD2B: for one block dirs */
410 
411 typedef struct xfs_dir2_block_tail {
412 	xfs_uint32_t	count;			/* count of leaf entries */
413 	xfs_uint32_t	stale;			/* count of stale lf entries */
414 } xfs_dir2_block_tail_t;
415 
416 
417 /* those are from xfs_dir2_sf.h */
418 
419 /*
420  * Directory layout when stored internal to an inode.
421  *
422  * Small directories are packed as tightly as possible so as to
423  * fit into the literal area of the inode.
424  */
425 
426 /*
427  * Inode number stored as 8 8-bit values.
428  */
429 typedef	struct { xfs_uint8_t i[8]; } xfs_dir2_ino8_t;
430 
431 /*
432  * Inode number stored as 4 8-bit values.
433  * Works a lot of the time, when all the inode numbers in a directory
434  * fit in 32 bits.
435  */
436 typedef struct { xfs_uint8_t i[4]; } xfs_dir2_ino4_t;
437 
438 typedef union {
439 	xfs_dir2_ino8_t	i8;
440 	xfs_dir2_ino4_t	i4;
441 } xfs_dir2_inou_t;
442 
443 /*
444  * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
445  * Only need 16 bits, this is the byte offset into the single block form.
446  */
447 typedef struct { xfs_uint8_t i[2]; } xfs_dir2_sf_off_t;
448 
449 /*
450  * The parent directory has a dedicated field, and the self-pointer must
451  * be calculated on the fly.
452  *
453  * Entries are packed toward the top as tightly as possible.  The header
454  * and the elements must be bcopy()'d out into a work area to get correct
455  * alignment for the inode number fields.
456  */
457 typedef struct xfs_dir2_sf_hdr {
458 	xfs_uint8_t		count;		/* count of entries */
459 	xfs_uint8_t		i8count;	/* count of 8-byte inode #s */
460 	xfs_dir2_inou_t		parent;		/* parent dir inode number */
461 } xfs_dir2_sf_hdr_t;
462 
463 typedef struct xfs_dir2_sf_entry {
464 	xfs_uint8_t		namelen;	/* actual name length */
465 	xfs_dir2_sf_off_t	offset;		/* saved offset */
466 	xfs_uint8_t		name[1];	/* name, variable size */
467 	xfs_dir2_inou_t		inumber;	/* inode number, var. offset */
468 } xfs_dir2_sf_entry_t;
469 
470 typedef struct xfs_dir2_sf {
471 	xfs_dir2_sf_hdr_t	hdr;		/* shortform header */
472 	xfs_dir2_sf_entry_t	list[1];	/* shortform entries */
473 } xfs_dir2_sf_t;
474 
475 /* those are from xfs_dinode.h */
476 
477 #define	XFS_DINODE_VERSION_1	1
478 #define	XFS_DINODE_VERSION_2	2
479 #define	XFS_DINODE_MAGIC	0x494e	/* 'IN' */
480 
481 /*
482  * Disk inode structure.
483  * This is just the header; the inode is expanded to fill a variable size
484  * with the last field expanding.  It is split into the core and "other"
485  * because we only need the core part in the in-core inode.
486  */
487 typedef struct xfs_timestamp {
488 	xfs_int32_t	t_sec;		/* timestamp seconds */
489 	xfs_int32_t	t_nsec;		/* timestamp nanoseconds */
490 } xfs_timestamp_t;
491 
492 /*
493  * Note: Coordinate changes to this structure with the XFS_DI_* #defines
494  * below and the offsets table in xfs_ialloc_log_di().
495  */
496 typedef struct xfs_dinode_core
497 {
498 	xfs_uint16_t	di_magic;	/* inode magic # = XFS_DINODE_MAGIC */
499 	xfs_uint16_t	di_mode;	/* mode and type of file */
500 	xfs_int8_t	di_version;	/* inode version */
501 	xfs_int8_t	di_format;	/* format of di_c data */
502 	xfs_uint16_t	di_onlink;	/* old number of links to file */
503 	xfs_uint32_t	di_uid;		/* owner's user id */
504 	xfs_uint32_t	di_gid;		/* owner's group id */
505 	xfs_uint32_t	di_nlink;	/* number of links to file */
506 	xfs_uint16_t	di_projid;	/* owner's project id */
507 	xfs_uint8_t	di_pad[10];	/* unused, zeroed space */
508 	xfs_timestamp_t	di_atime;	/* time last accessed */
509 	xfs_timestamp_t	di_mtime;	/* time last modified */
510 	xfs_timestamp_t	di_ctime;	/* time created/inode modified */
511 	xfs_fsize_t	di_size;	/* number of bytes in file */
512 	xfs_drfsbno_t	di_nblocks;	/* # of direct & btree blocks used */
513 	xfs_extlen_t	di_extsize;	/* basic/minimum extent size for file */
514 	xfs_extnum_t	di_nextents;	/* number of extents in data fork */
515 	xfs_aextnum_t	di_anextents;	/* number of extents in attribute fork*/
516 	xfs_uint8_t	di_forkoff;	/* attr fork offs, <<3 for 64b align */
517 	xfs_int8_t	di_aformat;	/* format of attr fork's data */
518 	xfs_uint32_t	di_dmevmask;	/* DMIG event mask */
519 	xfs_uint16_t	di_dmstate;	/* DMIG state info */
520 	xfs_uint16_t	di_flags;	/* random flags, XFS_DIFLAG_... */
521 	xfs_uint32_t	di_gen;		/* generation number */
522 } xfs_dinode_core_t;
523 
524 typedef struct xfs_dinode
525 {
526 	xfs_dinode_core_t	di_core;
527 	xfs_agino_t		di_next_unlinked;/* agi unlinked list ptr */
528 	union {
529 		xfs_bmdr_block_t di_bmbt;	/* btree root block */
530 		xfs_bmbt_rec_32_t di_bmx[1];	/* extent list */
531 		xfs_dir2_sf_t	di_dir2sf;	/* shortform directory v2 */
532 		char		di_c[1];	/* local contents */
533 	} di_u;
534 } xfs_dinode_t;
535 
536 /*
537  * Values for di_format
538  */
539 typedef enum xfs_dinode_fmt
540 {
541 	XFS_DINODE_FMT_DEV,		/* CHR, BLK: di_dev */
542 	XFS_DINODE_FMT_LOCAL,		/* DIR, REG: di_c */
543 					/* LNK: di_symlink */
544 	XFS_DINODE_FMT_EXTENTS,		/* DIR, REG, LNK: di_bmx */
545 	XFS_DINODE_FMT_BTREE,		/* DIR, REG, LNK: di_bmbt */
546 	XFS_DINODE_FMT_UUID 		/* MNT: di_uuid */
547 } xfs_dinode_fmt_t;
548 
549 /*
550  * File types (mode field)
551  */
552 #define	IFMT		0170000		/* type of file */
553 #define	IFDIR		0040000		/* directory */
554 #define	IFREG		0100000		/* regular */
555 #define	IFLNK		0120000		/* symbolic link */
556