[PATCH v2 24/29] xfsprogs: Stop using platform_set_blocksize()

Pavel Reichl
2021-08-06T21:23:59Z

---
libfrog/linux.c | 8 +++++++-
libfrog/platform.h | 1 +
libxfs/init.c | 4 ++--
3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 4e75247e..796fb890 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -145,7 +145,7 @@ platform_check_iswritable(char *name, char *block, struct stat *s)
}

int
-platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal)
+set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal)
{
int error = 0;

@@ -160,6 +160,12 @@ platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fata
return error;
}

+int
+platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal)
+{
+ return set_blocksize(fd, path, device, blocksize, fatal);
+}
+
/*
* Flush dirty pagecache and disk write cache to stable media. Returns 0 for
* success or -1 (with errno set) for failure.
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 69f432f7..06519a0c 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -14,6 +14,7 @@ int platform_check_iswritable(char *path, char *block, struct stat *sptr);
int check_iswritable(char *path, char *block, struct stat *sptr);
int platform_set_blocksize(int fd, char *path, dev_t device, int bsz,
int fatal);
+int set_blocksize(int fd, char *path, dev_t device, int bsz, int fatal);
int platform_flush_device(int fd, dev_t device);
int flush_device(int fd, dev_t device);
char *platform_findrawpath(char *path);
diff --git a/libxfs/init.c b/libxfs/init.c
index 9fb4f9d8..46e6e225 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -123,10 +123,10 @@ retry:
if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) {
if (setblksize == 1)
/* use the default blocksize */
- (void)platform_set_blocksize(fd, path, statb.st_rdev, XFS_MIN_SECTORSIZE, 0);
+ (void)set_blocksize(fd, path, statb.st_rdev, XFS_MIN_SECTORSIZE, 0);
else {
/* given an explicit blocksize to use */
- if (platform_set_blocksize(fd, path, statb.st_rdev, setblksize, 1))
+ if (set_blocksize(fd, path, statb.st_rdev, setblksize, 1))
exit(1);
}
}
--
2.31.1