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, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | int *ubused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | int *stat); |
| 32 | |
Jie Liu | 1e773c4 | 2014-08-04 11:22:31 +1000 | [diff] [blame] | 33 | struct xfs_bulkstat_agichunk { |
| 34 | xfs_ino_t ac_lastino; /* last inode returned */ |
| 35 | char __user **ac_ubuffer;/* pointer into user's buffer */ |
| 36 | int ac_ubleft; /* bytes left in user's buffer */ |
| 37 | int ac_ubelem; /* spaces used in user's buffer */ |
| 38 | }; |
| 39 | |
| 40 | int |
| 41 | xfs_bulkstat_ag_ichunk( |
| 42 | struct xfs_mount *mp, |
| 43 | xfs_agnumber_t agno, |
| 44 | struct xfs_inobt_rec_incore *irbp, |
| 45 | bulkstat_one_pf formatter, |
| 46 | size_t statstruct_size, |
| 47 | struct xfs_bulkstat_agichunk *acp); |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | /* |
| 50 | * Values for stat return value. |
| 51 | */ |
Nathan Scott | 8b56f08 | 2006-09-28 11:01:46 +1000 | [diff] [blame] | 52 | #define BULKSTAT_RV_NOTHING 0 |
| 53 | #define BULKSTAT_RV_DIDONE 1 |
| 54 | #define BULKSTAT_RV_GIVEUP 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | * Return stat information in bulk (by-inode) for the filesystem. |
| 58 | */ |
| 59 | int /* error status */ |
| 60 | xfs_bulkstat( |
| 61 | xfs_mount_t *mp, /* mount point for filesystem */ |
| 62 | xfs_ino_t *lastino, /* last inode returned */ |
| 63 | int *count, /* size of buffer/count returned */ |
| 64 | bulkstat_one_pf formatter, /* func that'd fill a single buf */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | size_t statstruct_size,/* sizeof struct that we're filling */ |
| 66 | char __user *ubuffer,/* buffer with inode stats */ |
Nathan Scott | c41564b | 2006-03-29 08:55:14 +1000 | [diff] [blame] | 67 | int *done); /* 1 if there are more stats to get */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 69 | typedef int (*bulkstat_one_fmt_pf)( /* used size in bytes or negative error */ |
| 70 | void __user *ubuffer, /* buffer to write to */ |
sandeen@sandeen.net | 65fbaf2 | 2008-11-25 21:20:12 -0600 | [diff] [blame] | 71 | int ubsize, /* remaining user buffer sz */ |
| 72 | int *ubused, /* bytes used by formatter */ |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 73 | const xfs_bstat_t *buffer); /* buffer to read from */ |
| 74 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | int |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 76 | xfs_bulkstat_one_int( |
| 77 | xfs_mount_t *mp, |
| 78 | xfs_ino_t ino, |
| 79 | void __user *buffer, |
| 80 | int ubsize, |
| 81 | bulkstat_one_fmt_pf formatter, |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 82 | int *ubused, |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 83 | int *stat); |
| 84 | |
| 85 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | xfs_bulkstat_one( |
| 87 | xfs_mount_t *mp, |
| 88 | xfs_ino_t ino, |
| 89 | void __user *buffer, |
| 90 | int ubsize, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | int *ubused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | int *stat); |
| 93 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 94 | typedef int (*inumbers_fmt_pf)( |
| 95 | void __user *ubuffer, /* buffer to write to */ |
| 96 | const xfs_inogrp_t *buffer, /* buffer to read from */ |
| 97 | long count, /* # of elements to read */ |
| 98 | long *written); /* # of bytes written */ |
| 99 | |
| 100 | int |
| 101 | xfs_inumbers_fmt( |
| 102 | void __user *ubuffer, /* buffer to write to */ |
| 103 | const xfs_inogrp_t *buffer, /* buffer to read from */ |
| 104 | long count, /* # of elements to read */ |
| 105 | long *written); /* # of bytes written */ |
| 106 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | int /* error status */ |
| 108 | xfs_inumbers( |
| 109 | xfs_mount_t *mp, /* mount point for filesystem */ |
| 110 | xfs_ino_t *last, /* last inode returned */ |
| 111 | int *count, /* size of buffer/count returned */ |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 112 | void __user *buffer, /* buffer with inode info */ |
| 113 | inumbers_fmt_pf formatter); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | |
| 115 | #endif /* __XFS_ITABLE_H__ */ |