xfs
[Top] [All Lists]

[PATCH 15/16] xfs: xfs_fs_geometry returns a number of bytes to copy

To: linux-fsdevel@xxxxxxxxxxxxxxx
Subject: [PATCH 15/16] xfs: xfs_fs_geometry returns a number of bytes to copy
From: Ben Myers <bpm@xxxxxxx>
Date: Fri, 3 Oct 2014 17:05:09 -0500
Cc: xfs@xxxxxxxxxxx, olaf@xxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20141003214758.GY1865@xxxxxxx>
References: <20141003214758.GY1865@xxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
From: Ben Myers <bpm@xxxxxxx>

The versioned xfs_fsop_geom_t will be of variable size.  Make
xfs_fs_geometry return the number of bytes to copy out to userspace for
a given version of the structure.

Signed-off-by: Ben Myers <bpm@xxxxxxx>
---
 fs/xfs/xfs_fsops.c   | 6 ++----
 fs/xfs/xfs_fsops.h   | 2 +-
 fs/xfs/xfs_ioctl.c   | 6 ++++--
 fs/xfs/xfs_ioctl32.c | 3 ++-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index b69468e..cf87e16 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -51,11 +51,9 @@ int
 xfs_fs_geometry(
        xfs_mount_t             *mp,
        xfs_fsop_geom_v2_t      *geo,
-       int                     new_version)
+       int                     new_version,
+       size_t                  *bytes)
 {
-
-       memset(geo, 0, sizeof(*geo));
-
        geo->blocksize = mp->m_sb.sb_blocksize;
        geo->rtextsize = mp->m_sb.sb_rextsize;
        geo->agblocks = mp->m_sb.sb_agblocks;
diff --git a/fs/xfs/xfs_fsops.h b/fs/xfs/xfs_fsops.h
index 26e7343..74e1fee 100644
--- a/fs/xfs/xfs_fsops.h
+++ b/fs/xfs/xfs_fsops.h
@@ -19,7 +19,7 @@
 #define        __XFS_FSOPS_H__
 
 extern int xfs_fs_geometry(xfs_mount_t *mp, xfs_fsop_geom_v2_t *geo,
-               int nversion);
+               int new_version, size_t *bytes);
 extern int xfs_growfs_data(xfs_mount_t *mp, xfs_growfs_data_t *in);
 extern int xfs_growfs_log(xfs_mount_t *mp, xfs_growfs_log_t *in);
 extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt);
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 4393405..1657ce5 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -826,7 +826,8 @@ xfs_ioc_fsgeometry_v1(
        xfs_fsop_geom_v2_t      fsgeo;
        int                     error;
 
-       error = xfs_fs_geometry(mp, &fsgeo, 3);
+       memset(&fsgeo, 0, sizeof(fsgeo));
+       error = xfs_fs_geometry(mp, &fsgeo, 3, NULL);
        if (error)
                return error;
 
@@ -848,7 +849,8 @@ xfs_ioc_fsgeometry_v2(
        xfs_fsop_geom_v2_t      fsgeo;
        int                     error;
 
-       error = xfs_fs_geometry(mp, &fsgeo, 4);
+       memset(&fsgeo, 0, sizeof(fsgeo));
+       error = xfs_fs_geometry(mp, &fsgeo, 4, NULL);
        if (error)
                return error;
 
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 207b224..aca988a 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -67,7 +67,8 @@ xfs_compat_ioc_fsgeometry_v1(
        xfs_fsop_geom_v2_t        fsgeo;
        int                       error;
 
-       error = xfs_fs_geometry(mp, &fsgeo, 3);
+       memset(&fsgeo, 0, sizeof(fsgeo));
+       error = xfs_fs_geometry(mp, &fsgeo, 3, NULL);
        if (error)
                return error;
        /* The 32-bit variant simply has some padding at the end */
-- 
1.7.12.4

<Prev in Thread] Current Thread [Next in Thread>