Skip to contentSkip to conversation

xfs: define a flags field for the AG geometry ioctl structure

PATCH In review Darrick J. Wong 2 participants 2 messages Sep 3, 2019 – Sep 4, 2019 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xfs: define a flags field for the AG geometry ioctl structure

From: Darrick J. Wong <[email protected]>

Define a flags field for the AG geometry ioctl structure.

---
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(-)
fs/xfs/libxfs/xfs_fs.h +1 -1
index 52d03a3a02a4..39dd2b908106 100644
@@ -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 */
fs/xfs/xfs_ioctl.c +4 -0
index 9a6823e29661..c93501f42675 100644
@@ -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)
Reviewed-by on v3 1/1
#1 lore raw
Quoted 30 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Define a flags field for the AG geometry ioctl structure.

---
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(-)
fs/xfs/libxfs/xfs_fs.h +1 -1
index 52d03a3a02a4..39dd2b908106 100644
@@ -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 */
fs/xfs/xfs_ioctl.c +0 -0
index 9a6823e29661..c93501f42675 100644

fs/xfs/xfs_ioctl.c xfs_ioc_ag_geometry( · line 1044

Quoted 7 lines
fs/xfs/xfs_ioctl.c +4 -0
@@ -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. :)

Signature · 2 lines
Dave Chinner
[email protected]