linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix
@ 2021-08-06 21:22 Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 01/29] xfsprogs: Stop using platform_uuid_compare() Pavel Reichl
                   ` (29 more replies)
  0 siblings, 30 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

Stop using commands with 'platform_' prefix. Either use directly linux
standard command or drop the prefix from the function name.

Publicly visible commands with "platform_" prefix are kept for now, but
will be deprecated soon. 


Pavel Reichl (29):
  xfsprogs: Stop using platform_uuid_compare()
  xfsprogs: Stop using platform_test_xfs_fd()
  xfsprogs: Stop using platform_test_xfs_path()
  xfsprogs: Stop using platform_fstatfs()
  xfsprogs: Stop using platform_getoptreset()
  xfsprogs: Stop using platform_uuid_copy()
  xfsprogs: Stop using platform_uuid_generate()
  xfsprogs: Stop using platform_uuid_unparse()
  xfsprogs: Stop using platform_uuid_clear()
  xfsprogs: Stop using platform_uuid_parse()
  xfsprogs: Stop using platform_uuid_is_null()
  xfsprogs: Stop using platform_check_mount()
  xfsprogs: Stop using platform_check_ismounted()
  xfsprogs: Stop using platform_flush_device()
  xfsprogs: Stop using platform_mntent_open()
  xfsprogs: Stop using platform_mntent_next()
  xfsprogs: Stop using platform_mntent_close()
  xfsprogs: Stop using platform_findsizes()
  xfsprogs: Stop using platform_discard_blocks
  xfsprogs: Stop using platform_zero_range()
  xfsprogs: Stop using platform_crash()
  xfsprogs: Stop using platform_nproc()
  xfsprogs: Stop using platform_check_iswritable()
  xfsprogs: Stop using platform_set_blocksize()
  xfsprogs: Stop using platform_findrawpath()
  xfsprogs: Stop using platform_findblockpath()
  xfsprogs: Stop using platform_direct_blockdev()
  xfsprogs: Stop using platform_align_blockdev()
  xfsprogs: Stop using platform_physmem()

 copy/xfs_copy.c             | 24 ++++-----
 db/command.c                |  2 +-
 db/fprint.c                 |  2 +-
 db/sb.c                     | 14 +++---
 fsr/xfs_fsr.c               |  8 +--
 growfs/xfs_growfs.c         |  2 +-
 include/linux.h             | 71 ++++++++++++++++++++++----
 include/platform_defs.h.in  |  1 +
 io/init.c                   |  2 +-
 io/open.c                   |  4 +-
 io/stat.c                   |  2 +-
 libfrog/linux.c             | 99 ++++++++++++++++++++++++++++++++-----
 libfrog/paths.c             |  2 +-
 libfrog/platform.h          | 11 ++++-
 libfrog/topology.c          |  6 +--
 libxcmd/command.c           |  2 +-
 libxfs/init.c               | 32 ++++++------
 libxfs/libxfs_io.h          |  2 +-
 libxfs/libxfs_priv.h        |  3 +-
 libxfs/rdwr.c               |  4 +-
 libxfs/xfs_ag.c             |  6 +--
 libxfs/xfs_attr_leaf.c      |  2 +-
 libxfs/xfs_attr_remote.c    |  2 +-
 libxfs/xfs_btree.c          |  4 +-
 libxfs/xfs_da_btree.c       |  2 +-
 libxfs/xfs_dir2_block.c     |  2 +-
 libxfs/xfs_dir2_data.c      |  2 +-
 libxfs/xfs_dir2_leaf.c      |  2 +-
 libxfs/xfs_dir2_node.c      |  2 +-
 libxfs/xfs_dquot_buf.c      |  2 +-
 libxfs/xfs_ialloc.c         |  4 +-
 libxfs/xfs_inode_buf.c      |  2 +-
 libxfs/xfs_sb.c             |  6 +--
 libxfs/xfs_symlink_remote.c |  2 +-
 libxlog/util.c              |  8 +--
 logprint/log_misc.c         |  2 +-
 mdrestore/xfs_mdrestore.c   |  4 +-
 mkfs/xfs_mkfs.c             | 22 ++++-----
 quota/free.c                |  2 +-
 repair/agheader.c           | 16 +++---
 repair/attr_repair.c        |  2 +-
 repair/dinode.c             |  8 +--
 repair/phase4.c             |  6 +--
 repair/phase5.c             |  6 +--
 repair/phase6.c             |  2 +-
 repair/prefetch.c           |  2 +-
 repair/scan.c               |  4 +-
 repair/slab.c               |  2 +-
 repair/xfs_repair.c         |  6 +--
 scrub/disk.c                |  8 +--
 spaceman/init.c             |  2 +-
 51 files changed, 284 insertions(+), 151 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v2 01/29] xfsprogs: Stop using platform_uuid_compare()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 02/29] xfsprogs: Stop using platform_test_xfs_fd() Pavel Reichl
                   ` (28 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

platform_uuid_compare() only calls uuid_compare() thus in should be
replaced by uuid_compare() deprecated and removed in the future.
---
 copy/xfs_copy.c      | 2 +-
 db/sb.c              | 2 +-
 libxfs/libxfs_priv.h | 2 +-
 libxlog/util.c       | 2 +-
 repair/agheader.c    | 4 ++--
 repair/attr_repair.c | 2 +-
 repair/dinode.c      | 6 +++---
 repair/phase6.c      | 2 +-
 repair/scan.c        | 4 ++--
 9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index fc7d225f..841ab7e4 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -15,7 +15,7 @@
 #include "libfrog/platform.h"
 
 #define	rounddown(x, y)	(((x)/(y))*(y))
-#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
+#define uuid_equal(s,d) (uuid_compare((*s),(*d)) == 0)
 
 extern int	platform_check_ismounted(char *, char *, struct stat *, int);
 
diff --git a/db/sb.c b/db/sb.c
index cec7dce9..7017e1e5 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -17,7 +17,7 @@
 #include "output.h"
 #include "init.h"
 
-#define uuid_equal(s,d)		(platform_uuid_compare((s),(d)) == 0)
+#define uuid_equal(s,d)		(uuid_compare((*s),(*d)) == 0)
 
 static int	sb_f(int argc, char **argv);
 static void     sb_help(void);
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index e37d5933..782bb006 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -505,7 +505,7 @@ static inline int retzero(void) { return 0; }
 #define xfs_qm_dqattach(i)			(0)
 
 #define uuid_copy(s,d)		platform_uuid_copy((s),(d))
-#define uuid_equal(s,d)		(platform_uuid_compare((s),(d)) == 0)
+#define uuid_equal(s,d)		(uuid_compare((*s),(*d)) == 0)
 
 #define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0)
 #define xfs_sb_validate_fsb_count(sbp, nblks)		(0)
diff --git a/libxlog/util.c b/libxlog/util.c
index a85d70c9..b4dfeca0 100644
--- a/libxlog/util.c
+++ b/libxlog/util.c
@@ -76,7 +76,7 @@ header_check_uuid(xfs_mount_t *mp, xlog_rec_header_t *head)
 
     if (print_skip_uuid)
 		return 0;
-    if (!platform_uuid_compare(&mp->m_sb.sb_uuid, &head->h_fs_uuid))
+    if (!uuid_compare(mp->m_sb.sb_uuid, head->h_fs_uuid))
 		return 0;
 
     platform_uuid_unparse(&mp->m_sb.sb_uuid, uu_sb);
diff --git a/repair/agheader.c b/repair/agheader.c
index 2af24106..1c4138e4 100644
--- a/repair/agheader.c
+++ b/repair/agheader.c
@@ -100,7 +100,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
 	if (!xfs_sb_version_hascrc(&mp->m_sb))
 		return retval;
 
-	if (platform_uuid_compare(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid)) {
+	if (uuid_compare(agf->agf_uuid, mp->m_sb.sb_meta_uuid)) {
 		char uu[64];
 
 		retval = XR_AG_AGF;
@@ -179,7 +179,7 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)
 	if (!xfs_sb_version_hascrc(&mp->m_sb))
 		return retval;
 
-	if (platform_uuid_compare(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid)) {
+	if (uuid_compare(agi->agi_uuid, mp->m_sb.sb_meta_uuid)) {
 		char uu[64];
 
 		retval = XR_AG_AGI;
diff --git a/repair/attr_repair.c b/repair/attr_repair.c
index bc3c2bef..25bdff73 100644
--- a/repair/attr_repair.c
+++ b/repair/attr_repair.c
@@ -947,7 +947,7 @@ _("expected block %" PRIu64 ", got %llu, inode %" PRIu64 "attr block\n"),
 		return 1;
 	}
 	/* verify uuid */
-	if (platform_uuid_compare(&info->uuid, &mp->m_sb.sb_meta_uuid) != 0) {
+	if (uuid_compare(info->uuid, mp->m_sb.sb_meta_uuid) != 0) {
 		do_warn(
 _("wrong FS UUID, inode %" PRIu64 " attr block %" PRIu64 "\n"),
 			ino, bp->b_bn);
diff --git a/repair/dinode.c b/repair/dinode.c
index 291c5807..a6156830 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -1098,7 +1098,7 @@ null_check(char *name, int length)
  * This does /not/ do quotacheck, it validates the basic quota
  * inode metadata, checksums, etc.
  */
-#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
+#define uuid_equal(s,d) (uuid_compare((*s),(*d)) == 0)
 static int
 process_quota_inode(
 	struct xfs_mount	*mp,
@@ -2329,8 +2329,8 @@ _("inode identifier %llu mismatch on inode %" PRIu64 "\n"),
 				return 1;
 			goto clear_bad_out;
 		}
-		if (platform_uuid_compare(&dino->di_uuid,
-					  &mp->m_sb.sb_meta_uuid)) {
+		if (uuid_compare(dino->di_uuid,
+				mp->m_sb.sb_meta_uuid)) {
 			if (!uncertain)
 				do_warn(
 			_("UUID mismatch on inode %" PRIu64 "\n"), lino);
diff --git a/repair/phase6.c b/repair/phase6.c
index 6bddfefa..05e6a321 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1886,7 +1886,7 @@ _("expected block %" PRIu64 ", got %llu, directory inode %" PRIu64 "\n"),
 		return 1;
 	}
 	/* verify uuid */
-	if (platform_uuid_compare(uuid, &mp->m_sb.sb_meta_uuid) != 0) {
+	if (uuid_compare(*uuid, mp->m_sb.sb_meta_uuid) != 0) {
 		do_warn(
 _("wrong FS UUID, directory inode %" PRIu64 " block %" PRIu64 "\n"),
 			ino, bp->b_bn);
diff --git a/repair/scan.c b/repair/scan.c
index 2c25af57..361c3b3c 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -268,8 +268,8 @@ _("expected block %" PRIu64 ", got %llu, bmbt block %" PRIu64 "\n"),
 			return 1;
 		}
 		/* verify uuid */
-		if (platform_uuid_compare(&block->bb_u.l.bb_uuid,
-					  &mp->m_sb.sb_meta_uuid) != 0) {
+		if (uuid_compare(block->bb_u.l.bb_uuid,
+			mp->m_sb.sb_meta_uuid) != 0) {
 			do_warn(
 _("wrong FS UUID, bmbt block %" PRIu64 "\n"),
 				bno);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 02/29] xfsprogs: Stop using platform_test_xfs_fd()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 01/29] xfsprogs: Stop using platform_uuid_compare() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 03/29] xfsprogs: Stop using platform_test_xfs_path() Pavel Reichl
                   ` (27 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c     | 4 ++--
 growfs/xfs_growfs.c | 2 +-
 include/linux.h     | 7 ++++++-
 io/init.c           | 2 +-
 io/open.c           | 4 ++--
 spaceman/init.c     | 2 +-
 6 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 841ab7e4..a7cbae02 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -670,7 +670,7 @@ main(int argc, char **argv)
 	if (S_ISREG(statbuf.st_mode))
 		source_is_file = 1;
 
-	if (source_is_file && platform_test_xfs_fd(source_fd))  {
+	if (source_is_file && test_xfs_fd(source_fd))  {
 		if (fcntl(source_fd, F_SETFL, open_flags | O_DIRECT) < 0)  {
 			do_log(_("%s: Cannot set direct I/O flag on \"%s\".\n"),
 				progname, source_name);
@@ -869,7 +869,7 @@ main(int argc, char **argv)
 					progname);
 				die_perror();
 			}
-			if (platform_test_xfs_fd(target[i].fd))  {
+			if (test_xfs_fd(target[i].fd))  {
 				if (xfsctl(target[i].name, target[i].fd,
 						XFS_IOC_DIOINFO, &d) < 0)  {
 					do_log(
diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
index d45ba703..dc01dfe8 100644
--- a/growfs/xfs_growfs.c
+++ b/growfs/xfs_growfs.c
@@ -160,7 +160,7 @@ main(int argc, char **argv)
 		return 1;
 	}
 
-	if (!platform_test_xfs_fd(ffd)) {
+	if (!test_xfs_fd(ffd)) {
 		fprintf(stderr, _("%s: specified file "
 			"[\"%s\"] is not on an XFS filesystem\n"),
 			progname, fname);
diff --git a/include/linux.h b/include/linux.h
index a22f7812..f48ec823 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -46,7 +46,7 @@ static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
  * so return 0 for those
  */
 
-static __inline__ int platform_test_xfs_fd(int fd)
+static __inline__ int test_xfs_fd(int fd)
 {
 	struct statfs statfsbuf;
 	struct stat statbuf;
@@ -60,6 +60,11 @@ static __inline__ int platform_test_xfs_fd(int fd)
 	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
 }
 
+static __inline__ int platform_test_xfs_fd(int fd)
+{
+	return test_xfs_fd(fd);
+}
+
 static __inline__ int platform_test_xfs_path(const char *path)
 {
 	struct statfs statfsbuf;
diff --git a/io/init.c b/io/init.c
index 033ed67d..bd31b474 100644
--- a/io/init.c
+++ b/io/init.c
@@ -219,7 +219,7 @@ init(
 		c = openfile(argv[optind], &geometry, flags, mode, &fsp);
 		if (c < 0)
 			exit(1);
-		if (!platform_test_xfs_fd(c))
+		if (!test_xfs_fd(c))
 			flags |= IO_FOREIGN;
 		if (addfile(argv[optind], c, &geometry, flags, &fsp) < 0)
 			exit(1);
diff --git a/io/open.c b/io/open.c
index d8072664..498e6163 100644
--- a/io/open.c
+++ b/io/open.c
@@ -115,7 +115,7 @@ openfile(
 		}
 	}
 
-	if (!geom || !platform_test_xfs_fd(fd))
+	if (!geom || !test_xfs_fd(fd))
 		return fd;
 
 	if (flags & IO_PATH) {
@@ -326,7 +326,7 @@ open_f(
 		return 0;
 	}
 
-	if (!platform_test_xfs_fd(fd))
+	if (!test_xfs_fd(fd))
 		flags |= IO_FOREIGN;
 
 	if (addfile(argv[optind], fd, &geometry, flags, &fsp) != 0) {
diff --git a/spaceman/init.c b/spaceman/init.c
index cf1ff3cb..8ad70929 100644
--- a/spaceman/init.c
+++ b/spaceman/init.c
@@ -93,7 +93,7 @@ init(
 	c = openfile(argv[optind], &xfd, &fsp);
 	if (c < 0)
 		exit(1);
-	if (!platform_test_xfs_fd(xfd.fd))
+	if (!test_xfs_fd(xfd.fd))
 		printf(_("Not an XFS filesystem!\n"));
 	c = addfile(argv[optind], &xfd, &fsp);
 	if (c < 0)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 03/29] xfsprogs: Stop using platform_test_xfs_path()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 01/29] xfsprogs: Stop using platform_uuid_compare() Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 02/29] xfsprogs: Stop using platform_test_xfs_fd() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 04/29] xfsprogs: Stop using platform_fstatfs() Pavel Reichl
                   ` (26 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 fsr/xfs_fsr.c   | 2 +-
 include/linux.h | 7 ++++++-
 libfrog/paths.c | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 6cf8bfb7..25eb2e12 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -248,7 +248,7 @@ main(int argc, char **argv)
 				        progname, argname);
 				exit(1);
 			} else if (S_ISDIR(sb.st_mode) || S_ISREG(sb.st_mode)) {
-				if (!platform_test_xfs_path(argname)) {
+				if (!test_xfs_path(argname)) {
 					fprintf(stderr, _(
 				        "%s: cannot defragment: %s: Not XFS\n"),
 				        progname, argname);
diff --git a/include/linux.h b/include/linux.h
index f48ec823..1617174c 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -65,7 +65,7 @@ static __inline__ int platform_test_xfs_fd(int fd)
 	return test_xfs_fd(fd);
 }
 
-static __inline__ int platform_test_xfs_path(const char *path)
+static __inline__ int test_xfs_path(const char *path)
 {
 	struct statfs statfsbuf;
 	struct stat statbuf;
@@ -79,6 +79,11 @@ static __inline__ int platform_test_xfs_path(const char *path)
 	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
 }
 
+static __inline__ int platform_test_xfs_path(const char *path)
+{
+	return test_xfs_path(path);
+}
+
 static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
 {
 	return fstatfs(fd, buf);
diff --git a/libfrog/paths.c b/libfrog/paths.c
index d6793764..c86f258e 100644
--- a/libfrog/paths.c
+++ b/libfrog/paths.c
@@ -161,7 +161,7 @@ fs_table_insert(
 			goto out_nodev;
 	}
 
-	if (!platform_test_xfs_path(dir))
+	if (!test_xfs_path(dir))
 		flags |= FS_FOREIGN;
 
 	/*
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 04/29] xfsprogs: Stop using platform_fstatfs()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (2 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 03/29] xfsprogs: Stop using platform_test_xfs_path() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 05/29] xfsprogs: Stop using platform_getoptreset() Pavel Reichl
                   ` (25 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 io/stat.c    | 2 +-
 quota/free.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/io/stat.c b/io/stat.c
index 49c4c27c..78f7d7f8 100644
--- a/io/stat.c
+++ b/io/stat.c
@@ -182,7 +182,7 @@ statfs_f(
 	int			ret;
 
 	printf(_("fd.path = \"%s\"\n"), file->name);
-	if (platform_fstatfs(file->fd, &st) < 0) {
+	if (fstatfs(file->fd, &st) < 0) {
 		perror("fstatfs");
 		exitcode = 1;
 	} else {
diff --git a/quota/free.c b/quota/free.c
index ea9c112f..8fcb6b93 100644
--- a/quota/free.c
+++ b/quota/free.c
@@ -62,7 +62,7 @@ mount_free_space_data(
 		return 0;
 	}
 
-	if (platform_fstatfs(fd, &st) < 0) {
+	if (fstatfs(fd, &st) < 0) {
 		perror("fstatfs");
 		close(fd);
 		return 0;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 05/29] xfsprogs: Stop using platform_getoptreset()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (3 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 04/29] xfsprogs: Stop using platform_fstatfs() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 06/29] xfsprogs: Stop using platform_uuid_copy() Pavel Reichl
                   ` (24 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 db/command.c      | 2 +-
 include/linux.h   | 7 ++++++-
 libxcmd/command.c | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/db/command.c b/db/command.c
index 02f778b9..65d8a056 100644
--- a/db/command.c
+++ b/db/command.c
@@ -84,7 +84,7 @@ command(
 		dbprintf(_(" arguments\n"));
 		return 0;
 	}
-	platform_getoptreset();
+	getoptreset();
 	return ct->cfunc(argc, argv);
 }
 
diff --git a/include/linux.h b/include/linux.h
index 1617174c..ae32f0e0 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -89,12 +89,17 @@ static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
 	return fstatfs(fd, buf);
 }
 
-static __inline__ void platform_getoptreset(void)
+static __inline__ void getoptreset(void)
 {
 	extern int optind;
 	optind = 0;
 }
 
+static __inline__ void platform_getoptreset(void)
+{
+	platform_getoptreset();
+}
+
 static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
 {
 	return uuid_compare(*uu1, *uu2);
diff --git a/libxcmd/command.c b/libxcmd/command.c
index a76d1515..3fa3d6e6 100644
--- a/libxcmd/command.c
+++ b/libxcmd/command.c
@@ -92,7 +92,7 @@ command(
 			argc-1, cmd, ct->argmin, ct->argmax);
 		return 0;
 	}
-	platform_getoptreset();
+	getoptreset();
 	return ct->cfunc(argc, argv);
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 06/29] xfsprogs: Stop using platform_uuid_copy()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (4 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 05/29] xfsprogs: Stop using platform_getoptreset() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 07/29] xfsprogs: Stop using platform_uuid_generate() Pavel Reichl
                   ` (23 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c             | 8 ++++----
 libxfs/libxfs_priv.h        | 1 -
 libxfs/xfs_ag.c             | 6 +++---
 libxfs/xfs_attr_leaf.c      | 2 +-
 libxfs/xfs_attr_remote.c    | 2 +-
 libxfs/xfs_btree.c          | 4 ++--
 libxfs/xfs_da_btree.c       | 2 +-
 libxfs/xfs_dir2_block.c     | 2 +-
 libxfs/xfs_dir2_data.c      | 2 +-
 libxfs/xfs_dir2_leaf.c      | 2 +-
 libxfs/xfs_dir2_node.c      | 2 +-
 libxfs/xfs_dquot_buf.c      | 2 +-
 libxfs/xfs_ialloc.c         | 4 ++--
 libxfs/xfs_inode_buf.c      | 2 +-
 libxfs/xfs_sb.c             | 6 +++---
 libxfs/xfs_symlink_remote.c | 2 +-
 mkfs/xfs_mkfs.c             | 6 +++---
 repair/agheader.c           | 8 ++++----
 repair/dinode.c             | 2 +-
 repair/phase5.c             | 6 +++---
 20 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index a7cbae02..1f57399a 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -530,12 +530,12 @@ sb_update_uuid(
 		feat = be32_to_cpu(ag_hdr->xfs_sb->sb_features_incompat);
 		feat |= XFS_SB_FEAT_INCOMPAT_META_UUID;
 		ag_hdr->xfs_sb->sb_features_incompat = cpu_to_be32(feat);
-		platform_uuid_copy(&ag_hdr->xfs_sb->sb_meta_uuid,
-				   &sb->sb_uuid);
+		uuid_copy(ag_hdr->xfs_sb->sb_meta_uuid,
+				   sb->sb_uuid);
 	}
 
 	/* Copy the (possibly new) fs-identifier UUID into sb_uuid */
-	platform_uuid_copy(&ag_hdr->xfs_sb->sb_uuid, &tcarg->uuid);
+	uuid_copy(ag_hdr->xfs_sb->sb_uuid, tcarg->uuid);
 
 	/* We may have changed the UUID, so update the superblock CRC */
 	if (xfs_sb_version_hascrc(sb))
@@ -948,7 +948,7 @@ main(int argc, char **argv)
 		if (!duplicate)
 			platform_uuid_generate(&tcarg->uuid);
 		else
-			platform_uuid_copy(&tcarg->uuid, &mp->m_sb.sb_uuid);
+			uuid_copy(tcarg->uuid, mp->m_sb.sb_uuid);
 
 		if (pthread_mutex_init(&tcarg->wait, NULL) != 0)  {
 			do_log(_("Error creating thread mutex %d\n"), i);
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 782bb006..d4fd7bcd 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -504,7 +504,6 @@ static inline int retzero(void) { return 0; }
 #define xfs_quota_reserve_blkres(i,b)		(0)
 #define xfs_qm_dqattach(i)			(0)
 
-#define uuid_copy(s,d)		platform_uuid_copy((s),(d))
 #define uuid_equal(s,d)		(uuid_compare((*s),(*d)) == 0)
 
 #define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0)
diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c
index af8a0afd..7c70aa4c 100644
--- a/libxfs/xfs_ag.c
+++ b/libxfs/xfs_ag.c
@@ -268,7 +268,7 @@ xfs_agfblock_init(
 	agf->agf_freeblks = cpu_to_be32(tmpsize);
 	agf->agf_longest = cpu_to_be32(tmpsize);
 	if (xfs_sb_version_hascrc(&mp->m_sb))
-		uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(agf->agf_uuid, mp->m_sb.sb_meta_uuid);
 	if (xfs_sb_version_hasreflink(&mp->m_sb)) {
 		agf->agf_refcount_root = cpu_to_be32(
 				xfs_refc_block(mp));
@@ -298,7 +298,7 @@ xfs_agflblock_init(
 	if (xfs_sb_version_hascrc(&mp->m_sb)) {
 		agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
 		agfl->agfl_seqno = cpu_to_be32(id->agno);
-		uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(agfl->agfl_uuid, mp->m_sb.sb_meta_uuid);
 	}
 
 	agfl_bno = xfs_buf_to_agfl_bno(bp);
@@ -326,7 +326,7 @@ xfs_agiblock_init(
 	agi->agi_newino = cpu_to_be32(NULLAGINO);
 	agi->agi_dirino = cpu_to_be32(NULLAGINO);
 	if (xfs_sb_version_hascrc(&mp->m_sb))
-		uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(agi->agi_uuid, mp->m_sb.sb_meta_uuid);
 	if (xfs_sb_version_hasfinobt(&mp->m_sb)) {
 		agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp));
 		agi->agi_free_level = cpu_to_be32(1);
diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c
index a59660f2..70fa7b2f 100644
--- a/libxfs/xfs_attr_leaf.c
+++ b/libxfs/xfs_attr_leaf.c
@@ -1272,7 +1272,7 @@ xfs_attr3_leaf_create(
 
 		hdr3->blkno = cpu_to_be64(bp->b_bn);
 		hdr3->owner = cpu_to_be64(dp->i_ino);
-		uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(hdr3->uuid, mp->m_sb.sb_meta_uuid);
 
 		ichdr.freemap[0].base = sizeof(struct xfs_attr3_leaf_hdr);
 	} else {
diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c
index 3807cd3d..ed459290 100644
--- a/libxfs/xfs_attr_remote.c
+++ b/libxfs/xfs_attr_remote.c
@@ -251,7 +251,7 @@ xfs_attr3_rmt_hdr_set(
 	rmt->rm_magic = cpu_to_be32(XFS_ATTR3_RMT_MAGIC);
 	rmt->rm_offset = cpu_to_be32(offset);
 	rmt->rm_bytes = cpu_to_be32(size);
-	uuid_copy(&rmt->rm_uuid, &mp->m_sb.sb_meta_uuid);
+	uuid_copy(rmt->rm_uuid, mp->m_sb.sb_meta_uuid);
 	rmt->rm_owner = cpu_to_be64(ino);
 	rmt->rm_blkno = cpu_to_be64(bno);
 
diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index d52fdc00..59fb4223 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -1097,7 +1097,7 @@ xfs_btree_init_block_int(
 		if (crc) {
 			buf->bb_u.l.bb_blkno = cpu_to_be64(blkno);
 			buf->bb_u.l.bb_owner = cpu_to_be64(owner);
-			uuid_copy(&buf->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid);
+			uuid_copy(buf->bb_u.l.bb_uuid, mp->m_sb.sb_meta_uuid);
 			buf->bb_u.l.bb_pad = 0;
 			buf->bb_u.l.bb_lsn = 0;
 		}
@@ -1110,7 +1110,7 @@ xfs_btree_init_block_int(
 		if (crc) {
 			buf->bb_u.s.bb_blkno = cpu_to_be64(blkno);
 			buf->bb_u.s.bb_owner = cpu_to_be32(__owner);
-			uuid_copy(&buf->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid);
+			uuid_copy(buf->bb_u.s.bb_uuid, mp->m_sb.sb_meta_uuid);
 			buf->bb_u.s.bb_lsn = 0;
 		}
 	}
diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c
index 7448ee6c..8c3deca6 100644
--- a/libxfs/xfs_da_btree.c
+++ b/libxfs/xfs_da_btree.c
@@ -446,7 +446,7 @@ xfs_da3_node_create(
 		ichdr.magic = XFS_DA3_NODE_MAGIC;
 		hdr3->info.blkno = cpu_to_be64(bp->b_bn);
 		hdr3->info.owner = cpu_to_be64(args->dp->i_ino);
-		uuid_copy(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(hdr3->info.uuid, mp->m_sb.sb_meta_uuid);
 	} else {
 		ichdr.magic = XFS_DA_NODE_MAGIC;
 	}
diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c
index eaa2b47a..2ee95a4f 100644
--- a/libxfs/xfs_dir2_block.c
+++ b/libxfs/xfs_dir2_block.c
@@ -173,7 +173,7 @@ xfs_dir3_block_init(
 		hdr3->magic = cpu_to_be32(XFS_DIR3_BLOCK_MAGIC);
 		hdr3->blkno = cpu_to_be64(bp->b_bn);
 		hdr3->owner = cpu_to_be64(dp->i_ino);
-		uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(hdr3->uuid, mp->m_sb.sb_meta_uuid);
 		return;
 
 	}
diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c
index ddd5e885..c11b718b 100644
--- a/libxfs/xfs_dir2_data.c
+++ b/libxfs/xfs_dir2_data.c
@@ -721,7 +721,7 @@ xfs_dir3_data_init(
 		hdr3->magic = cpu_to_be32(XFS_DIR3_DATA_MAGIC);
 		hdr3->blkno = cpu_to_be64(bp->b_bn);
 		hdr3->owner = cpu_to_be64(dp->i_ino);
-		uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(hdr3->uuid, mp->m_sb.sb_meta_uuid);
 
 	} else
 		hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c
index 0cecd698..25edf4c8 100644
--- a/libxfs/xfs_dir2_leaf.c
+++ b/libxfs/xfs_dir2_leaf.c
@@ -312,7 +312,7 @@ xfs_dir3_leaf_init(
 					 : cpu_to_be16(XFS_DIR3_LEAFN_MAGIC);
 		leaf3->info.blkno = cpu_to_be64(bp->b_bn);
 		leaf3->info.owner = cpu_to_be64(owner);
-		uuid_copy(&leaf3->info.uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(leaf3->info.uuid, mp->m_sb.sb_meta_uuid);
 	} else {
 		memset(leaf, 0, sizeof(*leaf));
 		leaf->hdr.info.magic = cpu_to_be16(type);
diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c
index ab156a8e..c1d4a18b 100644
--- a/libxfs/xfs_dir2_node.c
+++ b/libxfs/xfs_dir2_node.c
@@ -345,7 +345,7 @@ xfs_dir3_free_get_buf(
 
 		hdr3->hdr.blkno = cpu_to_be64(bp->b_bn);
 		hdr3->hdr.owner = cpu_to_be64(dp->i_ino);
-		uuid_copy(&hdr3->hdr.uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(hdr3->hdr.uuid, mp->m_sb.sb_meta_uuid);
 	} else
 		hdr.magic = XFS_DIR2_FREE_MAGIC;
 	xfs_dir2_free_hdr_to_disk(mp, bp->b_addr, &hdr);
diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c
index 0a5a237d..2f5fd03e 100644
--- a/libxfs/xfs_dquot_buf.c
+++ b/libxfs/xfs_dquot_buf.c
@@ -133,7 +133,7 @@ xfs_dqblk_repair(
 	dqb->dd_diskdq.d_id = cpu_to_be32(id);
 
 	if (xfs_sb_version_hascrc(&mp->m_sb)) {
-		uuid_copy(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(dqb->dd_uuid, mp->m_sb.sb_meta_uuid);
 		xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
 				 XFS_DQUOT_CRC_OFF);
 	}
diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c
index c8e2125d..b42fe37a 100644
--- a/libxfs/xfs_ialloc.c
+++ b/libxfs/xfs_ialloc.c
@@ -345,8 +345,8 @@ xfs_ialloc_inode_init(
 			if (version == 3) {
 				free->di_ino = cpu_to_be64(ino);
 				ino++;
-				uuid_copy(&free->di_uuid,
-					  &mp->m_sb.sb_meta_uuid);
+				uuid_copy(free->di_uuid,
+					  mp->m_sb.sb_meta_uuid);
 				xfs_dinode_calc_crc(mp, free);
 			} else if (tp) {
 				/* just log the inode core */
diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
index c9bde7ee..c492d892 100644
--- a/libxfs/xfs_inode_buf.c
+++ b/libxfs/xfs_inode_buf.c
@@ -340,7 +340,7 @@ xfs_inode_to_disk(
 		to->di_ino = cpu_to_be64(ip->i_ino);
 		to->di_lsn = cpu_to_be64(lsn);
 		memset(to->di_pad2, 0, sizeof(to->di_pad2));
-		uuid_copy(&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid);
+		uuid_copy(to->di_uuid, ip->i_mount->m_sb.sb_meta_uuid);
 		to->di_flushiter = 0;
 	} else {
 		to->di_version = 2;
diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c
index 8037b369..cab092af 100644
--- a/libxfs/xfs_sb.c
+++ b/libxfs/xfs_sb.c
@@ -513,9 +513,9 @@ __xfs_sb_from_disk(
 	 * feature flag is set; if not set we keep it only in memory.
 	 */
 	if (xfs_sb_version_hasmetauuid(to))
-		uuid_copy(&to->sb_meta_uuid, &from->sb_meta_uuid);
+		uuid_copy(to->sb_meta_uuid, from->sb_meta_uuid);
 	else
-		uuid_copy(&to->sb_meta_uuid, &from->sb_uuid);
+		uuid_copy(to->sb_meta_uuid, from->sb_uuid);
 	/* Convert on-disk flags to in-memory flags? */
 	if (convert_xquota)
 		xfs_sb_quota_from_disk(to);
@@ -658,7 +658,7 @@ xfs_sb_to_disk(
 		to->sb_spino_align = cpu_to_be32(from->sb_spino_align);
 		to->sb_lsn = cpu_to_be64(from->sb_lsn);
 		if (xfs_sb_version_hasmetauuid(from))
-			uuid_copy(&to->sb_meta_uuid, &from->sb_meta_uuid);
+			uuid_copy(to->sb_meta_uuid, from->sb_meta_uuid);
 	}
 }
 
diff --git a/libxfs/xfs_symlink_remote.c b/libxfs/xfs_symlink_remote.c
index 8eb3d59f..0e1f3596 100644
--- a/libxfs/xfs_symlink_remote.c
+++ b/libxfs/xfs_symlink_remote.c
@@ -46,7 +46,7 @@ xfs_symlink_hdr_set(
 	dsl->sl_magic = cpu_to_be32(XFS_SYMLINK_MAGIC);
 	dsl->sl_offset = cpu_to_be32(offset);
 	dsl->sl_bytes = cpu_to_be32(size);
-	uuid_copy(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid);
+	uuid_copy(dsl->sl_uuid, mp->m_sb.sb_meta_uuid);
 	dsl->sl_owner = cpu_to_be64(ino);
 	dsl->sl_blkno = cpu_to_be64(bp->b_bn);
 	bp->b_ops = &xfs_symlink_buf_ops;
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index f84a42f9..c4e3e054 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2192,7 +2192,7 @@ _("cowextsize not supported without reflink support\n"));
 	 */
 	cfg->sb_feat = cli->sb_feat;
 	if (!platform_uuid_is_null(&cli->uuid))
-		platform_uuid_copy(&cfg->uuid, &cli->uuid);
+		uuid_copy(cfg->uuid, cli->uuid);
 }
 
 static void
@@ -3452,9 +3452,9 @@ finish_superblock_setup(
 
 	sbp->sb_dblocks = cfg->dblocks;
 	sbp->sb_rextents = cfg->rtextents;
-	platform_uuid_copy(&sbp->sb_uuid, &cfg->uuid);
+	uuid_copy(sbp->sb_uuid, cfg->uuid);
 	/* Only in memory; libxfs expects this as if read from disk */
-	platform_uuid_copy(&sbp->sb_meta_uuid, &cfg->uuid);
+	uuid_copy(sbp->sb_meta_uuid, cfg->uuid);
 	sbp->sb_logstart = cfg->logstart;
 	sbp->sb_rootino = sbp->sb_rbmino = sbp->sb_rsumino = NULLFSINO;
 	sbp->sb_agcount = (xfs_agnumber_t)cfg->agcount;
diff --git a/repair/agheader.c b/repair/agheader.c
index 1c4138e4..b13b7323 100644
--- a/repair/agheader.c
+++ b/repair/agheader.c
@@ -108,8 +108,8 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
 		do_warn(_("bad uuid %s for agf %d\n"), uu, i);
 
 		if (!no_modify)
-			platform_uuid_copy(&agf->agf_uuid,
-					   &mp->m_sb.sb_meta_uuid);
+			uuid_copy(agf->agf_uuid,
+				   mp->m_sb.sb_meta_uuid);
 	}
 	return retval;
 }
@@ -187,8 +187,8 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)
 		do_warn(_("bad uuid %s for agi %d\n"), uu, agno);
 
 		if (!no_modify)
-			platform_uuid_copy(&agi->agi_uuid,
-					   &mp->m_sb.sb_meta_uuid);
+			uuid_copy(agi->agi_uuid,
+					   mp->m_sb.sb_meta_uuid);
 	}
 
 	return retval;
diff --git a/repair/dinode.c b/repair/dinode.c
index a6156830..3206dd80 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -121,7 +121,7 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
 	if (dinoc->di_version < 3)
 		return;
 	dinoc->di_ino = cpu_to_be64(ino_num);
-	platform_uuid_copy(&dinoc->di_uuid, &mp->m_sb.sb_meta_uuid);
+	uuid_copy(dinoc->di_uuid, mp->m_sb.sb_meta_uuid);
 	return;
 }
 
diff --git a/repair/phase5.c b/repair/phase5.c
index fcdf757c..c98267a1 100644
--- a/repair/phase5.c
+++ b/repair/phase5.c
@@ -163,7 +163,7 @@ build_agi(
 		agi->agi_unlinked[i] = cpu_to_be32(NULLAGINO);
 
 	if (xfs_sb_version_hascrc(&mp->m_sb))
-		platform_uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(agi->agi_uuid, mp->m_sb.sb_meta_uuid);
 
 	if (xfs_sb_version_hasfinobt(&mp->m_sb)) {
 		agi->agi_free_root =
@@ -312,7 +312,7 @@ build_agf_agfl(
 #endif
 
 	if (xfs_sb_version_hascrc(&mp->m_sb))
-		platform_uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(agf->agf_uuid, mp->m_sb.sb_meta_uuid);
 
 	/* initialise the AGFL, then fill it if there are blocks left over. */
 	error = -libxfs_buf_get(mp->m_dev,
@@ -330,7 +330,7 @@ build_agf_agfl(
 	if (xfs_sb_version_hascrc(&mp->m_sb)) {
 		agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
 		agfl->agfl_seqno = cpu_to_be32(agno);
-		platform_uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(agfl->agfl_uuid, mp->m_sb.sb_meta_uuid);
 		for (agfl_idx = 0; agfl_idx < libxfs_agfl_size(mp); agfl_idx++)
 			freelist[agfl_idx] = cpu_to_be32(NULLAGBLOCK);
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 07/29] xfsprogs: Stop using platform_uuid_generate()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (5 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 06/29] xfsprogs: Stop using platform_uuid_copy() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 08/29] xfsprogs: Stop using platform_uuid_unparse() Pavel Reichl
                   ` (22 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c | 2 +-
 db/sb.c         | 2 +-
 mkfs/xfs_mkfs.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 1f57399a..5f8b5c57 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -946,7 +946,7 @@ main(int argc, char **argv)
 
 	for (i = 0, tcarg = targ; i < num_targets; i++, tcarg++)  {
 		if (!duplicate)
-			platform_uuid_generate(&tcarg->uuid);
+			uuid_generate(tcarg->uuid);
 		else
 			uuid_copy(tcarg->uuid, mp->m_sb.sb_uuid);
 
diff --git a/db/sb.c b/db/sb.c
index 7017e1e5..b668fc68 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -386,7 +386,7 @@ uuid_f(
 		}
 
 		if (!strcasecmp(argv[1], "generate")) {
-			platform_uuid_generate(&uu);
+			uuid_generate(uu);
 		} else if (!strcasecmp(argv[1], "nil")) {
 			platform_uuid_clear(&uu);
 		} else if (!strcasecmp(argv[1], "rewrite")) {
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index c4e3e054..dd7849fd 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3859,7 +3859,7 @@ main(
 	struct list_head	buffer_list;
 	int			error;
 
-	platform_uuid_generate(&cli.uuid);
+	uuid_generate(cli.uuid);
 	progname = basename(argv[0]);
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 08/29] xfsprogs: Stop using platform_uuid_unparse()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (6 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 07/29] xfsprogs: Stop using platform_uuid_generate() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 09/29] xfsprogs: Stop using platform_uuid_clear() Pavel Reichl
                   ` (21 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 db/fprint.c         | 2 +-
 db/sb.c             | 6 +++---
 libxlog/util.c      | 4 ++--
 logprint/log_misc.c | 2 +-
 repair/agheader.c   | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/db/fprint.c b/db/fprint.c
index 65accfda..f2f42c28 100644
--- a/db/fprint.c
+++ b/db/fprint.c
@@ -273,7 +273,7 @@ fp_uuid(
 	     i++, p++) {
 		if (array)
 			dbprintf("%d:", i + base);
-		platform_uuid_unparse(p, bp);
+		uuid_unparse(*p, bp);
 		dbprintf("%s", bp);
 		if (i < count - 1)
 			dbprintf(" ");
diff --git a/db/sb.c b/db/sb.c
index b668fc68..4e4b1f57 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -396,7 +396,7 @@ uuid_f(
 				return 0;
 			}
 			memcpy(&uu, uup, sizeof(uuid_t));
-			platform_uuid_unparse(&uu, bp);
+			uuid_unparse(uu, bp);
 			dbprintf(_("old UUID = %s\n"), bp);
 		} else if (!strcasecmp(argv[1], "restore")) {
 			xfs_sb_t	tsb;
@@ -427,7 +427,7 @@ uuid_f(
 				break;
 			}
 
-		platform_uuid_unparse(&uu, bp);
+		uuid_unparse(uu, bp);
 		dbprintf(_("new UUID = %s\n"), bp);
 		return 0;
 
@@ -460,7 +460,7 @@ uuid_f(
 				 "for FS with an external log\n"));
 		}
 
-		platform_uuid_unparse(&uu, bp);
+		uuid_unparse(uu, bp);
 		dbprintf(_("UUID = %s\n"), bp);
 	}
 
diff --git a/libxlog/util.c b/libxlog/util.c
index b4dfeca0..7c10474b 100644
--- a/libxlog/util.c
+++ b/libxlog/util.c
@@ -79,8 +79,8 @@ header_check_uuid(xfs_mount_t *mp, xlog_rec_header_t *head)
     if (!uuid_compare(mp->m_sb.sb_uuid, head->h_fs_uuid))
 		return 0;
 
-    platform_uuid_unparse(&mp->m_sb.sb_uuid, uu_sb);
-    platform_uuid_unparse(&head->h_fs_uuid, uu_log);
+    uuid_unparse(mp->m_sb.sb_uuid, uu_sb);
+    uuid_unparse(head->h_fs_uuid, uu_log);
 
     printf(_("* ERROR: mismatched uuid in log\n"
 	     "*            SB : %s\n*            log: %s\n"),
diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index afcd2cee..c593c828 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -1082,7 +1082,7 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn)
 	printf("\n");
     }
 
-    platform_uuid_unparse(&head->h_fs_uuid, uub);
+    uuid_unparse(head->h_fs_uuid, uub);
     printf(_("uuid: %s   format: "), uub);
     switch (be32_to_cpu(head->h_fmt)) {
 	case XLOG_FMT_UNKNOWN:
diff --git a/repair/agheader.c b/repair/agheader.c
index b13b7323..7e596a66 100644
--- a/repair/agheader.c
+++ b/repair/agheader.c
@@ -104,7 +104,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
 		char uu[64];
 
 		retval = XR_AG_AGF;
-		platform_uuid_unparse(&agf->agf_uuid, uu);
+		uuid_unparse(agf->agf_uuid, uu);
 		do_warn(_("bad uuid %s for agf %d\n"), uu, i);
 
 		if (!no_modify)
@@ -183,7 +183,7 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)
 		char uu[64];
 
 		retval = XR_AG_AGI;
-		platform_uuid_unparse(&agi->agi_uuid, uu);
+		uuid_unparse(agi->agi_uuid, uu);
 		do_warn(_("bad uuid %s for agi %d\n"), uu, agno);
 
 		if (!no_modify)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 09/29] xfsprogs: Stop using platform_uuid_clear()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (7 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 08/29] xfsprogs: Stop using platform_uuid_unparse() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:22 ` [PATCH v2 10/29] xfsprogs: Stop using platform_uuid_parse() Pavel Reichl
                   ` (20 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 db/sb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/db/sb.c b/db/sb.c
index 4e4b1f57..36c7db39 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -388,7 +388,7 @@ uuid_f(
 		if (!strcasecmp(argv[1], "generate")) {
 			uuid_generate(uu);
 		} else if (!strcasecmp(argv[1], "nil")) {
-			platform_uuid_clear(&uu);
+			uuid_clear(uu);
 		} else if (!strcasecmp(argv[1], "rewrite")) {
 			uup = do_uuid(0, NULL);
 			if (!uup) {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 10/29] xfsprogs: Stop using platform_uuid_parse()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (8 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 09/29] xfsprogs: Stop using platform_uuid_clear() Pavel Reichl
@ 2021-08-06 21:22 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 11/29] xfsprogs: Stop using platform_uuid_is_null() Pavel Reichl
                   ` (19 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:22 UTC (permalink / raw)
  To: linux-xfs

---
 db/sb.c         | 2 +-
 mkfs/xfs_mkfs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/db/sb.c b/db/sb.c
index 36c7db39..63f43ea4 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -410,7 +410,7 @@ uuid_f(
 
 			memcpy(&uu, mp->m_sb.sb_meta_uuid, sizeof(uuid_t));
 		} else {
-			if (platform_uuid_parse(argv[1], &uu)) {
+			if (uuid_parse(argv[1], uu)) {
 				dbprintf(_("invalid UUID\n"));
 				return 0;
 			}
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index dd7849fd..2771a641 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1656,7 +1656,7 @@ meta_opts_parser(
 	case M_UUID:
 		if (!value || *value == '\0')
 			reqval('m', opts->subopts, subopt);
-		if (platform_uuid_parse(value, &cli->uuid))
+		if (uuid_parse(value, cli->uuid))
 			illegal(value, "m uuid");
 		break;
 	case M_RMAPBT:
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 11/29] xfsprogs: Stop using platform_uuid_is_null()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (9 preceding siblings ...)
  2021-08-06 21:22 ` [PATCH v2 10/29] xfsprogs: Stop using platform_uuid_parse() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 12/29] xfsprogs: Stop using platform_check_mount() Pavel Reichl
                   ` (18 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 libxlog/util.c  | 2 +-
 mkfs/xfs_mkfs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libxlog/util.c b/libxlog/util.c
index 7c10474b..84c6f99a 100644
--- a/libxlog/util.c
+++ b/libxlog/util.c
@@ -130,7 +130,7 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head)
 int
 xlog_header_check_mount(xfs_mount_t *mp, xlog_rec_header_t *head)
 {
-    if (platform_uuid_is_null(&head->h_fs_uuid)) return 0;
+    if (uuid_is_null(head->h_fs_uuid)) return 0;
     if (header_check_uuid(mp, head)) {
 	/* bail out now or just carry on regardless */
 	if (print_exit)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 2771a641..c6929a83 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2191,7 +2191,7 @@ _("cowextsize not supported without reflink support\n"));
 	 * Copy features across to config structure now.
 	 */
 	cfg->sb_feat = cli->sb_feat;
-	if (!platform_uuid_is_null(&cli->uuid))
+	if (!uuid_is_null(cli->uuid))
 		uuid_copy(cfg->uuid, cli->uuid);
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 12/29] xfsprogs: Stop using platform_check_mount()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (10 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 11/29] xfsprogs: Stop using platform_uuid_is_null() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 13/29] xfsprogs: Stop using platform_check_ismounted() Pavel Reichl
                   ` (17 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 libfrog/linux.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libfrog/linux.c b/libfrog/linux.c
index a45d99ab..f7fac2c8 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -40,7 +40,7 @@ static int max_block_alignment;
 #define	CHECK_MOUNT_WRITABLE	0x2
 
 static int
-platform_check_mount(char *name, char *block, struct stat *s, int flags)
+check_mount(char *name, char *block, struct stat *s, int flags)
 {
 	FILE		*f;
 	struct stat	st, mst;
@@ -107,13 +107,19 @@ _("%s: %s contains a mounted filesystem\n"),
 	return 1;
 }
 
+static int
+platform_check_mount(char *name, char *block, struct stat *s, int flags)
+{
+	return check_mount(name, block, s, flags);
+}
+
 int
 platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
 {
 	int flags;
 
 	flags = verbose ? CHECK_MOUNT_VERBOSE : 0;
-	return platform_check_mount(name, block, s, flags);
+	return check_mount(name, block, s, flags);
 }
 
 int
@@ -123,7 +129,7 @@ platform_check_iswritable(char *name, char *block, struct stat *s)
 
 	/* Writable checks are always verbose */
 	flags = CHECK_MOUNT_WRITABLE | CHECK_MOUNT_VERBOSE;
-	return platform_check_mount(name, block, s, flags);
+	return check_mount(name, block, s, flags);
 }
 
 int
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 13/29] xfsprogs: Stop using platform_check_ismounted()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (11 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 12/29] xfsprogs: Stop using platform_check_mount() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 14/29] xfsprogs: Stop using platform_flush_device() Pavel Reichl
                   ` (16 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c           | 6 +++---
 libfrog/linux.c           | 8 +++++++-
 libfrog/platform.h        | 1 +
 libxfs/init.c             | 4 ++--
 mdrestore/xfs_mdrestore.c | 4 ++--
 5 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 5f8b5c57..f864bc31 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -17,7 +17,7 @@
 #define	rounddown(x, y)	(((x)/(y))*(y))
 #define uuid_equal(s,d) (uuid_compare((*s),(*d)) == 0)
 
-extern int	platform_check_ismounted(char *, char *, struct stat *, int);
+extern int	check_ismounted(char *, char *, struct stat *, int);
 
 static char 		*logfile_name;
 static FILE		*logerr;
@@ -698,7 +698,7 @@ main(int argc, char **argv)
 		 * check to make sure a filesystem isn't mounted
 		 * on the device
 		 */
-		if (platform_check_ismounted(source_name, NULL, &statbuf, 0))  {
+		if (check_ismounted(source_name, NULL, &statbuf, 0))  {
 			do_log(
 	_("%s:  Warning -- a filesystem is mounted on the source device.\n"),
 				progname);
@@ -842,7 +842,7 @@ main(int argc, char **argv)
 			 * check to make sure a filesystem isn't mounted
 			 * on the device
 			 */
-			if (platform_check_ismounted(target[i].name,
+			if (check_ismounted(target[i].name,
 							NULL, &statbuf, 0))  {
 				do_log(_("%s:  a filesystem is mounted "
 					"on target device \"%s\".\n"
diff --git a/libfrog/linux.c b/libfrog/linux.c
index f7fac2c8..6a933b85 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -114,7 +114,7 @@ platform_check_mount(char *name, char *block, struct stat *s, int flags)
 }
 
 int
-platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
+check_ismounted(char *name, char *block, struct stat *s, int verbose)
 {
 	int flags;
 
@@ -122,6 +122,12 @@ platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
 	return check_mount(name, block, s, flags);
 }
 
+int
+platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
+{
+	return check_ismounted(name, block, s, verbose);
+}
+
 int
 platform_check_iswritable(char *name, char *block, struct stat *s)
 {
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 0aef318a..8a38aa45 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -9,6 +9,7 @@
 
 int platform_check_ismounted(char *path, char *block, struct stat *sptr,
 		int verbose);
+int check_ismounted(char *path, char *block, struct stat *sptr, int verbose);
 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);
diff --git a/libxfs/init.c b/libxfs/init.c
index 1ec83791..0d833ab6 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -59,7 +59,7 @@ check_isactive(char *name, char *block, int fatal)
 		return 0;
 	if ((st.st_mode & S_IFMT) != S_IFBLK)
 		return 0;
-	if (platform_check_ismounted(name, block, &st, 0) == 0)
+	if (check_ismounted(name, block, &st, 0) == 0)
 		return 0;
 	if (platform_check_iswritable(name, block, &st))
 		return fatal ? 1 : 0;
@@ -212,7 +212,7 @@ check_open(char *path, int flags, char **rawfile, char **blockfile)
 			progname, path);
 		return 0;
 	}
-	if (!readonly && !inactive && platform_check_ismounted(path, *blockfile, NULL, 1))
+	if (!readonly && !inactive && check_ismounted(path, *blockfile, NULL, 1))
 		return 0;
 
 	if (inactive && check_isactive(path, *blockfile, ((readonly|dangerously)?1:0)))
diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c
index 1cd399db..4a894f3b 100644
--- a/mdrestore/xfs_mdrestore.c
+++ b/mdrestore/xfs_mdrestore.c
@@ -182,7 +182,7 @@ usage(void)
 	exit(1);
 }
 
-extern int	platform_check_ismounted(char *, char *, struct stat *, int);
+extern int	check_ismounted(char *, char *, struct stat *, int);
 
 int
 main(
@@ -275,7 +275,7 @@ main(
 		/*
 		 * check to make sure a filesystem isn't mounted on the device
 		 */
-		if (platform_check_ismounted(argv[optind], NULL, &statbuf, 0))
+		if (check_ismounted(argv[optind], NULL, &statbuf, 0))
 			fatal("a filesystem is mounted on target device \"%s\","
 				" cannot restore to a mounted filesystem.\n",
 				argv[optind]);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 14/29] xfsprogs: Stop using platform_flush_device()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (12 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 13/29] xfsprogs: Stop using platform_check_ismounted() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 15/29] xfsprogs: Stop using platform_mntent_open() Pavel Reichl
                   ` (15 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 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


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 15/29] xfsprogs: Stop using platform_mntent_open()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (13 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 14/29] xfsprogs: Stop using platform_flush_device() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 16/29] xfsprogs: Stop using platform_mntent_next() Pavel Reichl
                   ` (14 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 fsr/xfs_fsr.c   | 2 +-
 include/linux.h | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 25eb2e12..38afafb1 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -314,7 +314,7 @@ initallfs(char *mtab)
 	mi = 0;
 	fs = fsbase;
 
-	if (platform_mntent_open(&cursor, mtab) != 0){
+	if (mntent_open(&cursor, mtab) != 0){
 		fprintf(stderr, "Error: can't get mntent entries.\n");
 		exit(1);
 	}
diff --git a/include/linux.h b/include/linux.h
index ae32f0e0..b6249284 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -166,7 +166,7 @@ struct mntent_cursor {
 	FILE *mtabp;
 };
 
-static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab)
+static inline int mntent_open(struct mntent_cursor * cursor, char *mtab)
 {
 	cursor->mtabp = setmntent(mtab, "r");
 	if (!cursor->mtabp) {
@@ -176,6 +176,11 @@ static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab
 	return 0;
 }
 
+static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab)
+{
+	return mntent_open(cursor, mtab);
+}
+
 static inline struct mntent * platform_mntent_next(struct mntent_cursor * cursor)
 {
 	return getmntent(cursor->mtabp);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 16/29] xfsprogs: Stop using platform_mntent_next()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (14 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 15/29] xfsprogs: Stop using platform_mntent_open() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 17/29] xfsprogs: Stop using platform_mntent_close() Pavel Reichl
                   ` (13 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 fsr/xfs_fsr.c   | 2 +-
 include/linux.h | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 38afafb1..825ec395 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -319,7 +319,7 @@ initallfs(char *mtab)
 		exit(1);
 	}
 
-	while ((mnt = platform_mntent_next(&cursor)) != NULL) {
+	while ((mnt = mntent_next(&cursor)) != NULL) {
 		int rw = 0;
 
 		if (strcmp(mnt->mnt_type, MNTTYPE_XFS ) != 0 ||
diff --git a/include/linux.h b/include/linux.h
index b6249284..07121e2b 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -181,11 +181,16 @@ static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab
 	return mntent_open(cursor, mtab);
 }
 
-static inline struct mntent * platform_mntent_next(struct mntent_cursor * cursor)
+static inline struct mntent * mntent_next(struct mntent_cursor * cursor)
 {
 	return getmntent(cursor->mtabp);
 }
 
+static inline struct mntent * platform_mntent_next(struct mntent_cursor * cursor)
+{
+	return mntent_next(cursor);
+}
+
 static inline void platform_mntent_close(struct mntent_cursor * cursor)
 {
 	endmntent(cursor->mtabp);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 17/29] xfsprogs: Stop using platform_mntent_close()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (15 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 16/29] xfsprogs: Stop using platform_mntent_next() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 18/29] xfsprogs: Stop using platform_findsizes() Pavel Reichl
                   ` (12 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 fsr/xfs_fsr.c   | 2 +-
 include/linux.h | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 825ec395..42f477e8 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -369,7 +369,7 @@ initallfs(char *mtab)
 		mi++;
 		fs++;
 	}
-	platform_mntent_close(&cursor);
+	mntent_close(&cursor);
 
 	numfs = mi;
 	fsend = (fsbase + numfs);
diff --git a/include/linux.h b/include/linux.h
index 07121e2b..7940fe8c 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -191,11 +191,16 @@ static inline struct mntent * platform_mntent_next(struct mntent_cursor * cursor
 	return mntent_next(cursor);
 }
 
-static inline void platform_mntent_close(struct mntent_cursor * cursor)
+static inline void mntent_close(struct mntent_cursor * cursor)
 {
 	endmntent(cursor->mtabp);
 }
 
+static inline void platform_mntent_close(struct mntent_cursor * cursor)
+{
+	return platform_mntent_close(cursor);
+}
+
 #if defined(FALLOC_FL_ZERO_RANGE)
 static inline int
 platform_zero_range(
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 18/29] xfsprogs: Stop using platform_findsizes()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (16 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 17/29] xfsprogs: Stop using platform_mntent_close() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 19/29] xfsprogs: Stop using platform_discard_blocks Pavel Reichl
                   ` (11 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 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


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 19/29] xfsprogs: Stop using platform_discard_blocks
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (17 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 18/29] xfsprogs: Stop using platform_findsizes() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 20/29] xfsprogs: Stop using platform_zero_range() Pavel Reichl
                   ` (10 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 include/linux.h |  7 ++++++-
 mkfs/xfs_mkfs.c | 10 +++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/linux.h b/include/linux.h
index 7940fe8c..97882161 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -140,7 +140,7 @@ static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
 #endif
 
 static __inline__ int
-platform_discard_blocks(int fd, uint64_t start, uint64_t len)
+discard_blocks(int fd, uint64_t start, uint64_t len)
 {
 	uint64_t range[2] = { start, len };
 
@@ -149,6 +149,11 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len)
 	return 0;
 }
 
+static __inline__ int
+platform_discard_blocks(int fd, uint64_t start, uint64_t len)
+{
+	return discard_blocks(fd, start, len);
+}
 #define ENOATTR		ENODATA	/* Attribute not found */
 #define EFSCORRUPTED	EUCLEAN	/* Filesystem is corrupted */
 #define EFSBADCRC	EBADMSG	/* Bad CRC detected */
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index c6929a83..fc672a10 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1263,7 +1263,7 @@ done:
 }
 
 static void
-discard_blocks(dev_t dev, uint64_t nsectors, int quiet)
+discard_batch_of_blocks(dev_t dev, uint64_t nsectors, int quiet)
 {
 	int		fd;
 	uint64_t	offset = 0;
@@ -1286,7 +1286,7 @@ discard_blocks(dev_t dev, uint64_t nsectors, int quiet)
 		 * not necessary for the mkfs functionality but just an
 		 * optimization. However we should stop on error.
 		 */
-		if (platform_discard_blocks(fd, offset, tmp_step) == 0) {
+		if (discard_blocks(fd, offset, tmp_step) == 0) {
 			if (offset == 0 && !quiet) {
 				printf("Discarding blocks...");
 				fflush(stdout);
@@ -2664,11 +2664,11 @@ discard_devices(
 	 */
 
 	if (!xi->disfile)
-		discard_blocks(xi->ddev, xi->dsize, quiet);
+		discard_batch_of_blocks(xi->ddev, xi->dsize, quiet);
 	if (xi->rtdev && !xi->risfile)
-		discard_blocks(xi->rtdev, xi->rtsize, quiet);
+		discard_batch_of_blocks(xi->rtdev, xi->rtsize, quiet);
 	if (xi->logdev && xi->logdev != xi->ddev && !xi->lisfile)
-		discard_blocks(xi->logdev, xi->logBBsize, quiet);
+		discard_batch_of_blocks(xi->logdev, xi->logBBsize, quiet);
 }
 
 static void
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 20/29] xfsprogs: Stop using platform_zero_range()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (18 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 19/29] xfsprogs: Stop using platform_discard_blocks Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 21/29] xfsprogs: Stop using platform_crash() Pavel Reichl
                   ` (9 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 include/linux.h | 14 ++++++++++++--
 libxfs/rdwr.c   |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/include/linux.h b/include/linux.h
index 97882161..4ee4288f 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -208,7 +208,7 @@ static inline void platform_mntent_close(struct mntent_cursor * cursor)
 
 #if defined(FALLOC_FL_ZERO_RANGE)
 static inline int
-platform_zero_range(
+zero_range(
 	int		fd,
 	xfs_off_t	start,
 	size_t		len)
@@ -220,8 +220,18 @@ platform_zero_range(
 		return 0;
 	return -errno;
 }
+
+static inline int
+platform_zero_range(
+	int		fd,
+	xfs_off_t	start,
+	size_t		len)
+{
+	return zero_range(fd, start, len);
+}
 #else
-#define platform_zero_range(fd, s, l)	(-EOPNOTSUPP)
+#define zero_range(fd, s, l)	(-EOPNOTSUPP)
+#define platform_zero_range(fs, s, l) zero_range(fd, s, l)
 #endif
 
 /*
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 022da518..a92c909e 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -73,7 +73,7 @@ libxfs_device_zero(struct xfs_buftarg *btp, xfs_daddr_t start, uint len)
 
 	/* try to use special zeroing methods, fall back to writes if needed */
 	len_bytes = LIBXFS_BBTOOFF64(len);
-	error = platform_zero_range(fd, start_offset, len_bytes);
+	error = zero_range(fd, start_offset, len_bytes);
 	if (!error) {
 		xfs_buftarg_trip_write(btp);
 		return 0;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 21/29] xfsprogs: Stop using platform_crash()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (19 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 20/29] xfsprogs: Stop using platform_zero_range() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 22/29] xfsprogs: Stop using platform_nproc() Pavel Reichl
                   ` (8 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 include/linux.h     | 8 +++++++-
 libxfs/libxfs_io.h  | 2 +-
 repair/xfs_repair.c | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/linux.h b/include/linux.h
index 4ee4288f..591b4b05 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -239,12 +239,18 @@ platform_zero_range(
  * atexit handlers.
  */
 static inline void
-platform_crash(void)
+crash(void)
 {
 	kill(getpid(), SIGKILL);
 	assert(0);
 }
 
+static inline void
+platform_crash(void)
+{
+	return crash();
+}
+
 /*
  * Check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves. These
  * are a copy of the definitions moved to linux/uapi/fs.h in the 4.5 kernel,
diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index 3cc4f4ee..a81bd659 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -46,7 +46,7 @@ xfs_buftarg_trip_write(
 	pthread_mutex_lock(&btp->lock);
 	btp->writes_left--;
 	if (!btp->writes_left)
-		platform_crash();
+		crash();
 	pthread_mutex_unlock(&btp->lock);
 }
 
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 38406eea..a5410919 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -882,7 +882,7 @@ phase_end(int phase)
 
 	/* Fail if someone injected an post-phase error. */
 	if (fail_after_phase && phase == fail_after_phase)
-		platform_crash();
+		crash();
 }
 
 int
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 22/29] xfsprogs: Stop using platform_nproc()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (20 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 21/29] xfsprogs: Stop using platform_crash() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 23/29] xfsprogs: Stop using platform_check_iswritable() Pavel Reichl
                   ` (7 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 include/platform_defs.h.in | 1 +
 libfrog/linux.c            | 8 +++++++-
 repair/phase4.c            | 6 +++---
 repair/prefetch.c          | 2 +-
 repair/slab.c              | 2 +-
 repair/xfs_repair.c        | 2 +-
 scrub/disk.c               | 8 ++++----
 7 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
index 539bdbec..03bc255a 100644
--- a/include/platform_defs.h.in
+++ b/include/platform_defs.h.in
@@ -79,6 +79,7 @@ typedef unsigned short umode_t;
 #endif
 
 extern int	platform_nproc(void);
+extern int	nproc(void);
 
 #define NSEC_PER_SEC	(1000000000ULL)
 #define NSEC_PER_USEC	(1000ULL)
diff --git a/libfrog/linux.c b/libfrog/linux.c
index 891373c6..ee163661 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -285,7 +285,7 @@ platform_align_blockdev(void)
 
 /* How many CPUs are online? */
 int
-platform_nproc(void)
+nproc(void)
 {
 	long nproc = sysconf(_SC_NPROCESSORS_ONLN);
 
@@ -296,6 +296,12 @@ platform_nproc(void)
 	return nproc;
 }
 
+int
+platform_nproc(void)
+{
+	return nproc();
+}
+
 unsigned long
 platform_physmem(void)
 {
diff --git a/repair/phase4.c b/repair/phase4.c
index 191b4842..c496deda 100644
--- a/repair/phase4.c
+++ b/repair/phase4.c
@@ -235,7 +235,7 @@ process_rmap_data(
 	if (!rmap_needs_work(mp))
 		return;
 
-	create_work_queue(&wq, mp, platform_nproc());
+	create_work_queue(&wq, mp, nproc());
 	for (i = 0; i < mp->m_sb.sb_agcount; i++)
 		queue_work(&wq, check_rmap_btrees, i, NULL);
 	destroy_work_queue(&wq);
@@ -243,12 +243,12 @@ process_rmap_data(
 	if (!xfs_sb_version_hasreflink(&mp->m_sb))
 		return;
 
-	create_work_queue(&wq, mp, platform_nproc());
+	create_work_queue(&wq, mp, nproc());
 	for (i = 0; i < mp->m_sb.sb_agcount; i++)
 		queue_work(&wq, compute_ag_refcounts, i, NULL);
 	destroy_work_queue(&wq);
 
-	create_work_queue(&wq, mp, platform_nproc());
+	create_work_queue(&wq, mp, nproc());
 	for (i = 0; i < mp->m_sb.sb_agcount; i++) {
 		queue_work(&wq, process_inode_reflink_flags, i, NULL);
 		queue_work(&wq, check_refcount_btrees, i, NULL);
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 48affa18..f01e1296 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -1024,7 +1024,7 @@ do_inode_prefetch(
 	 */
 	if (check_cache && !libxfs_bcache_overflowed()) {
 		queue.wq_ctx = mp;
-		create_work_queue(&queue, mp, platform_nproc());
+		create_work_queue(&queue, mp, nproc());
 		for (i = 0; i < mp->m_sb.sb_agcount; i++)
 			queue_work(&queue, func, i, NULL);
 		destroy_work_queue(&queue);
diff --git a/repair/slab.c b/repair/slab.c
index 165f97ef..d9a94a81 100644
--- a/repair/slab.c
+++ b/repair/slab.c
@@ -234,7 +234,7 @@ qsort_slab(
 		return;
 	}
 
-	create_work_queue(&wq, NULL, platform_nproc());
+	create_work_queue(&wq, NULL, nproc());
 	hdr = slab->s_first;
 	while (hdr) {
 		qs = malloc(sizeof(struct qsort_slab));
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index a5410919..fbbc8c6f 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -1030,7 +1030,7 @@ main(int argc, char **argv)
 	}
 
 	if (ag_stride) {
-		int max_threads = platform_nproc() * 8;
+		int max_threads = nproc() * 8;
 
 		thread_count = (glob_agcount + ag_stride - 1) / ag_stride;
 		while (thread_count > max_threads) {
diff --git a/scrub/disk.c b/scrub/disk.c
index a1ef798a..9b91eedd 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -43,19 +43,19 @@ __disk_heads(
 {
 	int			iomin;
 	int			ioopt;
-	int			nproc = platform_nproc();
+	int			n_proc = nproc();
 	unsigned short		rot;
 	int			error;
 
 	/* If it's not a block device, throw all the CPUs at it. */
 	if (!S_ISBLK(disk->d_sb.st_mode))
-		return nproc;
+		return n_proc;
 
 	/* Non-rotational device?  Throw all the CPUs at the problem. */
 	rot = 1;
 	error = ioctl(disk->d_fd, BLKROTATIONAL, &rot);
 	if (error == 0 && rot == 0)
-		return nproc;
+		return n_proc;
 
 	/*
 	 * Sometimes we can infer the number of devices from the
@@ -65,7 +65,7 @@ __disk_heads(
 	if (ioctl(disk->d_fd, BLKIOMIN, &iomin) == 0 &&
 	    ioctl(disk->d_fd, BLKIOOPT, &ioopt) == 0 &&
 	    iomin > 0 && ioopt > 0) {
-		return min(nproc, max(1, ioopt / iomin));
+		return min(n_proc, max(1, ioopt / iomin));
 	}
 
 	/* Rotating device?  I guess? */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 23/29] xfsprogs: Stop using platform_check_iswritable()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (21 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 22/29] xfsprogs: Stop using platform_nproc() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 24/29] xfsprogs: Stop using platform_set_blocksize() Pavel Reichl
                   ` (6 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

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

diff --git a/libfrog/linux.c b/libfrog/linux.c
index ee163661..4e75247e 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -129,7 +129,7 @@ platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
 }
 
 int
-platform_check_iswritable(char *name, char *block, struct stat *s)
+check_iswritable(char *name, char *block, struct stat *s)
 {
 	int flags;
 
@@ -138,6 +138,12 @@ platform_check_iswritable(char *name, char *block, struct stat *s)
 	return check_mount(name, block, s, flags);
 }
 
+int
+platform_check_iswritable(char *name, char *block, struct stat *s)
+{
+	return check_iswritable(name, block, s);
+}
+
 int
 platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal)
 {
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 914da2c7..69f432f7 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -11,6 +11,7 @@ int platform_check_ismounted(char *path, char *block, struct stat *sptr,
 		int verbose);
 int check_ismounted(char *path, char *block, struct stat *sptr, int verbose);
 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 platform_flush_device(int fd, dev_t device);
diff --git a/libxfs/init.c b/libxfs/init.c
index 7bc3b59d..9fb4f9d8 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -61,7 +61,7 @@ check_isactive(char *name, char *block, int fatal)
 		return 0;
 	if (check_ismounted(name, block, &st, 0) == 0)
 		return 0;
-	if (platform_check_iswritable(name, block, &st))
+	if (check_iswritable(name, block, &st))
 		return fatal ? 1 : 0;
 	return 0;
 }
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 24/29] xfsprogs: Stop using platform_set_blocksize()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (22 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 23/29] xfsprogs: Stop using platform_check_iswritable() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 25/29] xfsprogs: Stop using platform_findrawpath() Pavel Reichl
                   ` (5 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 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


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 25/29] xfsprogs: Stop using platform_findrawpath()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (23 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 24/29] xfsprogs: Stop using platform_set_blocksize() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 26/29] xfsprogs: Stop using platform_findblockpath() Pavel Reichl
                   ` (4 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

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

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 796fb890..31ed59c9 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -270,11 +270,17 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz)
 }
 
 char *
-platform_findrawpath(char *path)
+findrawpath(char *path)
 {
 	return path;
 }
 
+char *
+platform_findrawpath(char *path)
+{
+	return findrawpath(path);
+}
+
 char *
 platform_findblockpath(char *path)
 {
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 06519a0c..832eb41a 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -18,6 +18,7 @@ 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);
+char *findrawpath(char *path);
 char *platform_findblockpath(char *path);
 int platform_direct_blockdev(void);
 int platform_align_blockdev(void);
diff --git a/libxfs/init.c b/libxfs/init.c
index 46e6e225..d7166b69 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -200,7 +200,7 @@ check_open(char *path, int flags, char **rawfile, char **blockfile)
 		perror(path);
 		return 0;
 	}
-	if (!(*rawfile = platform_findrawpath(path))) {
+	if (!(*rawfile = findrawpath(path))) {
 		fprintf(stderr, _("%s: "
 				  "can't find a character device matching %s\n"),
 			progname, path);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 26/29] xfsprogs: Stop using platform_findblockpath()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (24 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 25/29] xfsprogs: Stop using platform_findrawpath() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 27/29] xfsprogs: Stop using platform_direct_blockdev() Pavel Reichl
                   ` (3 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

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

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 31ed59c9..e670a5e9 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -282,11 +282,17 @@ platform_findrawpath(char *path)
 }
 
 char *
-platform_findblockpath(char *path)
+findblockpath(char *path)
 {
 	return path;
 }
 
+char *
+platform_findblockpath(char *path)
+{
+	return findblockpath(path);
+}
+
 int
 platform_direct_blockdev(void)
 {
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 832eb41a..8f1a3493 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -20,6 +20,7 @@ int flush_device(int fd, dev_t device);
 char *platform_findrawpath(char *path);
 char *findrawpath(char *path);
 char *platform_findblockpath(char *path);
+char *findblockpath(char *path);
 int platform_direct_blockdev(void);
 int platform_align_blockdev(void);
 unsigned long platform_physmem(void);	/* in kilobytes */
diff --git a/libxfs/init.c b/libxfs/init.c
index d7166b69..738e2d2d 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -206,7 +206,7 @@ check_open(char *path, int flags, char **rawfile, char **blockfile)
 			progname, path);
 		return 0;
 	}
-	if (!(*blockfile = platform_findblockpath(path))) {
+	if (!(*blockfile = findblockpath(path))) {
 		fprintf(stderr, _("%s: "
 				  "can't find a block device matching %s\n"),
 			progname, path);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 27/29] xfsprogs: Stop using platform_direct_blockdev()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (25 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 26/29] xfsprogs: Stop using platform_findblockpath() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 28/29] xfsprogs: Stop using platform_align_blockdev() Pavel Reichl
                   ` (2 subsequent siblings)
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

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

diff --git a/libfrog/linux.c b/libfrog/linux.c
index e670a5e9..59edc260 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -294,11 +294,16 @@ platform_findblockpath(char *path)
 }
 
 int
-platform_direct_blockdev(void)
+direct_blockdev(void)
 {
 	return 1;
 }
 
+int platform_direct_blockdev()
+{
+	return direct_blockdev();
+}
+
 int
 platform_align_blockdev(void)
 {
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 8f1a3493..ec1a5ab7 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -22,6 +22,7 @@ char *findrawpath(char *path);
 char *platform_findblockpath(char *path);
 char *findblockpath(char *path);
 int platform_direct_blockdev(void);
+int 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);
diff --git a/libxfs/init.c b/libxfs/init.c
index 738e2d2d..e412fd6e 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -98,7 +98,7 @@ libxfs_device_open(char *path, int creat, int xflags, int setblksize)
 
 	readonly = (xflags & LIBXFS_ISREADONLY);
 	excl = (xflags & LIBXFS_EXCLUSIVELY) && !creat;
-	dio = (xflags & LIBXFS_DIRECT) && !creat && platform_direct_blockdev();
+	dio = (xflags & LIBXFS_DIRECT) && !creat && direct_blockdev();
 
 retry:
 	flags = (readonly ? O_RDONLY : O_RDWR) | \
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 28/29] xfsprogs: Stop using platform_align_blockdev()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (26 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 27/29] xfsprogs: Stop using platform_direct_blockdev() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 21:23 ` [PATCH v2 29/29] xfsprogs: Stop using platform_physmem() Pavel Reichl
  2021-08-06 23:05 ` [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Dave Chinner
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

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

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 59edc260..43ca1e7d 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -305,13 +305,19 @@ int platform_direct_blockdev()
 }
 
 int
-platform_align_blockdev(void)
+align_blockdev(void)
 {
 	if (!max_block_alignment)
 		return getpagesize();
 	return max_block_alignment;
 }
 
+int
+platform_align_blockdev(void)
+{
+	return align_blockdev();
+}
+
 /* How many CPUs are online? */
 int
 nproc(void)
diff --git a/libfrog/platform.h b/libfrog/platform.h
index ec1a5ab7..42b0d753 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -24,6 +24,7 @@ char *findblockpath(char *path);
 int platform_direct_blockdev(void);
 int direct_blockdev(void);
 int platform_align_blockdev(void);
+int 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);
diff --git a/libxfs/init.c b/libxfs/init.c
index e412fd6e..a9b67159 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -1030,7 +1030,7 @@ libxfs_destroy(
 int
 libxfs_device_alignment(void)
 {
-	return platform_align_blockdev();
+	return align_blockdev();
 }
 
 void
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 29/29] xfsprogs: Stop using platform_physmem()
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (27 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 28/29] xfsprogs: Stop using platform_align_blockdev() Pavel Reichl
@ 2021-08-06 21:23 ` Pavel Reichl
  2021-08-06 23:05 ` [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Dave Chinner
  29 siblings, 0 replies; 33+ messages in thread
From: Pavel Reichl @ 2021-08-06 21:23 UTC (permalink / raw)
  To: linux-xfs

---
 libfrog/linux.c     | 8 +++++++-
 libfrog/platform.h  | 1 +
 repair/xfs_repair.c | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libfrog/linux.c b/libfrog/linux.c
index 43ca1e7d..9b99d1a7 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -338,7 +338,7 @@ platform_nproc(void)
 }
 
 unsigned long
-platform_physmem(void)
+physmem(void)
 {
 	struct sysinfo  si;
 
@@ -349,3 +349,9 @@ platform_physmem(void)
 	}
 	return (si.totalram >> 10) * si.mem_unit;	/* kilobytes */
 }
+
+unsigned long
+platform_physmem(void)
+{
+	return physmem();
+}
diff --git a/libfrog/platform.h b/libfrog/platform.h
index 42b0d753..b034d652 100644
--- a/libfrog/platform.h
+++ b/libfrog/platform.h
@@ -26,6 +26,7 @@ int direct_blockdev(void);
 int platform_align_blockdev(void);
 int align_blockdev(void);
 unsigned long platform_physmem(void);	/* in kilobytes */
+unsigned long 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);
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index fbbc8c6f..b8d56d9d 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -1081,7 +1081,7 @@ main(int argc, char **argv)
 					(mp->m_sb.sb_dblocks >> (10 + 1)) +
 					50000;	/* rough estimate of 50MB overhead */
 		max_mem = max_mem_specified ? max_mem_specified * 1024 :
-					      platform_physmem() * 3 / 4;
+					      physmem() * 3 / 4;
 
 		if (getrlimit(RLIMIT_AS, &rlim) != -1 &&
 					rlim.rlim_cur != RLIM_INFINITY) {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix
  2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (28 preceding siblings ...)
  2021-08-06 21:23 ` [PATCH v2 29/29] xfsprogs: Stop using platform_physmem() Pavel Reichl
@ 2021-08-06 23:05 ` Dave Chinner
  2021-08-07 15:13   ` Pavel Reichl
  29 siblings, 1 reply; 33+ messages in thread
From: Dave Chinner @ 2021-08-06 23:05 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: linux-xfs

On Fri, Aug 06, 2021 at 11:22:49PM +0200, Pavel Reichl wrote:
> Stop using commands with 'platform_' prefix. Either use directly linux
> standard command or drop the prefix from the function name.

Looks like all of the patches in this series are missing
signed-off-by lines.  Most of them have empty commit messages, too,
which we don't tend to do very often.

>  51 files changed, 284 insertions(+), 151 deletions(-)

IMO, 29 patches for such a small change is way too fine grained for
working through efficiently.  Empty commit messages tend to be a
sign that you can aggregate patches together.... i.e.  One patch for
all the uuid changes (currently 7 patches) with a description of why
you're changing the platform_uuid interface, one for all the mount
related stuff (at least 5 patches now), one for all the block device
stuff (8 or so patches), one for all the path bits, and then one for
whatever is left over.

Every patch has overhead, be it to produce, maintain, review, test,
merge, etc. Breaking stuff down unnecessarily just increases the
amount of work everyone has to do at every step. So if you find that
you are writing dozens of patches that each have a trivial change in
them that you are boiler-plating commit messages, you've probably
made the overall changeset too fine grained.

Also....

>  libxfs/init.c               | 32 ++++++------
>  libxfs/libxfs_io.h          |  2 +-
>  libxfs/libxfs_priv.h        |  3 +-
>  libxfs/rdwr.c               |  4 +-
>  libxfs/xfs_ag.c             |  6 +--
>  libxfs/xfs_attr_leaf.c      |  2 +-
>  libxfs/xfs_attr_remote.c    |  2 +-
>  libxfs/xfs_btree.c          |  4 +-
>  libxfs/xfs_da_btree.c       |  2 +-
>  libxfs/xfs_dir2_block.c     |  2 +-
>  libxfs/xfs_dir2_data.c      |  2 +-
>  libxfs/xfs_dir2_leaf.c      |  2 +-
>  libxfs/xfs_dir2_node.c      |  2 +-
>  libxfs/xfs_dquot_buf.c      |  2 +-
>  libxfs/xfs_ialloc.c         |  4 +-
>  libxfs/xfs_inode_buf.c      |  2 +-
>  libxfs/xfs_sb.c             |  6 +--
>  libxfs/xfs_symlink_remote.c |  2 +-

Why are all these libxfs files being changed?

$ git grep -l platform libxfs/
libxfs/init.c
libxfs/libxfs_io.h
libxfs/libxfs_priv.h
libxfs/rdwr.c
libxfs/xfs_log_format.h
$

IOWs, there are calls to platform_*() functions in most of these
libxfs files, so what is being changed here? If these are code
changes, then they will end up needed to be ported across to the
kernel libxfs, too.

I did a quick scan of a few of the patches but I didn't land on the
one that had these changes in it; another reason for not doing stuff
in such fine grained ways. Hence it's not clear to me why renaming
platform_*() functions would touch these files.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix
  2021-08-06 23:05 ` [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Dave Chinner
@ 2021-08-07 15:13   ` Pavel Reichl
  2021-08-07 21:46     ` Dave Chinner
  0 siblings, 1 reply; 33+ messages in thread
From: Pavel Reichl @ 2021-08-07 15:13 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs


On 8/7/21 1:05 AM, Dave Chinner wrote:
> On Fri, Aug 06, 2021 at 11:22:49PM +0200, Pavel Reichl wrote:
>> Stop using commands with 'platform_' prefix. Either use directly linux
>> standard command or drop the prefix from the function name.
> Looks like all of the patches in this series are missing
> signed-off-by lines.  Most of them have empty commit messages, too,
Sorry about the missing signed-off-by, I really need to have a
check-list before posting patches...or send more patches :-).
> which we don't tend to do very often.
>
>>   51 files changed, 284 insertions(+), 151 deletions(-)
> IMO, 29 patches for such a small change is way too fine grained for
> working through efficiently.  Empty commit messages tend to be a
> sign that you can aggregate patches together.... i.e.  One patch for
> all the uuid changes (currently 7 patches) with a description of why
> you're changing the platform_uuid interface, one for all the mount
> related stuff (at least 5 patches now), one for all the block device
> stuff (8 or so patches), one for all the path bits, and then one for
> whatever is left over.
OK, I'll do this in the next version.
>
> Every patch has overhead, be it to produce, maintain, review, test,
> merge, etc. Breaking stuff down unnecessarily just increases the
> amount of work everyone has to do at every step. So if you find that
> you are writing dozens of patches that each have a trivial change in
> them that you are boiler-plating commit messages, you've probably
> made the overall changeset too fine grained.
OK, sincerely thank you for the 'rules-of-thump'. However, In the
first version of the patch set I grouped the changes into way less patches
and passed along a question about the preferred granularity of patches
and got the following answer:

>   * What would be best for the reviewer - should I prepare a separate
>   patch for every function rename or should I squash the changes into
>   one huge patch?
> One patch per function, please.

However, I agree that I should have mentioned that some patches would
be too small and not blindly follow the request...I'll do better next
time.
>
> Also....
>
>>   libxfs/init.c               | 32 ++++++------
>>   libxfs/libxfs_io.h          |  2 +-
>>   libxfs/libxfs_priv.h        |  3 +-
>>   libxfs/rdwr.c               |  4 +-
>>   libxfs/xfs_ag.c             |  6 +--
>>   libxfs/xfs_attr_leaf.c      |  2 +-
>>   libxfs/xfs_attr_remote.c    |  2 +-
>>   libxfs/xfs_btree.c          |  4 +-
>>   libxfs/xfs_da_btree.c       |  2 +-
>>   libxfs/xfs_dir2_block.c     |  2 +-
>>   libxfs/xfs_dir2_data.c      |  2 +-
>>   libxfs/xfs_dir2_leaf.c      |  2 +-
>>   libxfs/xfs_dir2_node.c      |  2 +-
>>   libxfs/xfs_dquot_buf.c      |  2 +-
>>   libxfs/xfs_ialloc.c         |  4 +-
>>   libxfs/xfs_inode_buf.c      |  2 +-
>>   libxfs/xfs_sb.c             |  6 +--
>>   libxfs/xfs_symlink_remote.c |  2 +-
> Why are all these libxfs files being changed?

I believe this is because of patch #6 - xfsprogs: Stop using 
platform_uuid_copy()

Here I dropped the usage of platform_uuid_copy() even in libxfs by:

1) removing the uuid_copy() macro that was implemented by calling
    platform_uuid_copy() in libxfs/libxfs_priv.h

  -#define uuid_copy(s,d) platform_uuid_copy((s),(d))

2) using directly standard uuid_copy() instead
    Which resulted into plenty of trivial changes all over libxfs, the
    core of the changes being that uuid params are passed-by-value to
    standard uuid_copy(), but to libxfs' uuid_copy() it is
    passed-by-reference.

    E.g.
- uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
+               uuid_copy(agf->agf_uuid, mp->m_sb.sb_meta_uuid);
> Cheers,
>
> Dave.
Hi Dave,
Thank you for you comments, please see reactions above.
Have a nice day.




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix
  2021-08-07 15:13   ` Pavel Reichl
@ 2021-08-07 21:46     ` Dave Chinner
  0 siblings, 0 replies; 33+ messages in thread
From: Dave Chinner @ 2021-08-07 21:46 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: linux-xfs

On Sat, Aug 07, 2021 at 05:13:33PM +0200, Pavel Reichl wrote:
> 
> On 8/7/21 1:05 AM, Dave Chinner wrote:
> > On Fri, Aug 06, 2021 at 11:22:49PM +0200, Pavel Reichl wrote:
> > > Stop using commands with 'platform_' prefix. Either use directly linux
> > > standard command or drop the prefix from the function name.
> > Looks like all of the patches in this series are missing
> > signed-off-by lines.  Most of them have empty commit messages, too,
> Sorry about the missing signed-off-by, I really need to have a
> check-list before posting patches...or send more patches :-).

Having a checklist is a good idea. :)

> > which we don't tend to do very often.
> > 
> > >   51 files changed, 284 insertions(+), 151 deletions(-)
> > IMO, 29 patches for such a small change is way too fine grained for
> > working through efficiently.  Empty commit messages tend to be a
> > sign that you can aggregate patches together.... i.e.  One patch for
> > all the uuid changes (currently 7 patches) with a description of why
> > you're changing the platform_uuid interface, one for all the mount
> > related stuff (at least 5 patches now), one for all the block device
> > stuff (8 or so patches), one for all the path bits, and then one for
> > whatever is left over.
> OK, I'll do this in the next version.
> > 
> > Every patch has overhead, be it to produce, maintain, review, test,
> > merge, etc. Breaking stuff down unnecessarily just increases the
> > amount of work everyone has to do at every step. So if you find that
> > you are writing dozens of patches that each have a trivial change in
> > them that you are boiler-plating commit messages, you've probably
> > made the overall changeset too fine grained.
> OK, sincerely thank you for the 'rules-of-thump'. However, In the
> first version of the patch set I grouped the changes into way less patches
> and passed along a question about the preferred granularity of patches
> and got the following answer:
> 
> >   * What would be best for the reviewer - should I prepare a separate
> >   patch for every function rename or should I squash the changes into
> >   one huge patch?
> > One patch per function, please.
> 
> However, I agree that I should have mentioned that some patches would
> be too small and not blindly follow the request...I'll do better next
> time.

Yeah, I tend to push back on black and white process requirements
like this.  Everything has shades of grey. The process of responding
to so many small, trivial changes broken up like this is not an
efficient or effective use of developer time.

One function per patch makes sense when there are lots of changes to
a single function. But for stuff where there is only one or two
users (e.g. platform_discard, platform_findrawpath, platform*_block*
etc) splitting them in to single patches is not efficient.

I always think of it like this: would I like to have to reply to 29
emails just to add RVBs for such a change? Responding to 29 emails
is a decent chunk of time that every reviewer must invest. Is the
change complex enough to need such fine grained review effort.

In this case, I think no, especially because it hid where a
significant issue was introduced....

> > Also....
> > 
> > >   libxfs/init.c               | 32 ++++++------
> > >   libxfs/libxfs_io.h          |  2 +-
> > >   libxfs/libxfs_priv.h        |  3 +-
> > >   libxfs/rdwr.c               |  4 +-
> > >   libxfs/xfs_ag.c             |  6 +--
> > >   libxfs/xfs_attr_leaf.c      |  2 +-
> > >   libxfs/xfs_attr_remote.c    |  2 +-
> > >   libxfs/xfs_btree.c          |  4 +-
> > >   libxfs/xfs_da_btree.c       |  2 +-
> > >   libxfs/xfs_dir2_block.c     |  2 +-
> > >   libxfs/xfs_dir2_data.c      |  2 +-
> > >   libxfs/xfs_dir2_leaf.c      |  2 +-
> > >   libxfs/xfs_dir2_node.c      |  2 +-
> > >   libxfs/xfs_dquot_buf.c      |  2 +-
> > >   libxfs/xfs_ialloc.c         |  4 +-
> > >   libxfs/xfs_inode_buf.c      |  2 +-
> > >   libxfs/xfs_sb.c             |  6 +--
> > >   libxfs/xfs_symlink_remote.c |  2 +-
> > Why are all these libxfs files being changed?
> 
> I believe this is because of patch #6 - xfsprogs: Stop using
> platform_uuid_copy()
> 
> Here I dropped the usage of platform_uuid_copy() even in libxfs by:
> 
> 1) removing the uuid_copy() macro that was implemented by calling
>    platform_uuid_copy() in libxfs/libxfs_priv.h
> 
>  -#define uuid_copy(s,d) platform_uuid_copy((s),(d))
> 
> 2) using directly standard uuid_copy() instead
>    Which resulted into plenty of trivial changes all over libxfs, the
>    core of the changes being that uuid params are passed-by-value to
>    standard uuid_copy(), but to libxfs' uuid_copy() it is
>    passed-by-reference.
> 
>    E.g.
> - uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
> +               uuid_copy(agf->agf_uuid, mp->m_sb.sb_meta_uuid);

Ok, this is something that should definitely be mentioned in the
commit message because it's not just a rename.

As it is, this is the sort of problem we have to solve in userspace.
That was the purpose of the #define uuid_copy() you removed - it
translates the kernel API to the userspace API. We still need
something like that, which means the platform_uuid_copy()
change-over likely needs it's own patch and documentation (because
it's not just a straight rename anymore.

We do not want to make libxfs code unnecessarily different between
user and kernel space because that increases the overhead of porting
changes between kernel <-> userspace code bases. Hence we really
need to solve the "same function name, different calling convention"
in some way in userspace without requiring code diffs between kernel
and userspace.

Maybe some pre-processor magic can be done here in userspace. Maybe
we need to rename uuid_copy() in both the kernel and userspace, so
both have a static inline wrapper that can call the native
uuid_copy() with the correct parameters (another reason for it being
a separate patch so it can be easily ported).

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2021-08-07 21:46 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 01/29] xfsprogs: Stop using platform_uuid_compare() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 02/29] xfsprogs: Stop using platform_test_xfs_fd() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 03/29] xfsprogs: Stop using platform_test_xfs_path() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 04/29] xfsprogs: Stop using platform_fstatfs() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 05/29] xfsprogs: Stop using platform_getoptreset() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 06/29] xfsprogs: Stop using platform_uuid_copy() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 07/29] xfsprogs: Stop using platform_uuid_generate() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 08/29] xfsprogs: Stop using platform_uuid_unparse() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 09/29] xfsprogs: Stop using platform_uuid_clear() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 10/29] xfsprogs: Stop using platform_uuid_parse() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 11/29] xfsprogs: Stop using platform_uuid_is_null() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 12/29] xfsprogs: Stop using platform_check_mount() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 13/29] xfsprogs: Stop using platform_check_ismounted() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 14/29] xfsprogs: Stop using platform_flush_device() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 15/29] xfsprogs: Stop using platform_mntent_open() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 16/29] xfsprogs: Stop using platform_mntent_next() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 17/29] xfsprogs: Stop using platform_mntent_close() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 18/29] xfsprogs: Stop using platform_findsizes() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 19/29] xfsprogs: Stop using platform_discard_blocks Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 20/29] xfsprogs: Stop using platform_zero_range() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 21/29] xfsprogs: Stop using platform_crash() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 22/29] xfsprogs: Stop using platform_nproc() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 23/29] xfsprogs: Stop using platform_check_iswritable() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 24/29] xfsprogs: Stop using platform_set_blocksize() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 25/29] xfsprogs: Stop using platform_findrawpath() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 26/29] xfsprogs: Stop using platform_findblockpath() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 27/29] xfsprogs: Stop using platform_direct_blockdev() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 28/29] xfsprogs: Stop using platform_align_blockdev() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 29/29] xfsprogs: Stop using platform_physmem() Pavel Reichl
2021-08-06 23:05 ` [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Dave Chinner
2021-08-07 15:13   ` Pavel Reichl
2021-08-07 21:46     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).