1153323Srodrigc/*
2153323Srodrigc * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
3153323Srodrigc *
4159451Srodrigc * This program is free software; you can redistribute it and/or
5159451Srodrigc * modify it under the terms of the GNU General Public License as
6153323Srodrigc * published by the Free Software Foundation.
7153323Srodrigc *
8159451Srodrigc * This program is distributed in the hope that it would be useful,
9159451Srodrigc * but WITHOUT ANY WARRANTY; without even the implied warranty of
10159451Srodrigc * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11159451Srodrigc * GNU General Public License for more details.
12153323Srodrigc *
13159451Srodrigc * You should have received a copy of the GNU General Public License
14159451Srodrigc * along with this program; if not, write the Free Software Foundation,
15159451Srodrigc * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16153323Srodrigc */
17153323Srodrigc#ifndef __XFS_ITABLE_H__
18153323Srodrigc#define	__XFS_ITABLE_H__
19153323Srodrigc
20153323Srodrigc/*
21153323Srodrigc * xfs_bulkstat() is used to fill in xfs_bstat structures as well as dm_stat
22153323Srodrigc * structures (by the dmi library). This is a pointer to a formatter function
23153323Srodrigc * that will iget the inode and fill in the appropriate structure.
24153323Srodrigc * see xfs_bulkstat_one() and xfs_dm_bulkstat_one() in dmapi_xfs.c
25153323Srodrigc */
26153323Srodrigctypedef int (*bulkstat_one_pf)(struct xfs_mount	*mp,
27153323Srodrigc			       xfs_ino_t	ino,
28159451Srodrigc			       void		__user *buffer,
29153323Srodrigc			       int		ubsize,
30153323Srodrigc			       void		*private_data,
31153323Srodrigc			       xfs_daddr_t	bno,
32153323Srodrigc			       int		*ubused,
33153323Srodrigc			       void		*dip,
34153323Srodrigc			       int		*stat);
35153323Srodrigc
36153323Srodrigc/*
37153323Srodrigc * Values for stat return value.
38153323Srodrigc */
39153323Srodrigc#define	BULKSTAT_RV_NOTHING	0
40153323Srodrigc#define	BULKSTAT_RV_DIDONE	1
41153323Srodrigc#define	BULKSTAT_RV_GIVEUP	2
42153323Srodrigc
43153323Srodrigc/*
44153323Srodrigc * Values for bulkstat flag argument.
45153323Srodrigc */
46153323Srodrigc#define	BULKSTAT_FG_IGET	0x1	/* Go through the buffer cache */
47153323Srodrigc#define	BULKSTAT_FG_QUICK	0x2	/* No iget, walk the dinode cluster */
48153323Srodrigc#define BULKSTAT_FG_VFSLOCKED	0x4	/* Already have vfs lock */
49153323Srodrigc
50153323Srodrigc/*
51153323Srodrigc * Return stat information in bulk (by-inode) for the filesystem.
52153323Srodrigc */
53153323Srodrigcint					/* error status */
54153323Srodrigcxfs_bulkstat(
55153323Srodrigc	xfs_mount_t	*mp,		/* mount point for filesystem */
56153323Srodrigc	xfs_ino_t	*lastino,	/* last inode returned */
57153323Srodrigc	int		*count,		/* size of buffer/count returned */
58153323Srodrigc	bulkstat_one_pf formatter,	/* func that'd fill a single buf */
59153323Srodrigc	void		*private_data,	/* private data for formatter */
60153323Srodrigc	size_t		statstruct_size,/* sizeof struct that we're filling */
61159451Srodrigc	char		__user *ubuffer,/* buffer with inode stats */
62153323Srodrigc	int		flags,		/* flag to control access method */
63159451Srodrigc	int		*done);		/* 1 if there are more stats to get */
64153323Srodrigc
65153323Srodrigcint
66153323Srodrigcxfs_bulkstat_single(
67153323Srodrigc	xfs_mount_t		*mp,
68153323Srodrigc	xfs_ino_t		*lastinop,
69159451Srodrigc	char			__user *buffer,
70153323Srodrigc	int			*done);
71153323Srodrigc
72153323Srodrigcint
73153323Srodrigcxfs_bulkstat_one(
74153323Srodrigc	xfs_mount_t		*mp,
75153323Srodrigc	xfs_ino_t		ino,
76159451Srodrigc	void			__user *buffer,
77153323Srodrigc	int			ubsize,
78153323Srodrigc	void			*private_data,
79153323Srodrigc	xfs_daddr_t		bno,
80153323Srodrigc	int			*ubused,
81153323Srodrigc	void			*dibuff,
82153323Srodrigc	int			*stat);
83153323Srodrigc
84153323Srodrigcint					/* error status */
85153323Srodrigcxfs_inumbers(
86153323Srodrigc	xfs_mount_t		*mp,	/* mount point for filesystem */
87153323Srodrigc	xfs_ino_t		*last,	/* last inode returned */
88153323Srodrigc	int			*count,	/* size of buffer/count returned */
89159451Srodrigc	xfs_inogrp_t		__user *buffer);/* buffer with inode info */
90153323Srodrigc
91153323Srodrigc#endif	/* __XFS_ITABLE_H__ */
92