]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xfs_dir2.h
Undoes mod: xfs-cmds:slinx:120772a
[thirdparty/xfsprogs-dev.git] / include / xfs_dir2.h
CommitLineData
2bd0ea18 1/*
9911e5dc 2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
2bd0ea18
NS
3 *
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.
7 *
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.
11 *
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.
18 *
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.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32#ifndef __XFS_DIR2_H__
33#define __XFS_DIR2_H__
34
35struct dirent;
36struct uio;
37struct xfs_dabuf;
38struct xfs_da_args;
39struct xfs_dir2_put_args;
40struct xfs_inode;
41struct xfs_trans;
42
43/*
44 * Directory version 2.
45 * There are 4 possible formats:
46 * shortform
47 * single block - data with embedded leaf at the end
48 * multiple data blocks, single leaf+freeindex block
49 * data blocks, node&leaf blocks (btree), freeindex blocks
50 *
51 * The shortform format is in xfs_dir2_sf.h.
52 * The single block format is in xfs_dir2_block.h.
53 * The data block format is in xfs_dir2_data.h.
54 * The leaf and freeindex block formats are in xfs_dir2_leaf.h.
55 * Node blocks are the same as the other version, in xfs_da_btree.h.
56 */
57
58/*
59 * Byte offset in data block and shortform entry.
60 */
61typedef __uint16_t xfs_dir2_data_off_t;
62#define NULLDATAOFF 0xffffU
63typedef uint xfs_dir2_data_aoff_t; /* argument form */
64
65/*
66 * Directory block number (logical dirblk in file)
67 */
68typedef __uint32_t xfs_dir2_db_t;
69
70/*
71 * Byte offset in a directory.
72 */
73typedef xfs_off_t xfs_dir2_off_t;
74
75/*
76 * For getdents, argument struct for put routines.
77 */
78typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa);
79typedef struct xfs_dir2_put_args {
80 xfs_off_t cook; /* cookie of (next) entry */
81 xfs_intino_t ino; /* inode number */
0e266570 82 struct xfs_dirent *dbp; /* buffer pointer */
2bd0ea18
NS
83 char *name; /* directory entry name */
84 int namelen; /* length of name */
85 int done; /* output: set if value was stored */
86 xfs_dir2_put_t put; /* put function ptr (i/o) */
87 struct uio *uio; /* uio control structure */
2bd0ea18
NS
88} xfs_dir2_put_args_t;
89
90#define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2)
91extern xfs_dirops_t xfsv2_dirops;
92
93/*
94 * Other interfaces used by the rest of the dir v2 code.
95 */
96extern int
97 xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
98 xfs_dir2_db_t *dbp);
99
100extern int
101 xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *vp);
102
103extern int
104 xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *vp);
105
106extern int
107 xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
108 struct xfs_dabuf *bp);
109
110#endif /* __XFS_DIR2_H__ */