* [PATCH v3] xfs: define a flags field for the AG geometry ioctl structure
@ 2019-09-03 23:05 Darrick J. Wong
2019-09-04 4:01 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2019-09-03 23:05 UTC (permalink / raw)
To: xfs, Dave Chinner
From: Darrick J. Wong <darrick.wong@oracle.com>
Define a flags field for the AG geometry ioctl structure.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v3: define ag_flags as an in/out field and check required zeroness
---
fs/xfs/libxfs/xfs_fs.h | 2 +-
fs/xfs/xfs_ioctl.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 52d03a3a02a4..39dd2b908106 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -287,7 +287,7 @@ struct xfs_ag_geometry {
uint32_t ag_ifree; /* o: inodes free */
uint32_t ag_sick; /* o: sick things in ag */
uint32_t ag_checked; /* o: checked metadata in ag */
- uint32_t ag_reserved32; /* o: zero */
+ uint32_t ag_flags; /* i/o: flags for this ag */
uint64_t ag_reserved[12];/* o: zero */
};
#define XFS_AG_GEOM_SICK_SB (1 << 0) /* superblock */
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 9a6823e29661..c93501f42675 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1038,6 +1038,10 @@ xfs_ioc_ag_geometry(
if (copy_from_user(&ageo, arg, sizeof(ageo)))
return -EFAULT;
+ if (ageo.ag_flags)
+ return -EINVAL;
+ if (memchr_inv(&ageo.ag_reserved, 0, sizeof(ageo.ag_reserved)))
+ return -EINVAL;
error = xfs_ag_get_geometry(mp, ageo.ag_number, &ageo);
if (error)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] xfs: define a flags field for the AG geometry ioctl structure
2019-09-03 23:05 [PATCH v3] xfs: define a flags field for the AG geometry ioctl structure Darrick J. Wong
@ 2019-09-04 4:01 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2019-09-04 4:01 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs
On Tue, Sep 03, 2019 at 04:05:37PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Define a flags field for the AG geometry ioctl structure.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> v3: define ag_flags as an in/out field and check required zeroness
> ---
> fs/xfs/libxfs/xfs_fs.h | 2 +-
> fs/xfs/xfs_ioctl.c | 4 ++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
> index 52d03a3a02a4..39dd2b908106 100644
> --- a/fs/xfs/libxfs/xfs_fs.h
> +++ b/fs/xfs/libxfs/xfs_fs.h
> @@ -287,7 +287,7 @@ struct xfs_ag_geometry {
> uint32_t ag_ifree; /* o: inodes free */
> uint32_t ag_sick; /* o: sick things in ag */
> uint32_t ag_checked; /* o: checked metadata in ag */
> - uint32_t ag_reserved32; /* o: zero */
> + uint32_t ag_flags; /* i/o: flags for this ag */
> uint64_t ag_reserved[12];/* o: zero */
> };
> #define XFS_AG_GEOM_SICK_SB (1 << 0) /* superblock */
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 9a6823e29661..c93501f42675 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1038,6 +1038,10 @@ xfs_ioc_ag_geometry(
>
> if (copy_from_user(&ageo, arg, sizeof(ageo)))
> return -EFAULT;
> + if (ageo.ag_flags)
> + return -EINVAL;
> + if (memchr_inv(&ageo.ag_reserved, 0, sizeof(ageo.ag_reserved)))
> + return -EINVAL;
Looks good. All that should be zero until we start using them. :)
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-04 4:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-03 23:05 [PATCH v3] xfs: define a flags field for the AG geometry ioctl structure Darrick J. Wong
2019-09-04 4:01 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox