diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-09-09 15:36:57 -0400 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2019-09-09 15:36:57 -0400 |
commit | 9612817d82b78604559f2e760f84060f766733c2 (patch) | |
tree | 9f9b697ad623f5ab11d7b8c5108e6b1468174abd /scrub | |
parent | c7498b6911d03f2bd7f74e9f9862d8d5fbd5b5da (diff) | |
download | xfsprogs-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 'scrub')
-rw-r--r-- | scrub/common.h | 2 | ||||
-rw-r--r-- | scrub/phase1.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/scrub/common.h b/scrub/common.h index e85a0333c7..3355589127 100644 --- a/scrub/common.h +++ b/scrub/common.h @@ -28,6 +28,8 @@ void __str_out(struct scrub_ctx *ctx, const char *descr, enum error_level level, #define str_errno(ctx, str) \ __str_out(ctx, str, S_ERROR, errno, __FILE__, __LINE__, NULL) +#define str_liberror(ctx, error, str) \ + __str_out(ctx, str, S_ERROR, error, __FILE__, __LINE__, NULL) #define str_error(ctx, str, ...) \ __str_out(ctx, str, S_ERROR, 0, __FILE__, __LINE__, __VA_ARGS__) #define str_warn(ctx, str, ...) \ diff --git a/scrub/phase1.c b/scrub/phase1.c index 04a5f4a920..9a2edf29a2 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -26,6 +26,7 @@ #include "disk.h" #include "scrub.h" #include "repair.h" +#include "fsgeom.h" /* Phase 1: Find filesystem geometry (and clean up after) */ @@ -129,9 +130,9 @@ _("Does not appear to be an XFS filesystem!")); } /* Retrieve XFS geometry. */ - error = ioctl(ctx->mnt_fd, XFS_IOC_FSGEOMETRY, &ctx->geo); + error = xfrog_geometry(ctx->mnt_fd, &ctx->geo); if (error) { - str_errno(ctx, ctx->mntpoint); + str_liberror(ctx, error, _("Retrieving XFS geometry")); return false; } |