[PATCH v2 18/29] xfsprogs: Stop using platform_findsizes()

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

---
libfrog/linux.c | 8 +++++++-
libfrog/platform.h | 2 +-
libfrog/topology.c | 6 +++---
libxfs/init.c | 12 ++++++------
4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 3e4f2291..891373c6 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -192,7 +192,7 @@ platform_flush_device(
}

void
-platform_findsizes(char *path, int fd, long long *sz, int *bsz)
+findsizes(char *path, int fd, long long *sz, int *bsz)
{
struct stat st;
uint64_t size;
@@ -251,6 +251,12 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz)
max_block_alignment = *bsz;
}

+void
+platform_findsizes(char *path, int fd, long long *sz, int *bsz)
+{
+ findsizes(path, fd, sz, bsz);
+}
+
char *
platform_findrawpath(char *path)
{
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 1705c1c9..914da2c7 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -21,8 +21,8 @@ int platform_direct_blockdev(void);
int platform_align_blockdev(void);
unsigned long platform_physmem(void); /* in kilobytes */
void platform_findsizes(char *path, int fd, long long *sz, int *bsz);
+void findsizes(char *path, int fd, long long *sz, int *bsz);
int platform_nproc(void);

-void platform_findsizes(char *path, int fd, long long *sz, int *bsz);

#endif /* __LIBFROG_PLATFORM_H__ */
diff --git a/libfrog/topology.c b/libfrog/topology.c
index b1b470c9..a21ba6c6 100644
--- a/libfrog/topology.c
+++ b/libfrog/topology.c
@@ -117,7 +117,7 @@ check_overwrite(
fd = open(device, O_RDONLY);
if (fd < 0)
goto out;
- platform_findsizes((char *)device, fd, &size, &bsz);
+ findsizes((char *)device, fd, &size, &bsz);
close(fd);

/* nothing to overwrite on a 0-length device */
@@ -296,7 +296,7 @@ void get_topology(
char *dfile = xi->volname ? xi->volname : xi->dname;

/*
- * If our target is a regular file, use platform_findsizes
+ * If our target is a regular file, use findsizes
* to try to obtain the underlying filesystem's requirements
* for direct IO; we'll set our sector size to that if possible.
*/
@@ -312,7 +312,7 @@ void get_topology(

fd = open(dfile, flags, 0666);
if (fd >= 0) {
- platform_findsizes(dfile, fd, &dummy, &ft->lsectorsize);
+ findsizes(dfile, fd, &dummy, &ft->lsectorsize);
close(fd);
ft->psectorsize = ft->lsectorsize;
} else
diff --git a/libxfs/init.c b/libxfs/init.c
index 784f15e2..7bc3b59d 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -324,7 +324,7 @@ libxfs_init(libxfs_init_t *a)
a->ddev= libxfs_device_open(dname, a->dcreat, flags,
a->setblksize);
a->dfd = libxfs_device_to_fd(a->ddev);
- platform_findsizes(dname, a->dfd, &a->dsize,
+ findsizes(dname, a->dfd, &a->dsize,
&a->dbsize);
} else {
if (!check_open(dname, flags, &rawfile, &blockfile))
@@ -332,7 +332,7 @@ libxfs_init(libxfs_init_t *a)
a->ddev = libxfs_device_open(rawfile,
a->dcreat, flags, a->setblksize);
a->dfd = libxfs_device_to_fd(a->ddev);
- platform_findsizes(rawfile, a->dfd,
+ findsizes(rawfile, a->dfd,
&a->dsize, &a->dbsize);
}
} else
@@ -342,7 +342,7 @@ libxfs_init(libxfs_init_t *a)
a->logdev = libxfs_device_open(logname,
a->lcreat, flags, a->setblksize);
a->logfd = libxfs_device_to_fd(a->logdev);
- platform_findsizes(dname, a->logfd, &a->logBBsize,
+ findsizes(dname, a->logfd, &a->logBBsize,
&a->lbsize);
} else {
if (!check_open(logname, flags, &rawfile, &blockfile))
@@ -350,7 +350,7 @@ libxfs_init(libxfs_init_t *a)
a->logdev = libxfs_device_open(rawfile,
a->lcreat, flags, a->setblksize);
a->logfd = libxfs_device_to_fd(a->logdev);
- platform_findsizes(rawfile, a->logfd,
+ findsizes(rawfile, a->logfd,
&a->logBBsize, &a->lbsize);
}
} else
@@ -360,7 +360,7 @@ libxfs_init(libxfs_init_t *a)
a->rtdev = libxfs_device_open(rtname,
a->rcreat, flags, a->setblksize);
a->rtfd = libxfs_device_to_fd(a->rtdev);
- platform_findsizes(dname, a->rtfd, &a->rtsize,
+ findsizes(dname, a->rtfd, &a->rtsize,
&a->rtbsize);
} else {
if (!check_open(rtname, flags, &rawfile, &blockfile))
@@ -368,7 +368,7 @@ libxfs_init(libxfs_init_t *a)
a->rtdev = libxfs_device_open(rawfile,
a->rcreat, flags, a->setblksize);
a->rtfd = libxfs_device_to_fd(a->rtdev);
- platform_findsizes(rawfile, a->rtfd,
+ findsizes(rawfile, a->rtfd,
&a->rtsize, &a->rtbsize);
}
} else
--
2.31.1