Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | */ |
| 5 | #ifndef __XFS_ITABLE_H__ |
| 6 | #define __XFS_ITABLE_H__ |
| 7 | |
| 8 | /* |
| 9 | * xfs_bulkstat() is used to fill in xfs_bstat structures as well as dm_stat |
| 10 | * structures (by the dmi library). This is a pointer to a formatter function |
| 11 | * that will iget the inode and fill in the appropriate structure. |
| 12 | * see xfs_bulkstat_one() and xfs_dm_bulkstat_one() in dmapi_xfs.c |
| 13 | */ |
| 14 | typedef int (*bulkstat_one_pf)(struct xfs_mount *mp, |
| 15 | xfs_ino_t ino, |
| 16 | void __user *buffer, |
| 17 | int ubsize, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | int *ubused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | int *stat); |
| 20 | |
| 21 | /* |
| 22 | * Values for stat return value. |
| 23 | */ |
Nathan Scott | 8b56f08 | 2006-09-28 11:01:46 +1000 | [diff] [blame] | 24 | #define BULKSTAT_RV_NOTHING 0 |
| 25 | #define BULKSTAT_RV_DIDONE 1 |
| 26 | #define BULKSTAT_RV_GIVEUP 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | * Return stat information in bulk (by-inode) for the filesystem. |
| 30 | */ |
| 31 | int /* error status */ |
| 32 | xfs_bulkstat( |
| 33 | xfs_mount_t *mp, /* mount point for filesystem */ |
| 34 | xfs_ino_t *lastino, /* last inode returned */ |
| 35 | int *count, /* size of buffer/count returned */ |
| 36 | bulkstat_one_pf formatter, /* func that'd fill a single buf */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | size_t statstruct_size,/* sizeof struct that we're filling */ |
| 38 | char __user *ubuffer,/* buffer with inode stats */ |
Nathan Scott | c41564b | 2006-03-29 08:55:14 +1000 | [diff] [blame] | 39 | int *done); /* 1 if there are more stats to get */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 41 | typedef int (*bulkstat_one_fmt_pf)( /* used size in bytes or negative error */ |
| 42 | void __user *ubuffer, /* buffer to write to */ |
sandeen@sandeen.net | 65fbaf2 | 2008-11-25 21:20:12 -0600 | [diff] [blame] | 43 | int ubsize, /* remaining user buffer sz */ |
| 44 | int *ubused, /* bytes used by formatter */ |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 45 | const xfs_bstat_t *buffer); /* buffer to read from */ |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | int |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 48 | xfs_bulkstat_one_int( |
| 49 | xfs_mount_t *mp, |
| 50 | xfs_ino_t ino, |
| 51 | void __user *buffer, |
| 52 | int ubsize, |
| 53 | bulkstat_one_fmt_pf formatter, |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 54 | int *ubused, |
sandeen@sandeen.net | 2ee4fa5 | 2008-11-25 21:20:11 -0600 | [diff] [blame] | 55 | int *stat); |
| 56 | |
| 57 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | xfs_bulkstat_one( |
| 59 | xfs_mount_t *mp, |
| 60 | xfs_ino_t ino, |
| 61 | void __user *buffer, |
| 62 | int ubsize, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | int *ubused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | int *stat); |
| 65 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 66 | typedef int (*inumbers_fmt_pf)( |
| 67 | void __user *ubuffer, /* buffer to write to */ |
| 68 | const xfs_inogrp_t *buffer, /* buffer to read from */ |
| 69 | long count, /* # of elements to read */ |
| 70 | long *written); /* # of bytes written */ |
| 71 | |
| 72 | int |
| 73 | xfs_inumbers_fmt( |
| 74 | void __user *ubuffer, /* buffer to write to */ |
| 75 | const xfs_inogrp_t *buffer, /* buffer to read from */ |
| 76 | long count, /* # of elements to read */ |
| 77 | long *written); /* # of bytes written */ |
| 78 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | int /* error status */ |
| 80 | xfs_inumbers( |
| 81 | xfs_mount_t *mp, /* mount point for filesystem */ |
| 82 | xfs_ino_t *last, /* last inode returned */ |
| 83 | int *count, /* size of buffer/count returned */ |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 84 | void __user *buffer, /* buffer with inode info */ |
| 85 | inumbers_fmt_pf formatter); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | #endif /* __XFS_ITABLE_H__ */ |