Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. |
| 3 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 4 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * published by the Free Software Foundation. |
| 7 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 8 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 13 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | */ |
| 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 | */ |
| 26 | typedef int (*bulkstat_one_pf)(struct xfs_mount *mp, |
| 27 | xfs_ino_t ino, |
| 28 | void __user *buffer, |
| 29 | int ubsize, |
| 30 | void *private_data, |
| 31 | xfs_daddr_t bno, |
| 32 | int *ubused, |
| 33 | void *dip, |
| 34 | int *stat); |
| 35 | |
| 36 | /* |
| 37 | * Values for stat return value. |
| 38 | */ |
Nathan Scott | 8b56f08 | 2006-09-28 11:01:46 +1000 | [diff] [blame] | 39 | #define BULKSTAT_RV_NOTHING 0 |
| 40 | #define BULKSTAT_RV_DIDONE 1 |
| 41 | #define BULKSTAT_RV_GIVEUP 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
| 43 | /* |
| 44 | * Values for bulkstat flag argument. |
| 45 | */ |
Nathan Scott | 8b56f08 | 2006-09-28 11:01:46 +1000 | [diff] [blame] | 46 | #define BULKSTAT_FG_IGET 0x1 /* Go through the buffer cache */ |
| 47 | #define BULKSTAT_FG_QUICK 0x2 /* No iget, walk the dinode cluster */ |
| 48 | #define BULKSTAT_FG_INLINE 0x4 /* No iget if inline attrs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | /* |
| 51 | * Return stat information in bulk (by-inode) for the filesystem. |
| 52 | */ |
| 53 | int /* error status */ |
| 54 | xfs_bulkstat( |
| 55 | xfs_mount_t *mp, /* mount point for filesystem */ |
| 56 | xfs_ino_t *lastino, /* last inode returned */ |
| 57 | int *count, /* size of buffer/count returned */ |
| 58 | bulkstat_one_pf formatter, /* func that'd fill a single buf */ |
| 59 | void *private_data, /* private data for formatter */ |
| 60 | size_t statstruct_size,/* sizeof struct that we're filling */ |
| 61 | char __user *ubuffer,/* buffer with inode stats */ |
| 62 | int flags, /* flag to control access method */ |
Nathan Scott | c41564b | 2006-03-29 08:55:14 +1000 | [diff] [blame] | 63 | int *done); /* 1 if there are more stats to get */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | int |
| 66 | xfs_bulkstat_single( |
| 67 | xfs_mount_t *mp, |
| 68 | xfs_ino_t *lastinop, |
| 69 | char __user *buffer, |
| 70 | int *done); |
| 71 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 72 | typedef int (*bulkstat_one_fmt_pf)( /* used size in bytes or negative error */ |
| 73 | void __user *ubuffer, /* buffer to write to */ |
sandeen@sandeen.net | 65fbaf2 | 2008-11-25 21:20:12 -0600 | [diff] [blame] | 74 | int ubsize, /* remaining user buffer sz */ |
| 75 | int *ubused, /* bytes used by formatter */ |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 76 | const xfs_bstat_t *buffer); /* buffer to read from */ |
| 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | int |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 79 | xfs_bulkstat_one_int( |
| 80 | xfs_mount_t *mp, |
| 81 | xfs_ino_t ino, |
| 82 | void __user *buffer, |
| 83 | int ubsize, |
| 84 | bulkstat_one_fmt_pf formatter, |
| 85 | xfs_daddr_t bno, |
| 86 | int *ubused, |
| 87 | void *dibuff, |
| 88 | int *stat); |
| 89 | |
| 90 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | xfs_bulkstat_one( |
| 92 | xfs_mount_t *mp, |
| 93 | xfs_ino_t ino, |
| 94 | void __user *buffer, |
| 95 | int ubsize, |
| 96 | void *private_data, |
| 97 | xfs_daddr_t bno, |
| 98 | int *ubused, |
| 99 | void *dibuff, |
| 100 | int *stat); |
| 101 | |
Vlad Apostolov | 6f1f216 | 2006-09-28 11:06:15 +1000 | [diff] [blame] | 102 | int |
| 103 | xfs_internal_inum( |
| 104 | xfs_mount_t *mp, |
| 105 | xfs_ino_t ino); |
| 106 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 107 | typedef int (*inumbers_fmt_pf)( |
| 108 | void __user *ubuffer, /* buffer to write to */ |
| 109 | const xfs_inogrp_t *buffer, /* buffer to read from */ |
| 110 | long count, /* # of elements to read */ |
| 111 | long *written); /* # of bytes written */ |
| 112 | |
| 113 | int |
| 114 | xfs_inumbers_fmt( |
| 115 | void __user *ubuffer, /* buffer to write to */ |
| 116 | const xfs_inogrp_t *buffer, /* buffer to read from */ |
| 117 | long count, /* # of elements to read */ |
| 118 | long *written); /* # of bytes written */ |
| 119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | int /* error status */ |
| 121 | xfs_inumbers( |
| 122 | xfs_mount_t *mp, /* mount point for filesystem */ |
| 123 | xfs_ino_t *last, /* last inode returned */ |
| 124 | int *count, /* size of buffer/count returned */ |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 125 | void __user *buffer, /* buffer with inode info */ |
| 126 | inumbers_fmt_pf formatter); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
| 128 | #endif /* __XFS_ITABLE_H__ */ |