[PATCH v2 14/29] xfsprogs: Stop using platform_flush_device()

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

---
copy/xfs_copy.c | 2 +-
libfrog/linux.c | 10 +++++++++-
libfrog/platform.h | 1 +
libxfs/init.c | 2 +-
libxfs/rdwr.c | 2 +-
5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index f864bc31..4b22e290 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -140,7 +140,7 @@ check_errors(void)

for (i = 0; i < num_targets; i++) {
if (target[i].state != INACTIVE) {
- if (platform_flush_device(target[i].fd, 0)) {
+ if (flush_device(target[i].fd, 0)) {
target[i].error = errno;
target[i].state = INACTIVE;
target[i].err_type = 2;
diff --git a/libfrog/linux.c b/libfrog/linux.c
index 6a933b85..3e4f2291 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -159,7 +159,7 @@ platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fata
* success or -1 (with errno set) for failure.
*/
int
-platform_flush_device(
+flush_device(
int fd,
dev_t device)
{
@@ -183,6 +183,14 @@ platform_flush_device(
return 0;
}

+int
+platform_flush_device(
+ int fd,
+ dev_t device)
+{
+ return flush_device(fd, device);
+}
+
void
platform_findsizes(char *path, int fd, long long *sz, int *bsz)
{
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 8a38aa45..1705c1c9 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 platform_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);
char *platform_findblockpath(char *path);
int platform_direct_blockdev(void);
diff --git a/libxfs/init.c b/libxfs/init.c
index 0d833ab6..784f15e2 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -171,7 +171,7 @@ libxfs_device_close(dev_t dev)
fd = dev_map[d].fd;
dev_map[d].dev = dev_map[d].fd = 0;

- ret = platform_flush_device(fd, dev);
+ ret = flush_device(fd, dev);
if (ret) {
ret = -errno;
fprintf(stderr,
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index fd456d6b..022da518 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1143,7 +1143,7 @@ libxfs_blkdev_issue_flush(
return 0;

fd = libxfs_device_to_fd(btp->bt_bdev);
- ret = platform_flush_device(fd, btp->bt_bdev);
+ ret = flush_device(fd, btp->bt_bdev);
return ret ? -errno : 0;
}

--
2.31.1