xfs: Introduce a new ioctl(2) to get AG state
PATCH 4/15 xfs: Introduce a new ioctl(2) to get AG state
Introduce a new ioctl(2) to get a.g. state.
Signed-off-by Jie Liu <[email protected]>
--- fs/xfs/xfs_ag.h | 2 + fs/xfs/xfs_fs.h | 1 + fs/xfs/xfs_fsops.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_ioctl.c | 19 ++++++++++++++++++ 4 files changed, 75 insertions(+), 0 deletions(-)
fs/xfs/xfs_ag.h +2 -0
@@ -248,6 +248,8 @@ typedef struct xfs_ioc_agstate {#define XFS_AG_STATE_ALLOC_DENY (1 << 0)#define XFS_AG_ALL_STATE (XFS_AG_STATE_ALLOC_DENY) +extern int xfs_get_agstate (struct xfs_mount *mp, +struct xfs_ioc_agstate *agstate);extern int xfs_set_agstate (struct xfs_mount *mp,struct xfs_ioc_agstate *agstate);
fs/xfs/xfs_fs.h +1 -0
@@ -487,6 +487,7 @@ typedef struct xfs_handle {#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t)#define XFS_IOC_SET_AGSTATE _IOW('X', 126, struct xfs_ioc_agstate) +#define XFS_IOC_GET_AGSTATE _IOR('X', 127, struct xfs_ioc_agstate)/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
fs/xfs/xfs_fsops.c +53 -0
59 lines not on this page · raw message
fs/xfs/xfs_ioctl.c +19 -0
@@ -1615,6 +1615,25 @@ xfs_file_ioctl(return -error; } +case XFS_IOC_GET_AGSTATE : { +xfs_ioc_agstate_t inout; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ; + +if (copy_from_user (&inout, arg,sizeof (inout))) +return -XFS_ERROR (EFAULT ); + + error =xfs_get_agstate (mp, &inout); +if (error) +return -error; + +if (copy_to_user (arg, &inout,sizeof (inout))) +return -XFS_ERROR (EFAULT ); + +return 0 ; + } +default :return -ENOTTY ; }
Signature · 6 lines
1.7.4.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs