ocfs2_dlm: Fix lockres ref counting bug
[deliverable/linux.git] / fs / xfs / xfs_dir2.h
CommitLineData
1da177e4 1/*
7b718769
NS
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
1da177e4 4 *
7b718769
NS
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
1da177e4
LT
7 * published by the Free Software Foundation.
8 *
7b718769
NS
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.
1da177e4 13 *
7b718769
NS
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
1da177e4
LT
17 */
18#ifndef __XFS_DIR2_H__
19#define __XFS_DIR2_H__
20
21struct uio;
22struct xfs_dabuf;
23struct xfs_da_args;
24struct xfs_dir2_put_args;
f6c2d1fa 25struct xfs_bmap_free;
1da177e4 26struct xfs_inode;
f6c2d1fa 27struct xfs_mount;
1da177e4
LT
28struct xfs_trans;
29
30/*
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
37 *
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.
43 */
44
45/*
46 * Byte offset in data block and shortform entry.
47 */
48typedef __uint16_t xfs_dir2_data_off_t;
49#define NULLDATAOFF 0xffffU
50typedef uint xfs_dir2_data_aoff_t; /* argument form */
51
52/*
53 * Directory block number (logical dirblk in file)
54 */
55typedef __uint32_t xfs_dir2_db_t;
56
57/*
58 * Byte offset in a directory.
59 */
2d0f864b 60typedef xfs_off_t xfs_dir2_off_t;
1da177e4
LT
61
62/*
63 * For getdents, argument struct for put routines.
64 */
65typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa);
66typedef struct xfs_dir2_put_args {
2d0f864b 67 xfs_off_t cook; /* cookie of (next) entry */
1da177e4 68 xfs_intino_t ino; /* inode number */
2d0f864b 69 xfs_dirent_t *dbp; /* buffer pointer */
1da177e4
LT
70 char *name; /* directory entry name */
71 int namelen; /* length of name */
72 int done; /* output: set if value was stored */
73 xfs_dir2_put_t put; /* put function ptr (i/o) */
74 struct uio *uio; /* uio control structure */
75} xfs_dir2_put_args_t;
76
1da177e4 77/*
f6c2d1fa
NS
78 * Generic directory interface routines
79 */
80extern void xfs_dir_startup(void);
81extern void xfs_dir_mount(struct xfs_mount *mp);
82extern int xfs_dir_isempty(struct xfs_inode *dp);
83extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
84 struct xfs_inode *pdp);
85extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
86 char *name, int namelen, xfs_ino_t inum,
87 xfs_fsblock_t *first,
88 struct xfs_bmap_free *flist, xfs_extlen_t tot);
89extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
90 char *name, int namelen, xfs_ino_t *inum);
91extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
92 char *name, int namelen, xfs_ino_t ino,
93 xfs_fsblock_t *first,
94 struct xfs_bmap_free *flist, xfs_extlen_t tot);
95extern int xfs_dir_getdents(struct xfs_trans *tp, struct xfs_inode *dp,
96 uio_t *uio, int *eofp);
97extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
98 char *name, int namelen, xfs_ino_t inum,
99 xfs_fsblock_t *first,
100 struct xfs_bmap_free *flist, xfs_extlen_t tot);
101extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
102 char *name, int namelen);
103extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
104
105/*
106 * Utility routines for v2 directories.
1da177e4 107 */
2d0f864b
NS
108extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
109 xfs_dir2_db_t *dbp);
110extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp,
111 int *vp);
112extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,
113 int *vp);
114extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
115 struct xfs_dabuf *bp);
1da177e4
LT
116
117#endif /* __XFS_DIR2_H__ */
This page took 0.257843 seconds and 5 git commands to generate.