1/* 2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. 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 uio; 36struct xfs_dabuf; 37struct xfs_da_args; 38struct xfs_dir2_put_args; 39struct xfs_inode; 40struct xfs_trans; 41 42/* 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 49 * 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. 55 */ 56 57/* 58 * Byte offset in data block and shortform entry. 59 */ 60typedef __uint16_t xfs_dir2_data_off_t; 61#define NULLDATAOFF 0xffffU 62typedef uint xfs_dir2_data_aoff_t; /* argument form */ 63 64/* 65 * Directory block number (logical dirblk in file) 66 */ 67typedef __uint32_t xfs_dir2_db_t; 68 69/* 70 * Byte offset in a directory. 71 */ 72typedef xfs_off_t xfs_dir2_off_t; 73 74/* 75 * For getdents, argument struct for put routines. 76 */ 77typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa); 78typedef 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; 88 89#define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2) 90extern xfs_dirops_t xfsv2_dirops; 91 92/* 93 * Other interfaces used by the rest of the dir v2 code. 94 */ 95extern int 96 xfs_dir2_grow_inode(struct xfs_da_args *args, int space, 97 xfs_dir2_db_t *dbp); 98 99extern int 100 xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *vp); 101 102extern int 103 xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *vp); 104 105extern int 106 xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, 107 struct xfs_dabuf *bp); 108 109#endif /* __XFS_DIR2_H__ */ 110

