Linux 2.6.13-rc4
[linux-2.6/next.git] / fs / xfs / xfs_dir2.h
blob8f4fc7f23bcd890866006d94761c5c95dc5e706e
1 /*
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:
26 * http://www.sgi.com
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__
35 struct uio;
36 struct xfs_dabuf;
37 struct xfs_da_args;
38 struct xfs_dir2_put_args;
39 struct xfs_inode;
40 struct xfs_trans;
43 * Directory version 2.
44 * There are 4 possible formats:
45 * shortform
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.
95 extern int
96 xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
97 xfs_dir2_db_t *dbp);
99 extern int
100 xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *vp);
102 extern int
103 xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *vp);
105 extern int
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__ */