blob: 97295d91d1703c21cbeacacc876f9eded07aeb38 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
3 *
Nathan Scott7b718762005-11-02 14:58:39 +11004 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * published by the Free Software Foundation.
7 *
Nathan Scott7b718762005-11-02 14:58:39 +11008 * This program is distributed in the hope that it would be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 *
Nathan Scott7b718762005-11-02 14:58:39 +110013 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write the Free Software Foundation,
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 */
17#ifndef __XFS_ITABLE_H__
18#define __XFS_ITABLE_H__
19
20/*
21 * xfs_bulkstat() is used to fill in xfs_bstat structures as well as dm_stat
22 * structures (by the dmi library). This is a pointer to a formatter function
23 * that will iget the inode and fill in the appropriate structure.
24 * see xfs_bulkstat_one() and xfs_dm_bulkstat_one() in dmapi_xfs.c
25 */
26typedef int (*bulkstat_one_pf)(struct xfs_mount *mp,
27 xfs_ino_t ino,
28 void __user *buffer,
29 int ubsize,
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 int *ubused,
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 int *stat);
32
33/*
34 * Values for stat return value.
35 */
Nathan Scott8b56f082006-09-28 11:01:46 +100036#define BULKSTAT_RV_NOTHING 0
37#define BULKSTAT_RV_DIDONE 1
38#define BULKSTAT_RV_GIVEUP 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 * Return stat information in bulk (by-inode) for the filesystem.
42 */
43int /* error status */
44xfs_bulkstat(
45 xfs_mount_t *mp, /* mount point for filesystem */
46 xfs_ino_t *lastino, /* last inode returned */
47 int *count, /* size of buffer/count returned */
48 bulkstat_one_pf formatter, /* func that'd fill a single buf */
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 size_t statstruct_size,/* sizeof struct that we're filling */
50 char __user *ubuffer,/* buffer with inode stats */
Nathan Scottc41564b2006-03-29 08:55:14 +100051 int *done); /* 1 if there are more stats to get */
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53int
54xfs_bulkstat_single(
55 xfs_mount_t *mp,
56 xfs_ino_t *lastinop,
57 char __user *buffer,
58 int *done);
59
Michal Marekfaa63e92007-07-11 11:10:19 +100060typedef int (*bulkstat_one_fmt_pf)( /* used size in bytes or negative error */
61 void __user *ubuffer, /* buffer to write to */
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -060062 int ubsize, /* remaining user buffer sz */
63 int *ubused, /* bytes used by formatter */
Michal Marekfaa63e92007-07-11 11:10:19 +100064 const xfs_bstat_t *buffer); /* buffer to read from */
65
Linus Torvalds1da177e2005-04-16 15:20:36 -070066int
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -060067xfs_bulkstat_one_int(
68 xfs_mount_t *mp,
69 xfs_ino_t ino,
70 void __user *buffer,
71 int ubsize,
72 bulkstat_one_fmt_pf formatter,
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -060073 int *ubused,
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -060074 int *stat);
75
76int
Linus Torvalds1da177e2005-04-16 15:20:36 -070077xfs_bulkstat_one(
78 xfs_mount_t *mp,
79 xfs_ino_t ino,
80 void __user *buffer,
81 int ubsize,
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 int *ubused,
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 int *stat);
84
Michal Marekfaa63e92007-07-11 11:10:19 +100085typedef int (*inumbers_fmt_pf)(
86 void __user *ubuffer, /* buffer to write to */
87 const xfs_inogrp_t *buffer, /* buffer to read from */
88 long count, /* # of elements to read */
89 long *written); /* # of bytes written */
90
91int
92xfs_inumbers_fmt(
93 void __user *ubuffer, /* buffer to write to */
94 const xfs_inogrp_t *buffer, /* buffer to read from */
95 long count, /* # of elements to read */
96 long *written); /* # of bytes written */
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098int /* error status */
99xfs_inumbers(
100 xfs_mount_t *mp, /* mount point for filesystem */
101 xfs_ino_t *last, /* last inode returned */
102 int *count, /* size of buffer/count returned */
Michal Marekfaa63e92007-07-11 11:10:19 +1000103 void __user *buffer, /* buffer with inode info */
104 inumbers_fmt_pf formatter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106#endif /* __XFS_ITABLE_H__ */