Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier...
[linux-2.6/linux-2.6-openrd.git] / fs / xfs / xfs_dir2.h
blob1d9ef96f33aa736beeeeda6b368453cecbe774e6
1 /*
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef __XFS_DIR2_H__
19 #define __XFS_DIR2_H__
21 struct uio;
22 struct xfs_dabuf;
23 struct xfs_da_args;
24 struct xfs_dir2_put_args;
25 struct xfs_bmap_free;
26 struct xfs_inode;
27 struct xfs_mount;
28 struct xfs_trans;
31 * Directory version 2.
32 * There are 4 possible formats:
33 * shortform
34 * single block - data with embedded leaf at the end
35 * multiple data blocks, single leaf+freeindex block
36 * data blocks, node&leaf blocks (btree), freeindex blocks
38 * The shortform format is in xfs_dir2_sf.h.
39 * The single block format is in xfs_dir2_block.h.
40 * The data block format is in xfs_dir2_data.h.
41 * The leaf and freeindex block formats are in xfs_dir2_leaf.h.
42 * Node blocks are the same as the other version, in xfs_da_btree.h.
46 * Byte offset in data block and shortform entry.
48 typedef __uint16_t xfs_dir2_data_off_t;
49 #define NULLDATAOFF 0xffffU
50 typedef uint xfs_dir2_data_aoff_t; /* argument form */
53 * Directory block number (logical dirblk in file)
55 typedef __uint32_t xfs_dir2_db_t;
58 * Byte offset in a directory.
60 typedef xfs_off_t xfs_dir2_off_t;
62 extern struct xfs_name xfs_name_dotdot;
65 * Generic directory interface routines
67 extern void xfs_dir_startup(void);
68 extern void xfs_dir_mount(struct xfs_mount *mp);
69 extern int xfs_dir_isempty(struct xfs_inode *dp);
70 extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
71 struct xfs_inode *pdp);
72 extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
73 struct xfs_name *name, xfs_ino_t inum,
74 xfs_fsblock_t *first,
75 struct xfs_bmap_free *flist, xfs_extlen_t tot);
76 extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
77 struct xfs_name *name, xfs_ino_t *inum,
78 struct xfs_name *ci_name);
79 extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
80 struct xfs_name *name, xfs_ino_t ino,
81 xfs_fsblock_t *first,
82 struct xfs_bmap_free *flist, xfs_extlen_t tot);
83 extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
84 struct xfs_name *name, xfs_ino_t inum,
85 xfs_fsblock_t *first,
86 struct xfs_bmap_free *flist, xfs_extlen_t tot);
87 extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
88 struct xfs_name *name, uint resblks);
89 extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
92 * Utility routines for v2 directories.
94 extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
95 xfs_dir2_db_t *dbp);
96 extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp,
97 int *vp);
98 extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,
99 int *vp);
100 extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
101 struct xfs_dabuf *bp);
103 extern int xfs_dir_cilookup_result(struct xfs_da_args *args, const char *name,
104 int len);
106 #endif /* __XFS_DIR2_H__ */