| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 |  * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. | 
 | 3 |  * All Rights Reserved. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 |  * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 |  * published by the Free Software Foundation. | 
 | 8 |  * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 |  * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 |  */ | 
 | 18 | #ifndef __XFS_DIR2_H__ | 
 | 19 | #define	__XFS_DIR2_H__ | 
 | 20 |  | 
 | 21 | struct uio; | 
 | 22 | struct xfs_dabuf; | 
 | 23 | struct xfs_da_args; | 
 | 24 | struct xfs_dir2_put_args; | 
 | 25 | struct xfs_inode; | 
 | 26 | struct xfs_trans; | 
 | 27 |  | 
 | 28 | /* | 
 | 29 |  * Directory version 2. | 
 | 30 |  * There are 4 possible formats: | 
 | 31 |  *	shortform | 
 | 32 |  *	single block - data with embedded leaf at the end | 
 | 33 |  *	multiple data blocks, single leaf+freeindex block | 
 | 34 |  *	data blocks, node&leaf blocks (btree), freeindex blocks | 
 | 35 |  * | 
 | 36 |  *	The shortform format is in xfs_dir2_sf.h. | 
 | 37 |  *	The single block format is in xfs_dir2_block.h. | 
 | 38 |  *	The data block format is in xfs_dir2_data.h. | 
 | 39 |  *	The leaf and freeindex block formats are in xfs_dir2_leaf.h. | 
 | 40 |  *	Node blocks are the same as the other version, in xfs_da_btree.h. | 
 | 41 |  */ | 
 | 42 |  | 
 | 43 | /* | 
 | 44 |  * Byte offset in data block and shortform entry. | 
 | 45 |  */ | 
 | 46 | typedef	__uint16_t	xfs_dir2_data_off_t; | 
 | 47 | #define	NULLDATAOFF	0xffffU | 
 | 48 | typedef uint		xfs_dir2_data_aoff_t;	/* argument form */ | 
 | 49 |  | 
 | 50 | /* | 
 | 51 |  * Directory block number (logical dirblk in file) | 
 | 52 |  */ | 
 | 53 | typedef	__uint32_t	xfs_dir2_db_t; | 
 | 54 |  | 
 | 55 | /* | 
 | 56 |  * Byte offset in a directory. | 
 | 57 |  */ | 
 | 58 | typedef	xfs_off_t		xfs_dir2_off_t; | 
 | 59 |  | 
 | 60 | /* | 
 | 61 |  * For getdents, argument struct for put routines. | 
 | 62 |  */ | 
 | 63 | typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa); | 
 | 64 | typedef struct xfs_dir2_put_args { | 
 | 65 | 	xfs_off_t		cook;		/* cookie of (next) entry */ | 
 | 66 | 	xfs_intino_t	ino;		/* inode number */ | 
 | 67 | 	struct xfs_dirent	*dbp;		/* buffer pointer */ | 
 | 68 | 	char		*name;		/* directory entry name */ | 
 | 69 | 	int		namelen;	/* length of name */ | 
 | 70 | 	int		done;		/* output: set if value was stored */ | 
 | 71 | 	xfs_dir2_put_t	put;		/* put function ptr (i/o) */ | 
 | 72 | 	struct uio	*uio;		/* uio control structure */ | 
 | 73 | } xfs_dir2_put_args_t; | 
 | 74 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | /* | 
 | 76 |  * Other interfaces used by the rest of the dir v2 code. | 
 | 77 |  */ | 
 | 78 | extern int | 
 | 79 | 	xfs_dir2_grow_inode(struct xfs_da_args *args, int space, | 
 | 80 | 			    xfs_dir2_db_t *dbp); | 
 | 81 |  | 
 | 82 | extern int | 
 | 83 | 	xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *vp); | 
 | 84 |  | 
 | 85 | extern int | 
 | 86 | 	xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *vp); | 
 | 87 |  | 
 | 88 | extern int | 
 | 89 | 	xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, | 
 | 90 | 			      struct xfs_dabuf *bp); | 
 | 91 |  | 
 | 92 | #endif	/* __XFS_DIR2_H__ */ |