aboutsummaryrefslogtreecommitdiffstats
path: root/quota
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-09-09 15:36:57 -0400
committerEric Sandeen <sandeen@redhat.com>2019-09-09 15:36:57 -0400
commit9612817d82b78604559f2e760f84060f766733c2 (patch)
tree9f9b697ad623f5ab11d7b8c5108e6b1468174abd /quota
parentc7498b6911d03f2bd7f74e9f9862d8d5fbd5b5da (diff)
downloadxfsprogs-dev-9612817d82b78604559f2e760f84060f766733c2.tar.gz
libfrog: refactor online geometry queries
Refactor all the open-coded XFS_IOC_FSGEOMETRY queries into a single helper that we can use to standardize behaviors across mixed xfslibs versions. This is the prelude to introducing a new FSGEOMETRY version in 5.2 and needing to fix the (relatively few) client programs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> [sandeen: remove 5.2.1 compat hack now that we have the wrapper] Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'quota')
-rw-r--r--quota/free.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/quota/free.c b/quota/free.c
index 1d13006ed4..a8b6bd1f0c 100644
--- a/quota/free.c
+++ b/quota/free.c
@@ -8,6 +8,7 @@
#include "command.h"
#include "init.h"
#include "quota.h"
+#include "fsgeom.h"
static cmdinfo_t free_cmd;
@@ -51,7 +52,7 @@ mount_free_space_data(
struct xfs_fsop_geom fsgeo;
struct statfs st;
uint64_t logsize, count, free;
- int fd;
+ int fd, ret;
if ((fd = open(mount->fs_dir, O_RDONLY)) < 0) {
exitcode = 1;
@@ -67,9 +68,10 @@ mount_free_space_data(
}
if (!(mount->fs_flags & FS_FOREIGN)) {
- if ((xfsctl(mount->fs_dir, fd, XFS_IOC_FSGEOMETRY_V1,
- &fsgeo)) < 0) {
- perror("XFS_IOC_FSGEOMETRY_V1");
+ ret = xfrog_geometry(fd, &fsgeo);
+ if (ret) {
+ errno = ret;
+ perror("XFS_IOC_FSGEOMETRY");
close(fd);
return 0;
}