2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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.
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.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #ifndef __XFS_DIR2_H__
33 #define __XFS_DIR2_H__
38 struct xfs_dir2_put_args
;
43 * Directory version 2.
44 * There are 4 possible formats:
46 * single block - data with embedded leaf at the end
47 * multiple data blocks, single leaf+freeindex block
48 * data blocks, node&leaf blocks (btree), freeindex blocks
50 * The shortform format is in xfs_dir2_sf.h.
51 * The single block format is in xfs_dir2_block.h.
52 * The data block format is in xfs_dir2_data.h.
53 * The leaf and freeindex block formats are in xfs_dir2_leaf.h.
54 * Node blocks are the same as the other version, in xfs_da_btree.h.
58 * Byte offset in data block and shortform entry.
60 typedef __uint16_t xfs_dir2_data_off_t
;
61 #define NULLDATAOFF 0xffffU
62 typedef uint xfs_dir2_data_aoff_t
; /* argument form */
65 * Directory block number (logical dirblk in file)
67 typedef __uint32_t xfs_dir2_db_t
;
70 * Byte offset in a directory.
72 typedef xfs_off_t xfs_dir2_off_t
;
75 * For getdents, argument struct for put routines.
77 typedef int (*xfs_dir2_put_t
)(struct xfs_dir2_put_args
*pa
);
78 typedef struct xfs_dir2_put_args
{
79 xfs_off_t cook
; /* cookie of (next) entry */
80 xfs_intino_t ino
; /* inode number */
81 struct xfs_dirent
*dbp
; /* buffer pointer */
82 char *name
; /* directory entry name */
83 int namelen
; /* length of name */
84 int done
; /* output: set if value was stored */
85 xfs_dir2_put_t put
; /* put function ptr (i/o) */
86 struct uio
*uio
; /* uio control structure */
87 } xfs_dir2_put_args_t
;
89 #define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2)
90 extern xfs_dirops_t xfsv2_dirops
;
93 * Other interfaces used by the rest of the dir v2 code.
96 xfs_dir2_grow_inode(struct xfs_da_args
*args
, int space
,
100 xfs_dir2_isblock(struct xfs_trans
*tp
, struct xfs_inode
*dp
, int *vp
);
103 xfs_dir2_isleaf(struct xfs_trans
*tp
, struct xfs_inode
*dp
, int *vp
);
106 xfs_dir2_shrink_inode(struct xfs_da_args
*args
, xfs_dir2_db_t db
,
107 struct xfs_dabuf
*bp
);
109 #endif /* __XFS_DIR2_H__ */