All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix
@ 2021-08-02 21:50 Pavel Reichl
  2021-08-02 21:50 ` [PATCH 1/8] xfsprogs: Rename platform_defs.h.in -> defs.h.in Pavel Reichl
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

Hi,

Eric recently suggested that removing prefix 'platform_' from function names in xfsprogs could be a good idea.

It seems to be a relict from times when support from other OSes was expected. Since it does not seem to happen it might be a good idea to remove the prefix and thus simplify the codebase a bit.

The core of the changes is in removing 'platform' wrappers around standard linux calls and fixing the passed parameters from pointers to actual values (if appropriate) e.g.

-static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
-{
-	uuid_copy(*dst, *src);
-}
... 
-		platform_uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
+		uuid_copy(hdr3->uuid, mp->m_sb.sb_meta_uuid);



I attached first WIP version (that builds and passes my limited testing) to show the scope of changes and find consensus about some choices that need to be done:

 * Is renaming platform_defs.h.in -> defs.h.in OK?
 * is renaming libfrog/platform.h -> libfrog/common.h OK, maybe libfrog/libfrog.h is better?
 * Wrapper platform_nproc() defined in/libfrog/linux.c slightly changes the behavior of nproc() is renaming it to libfrog_nproc() OK?
 * 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?
 
Thanks! 

Pavel Reichl (8):
  xfsprogs: Rename platform_defs.h.in -> defs.h.in
  xfsprogs: Rename platform.h -> common.h
  xfsprogs: remove platform_uuid_compare()
  xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
  xfsprogs: Rename platform_getoptreset -> getoptreset
  xfsprogs: remove all platform_ prefixes in linux.h
  xfsprogs: Remove platform_ prefixes in libfrog/common.h
  xfsprogs: remove platform_ from man xfsctl man page

 .gitignore                                |  2 +-
 Makefile                                  | 10 ++--
 configure.ac                              |  2 +-
 copy/xfs_copy.c                           | 26 +++++-----
 db/command.c                              |  2 +-
 db/fprint.c                               |  2 +-
 db/sb.c                                   | 14 ++---
 debian/rules                              |  4 +-
 fsr/xfs_fsr.c                             |  8 +--
 growfs/xfs_growfs.c                       |  2 +-
 include/Makefile                          |  4 +-
 include/{platform_defs.h.in => defs.h.in} |  8 +--
 include/libxfs.h                          |  2 +-
 include/linux.h                           | 62 ++++-------------------
 io/bmap.c                                 |  2 +-
 io/bulkstat.c                             |  2 +-
 io/cowextsize.c                           |  2 +-
 io/crc32cselftest.c                       |  2 +-
 io/encrypt.c                              |  2 +-
 io/fiemap.c                               |  2 +-
 io/fsmap.c                                |  2 +-
 io/fsync.c                                |  2 +-
 io/init.c                                 |  4 +-
 io/label.c                                |  2 +-
 io/log_writes.c                           |  2 +-
 io/open.c                                 |  4 +-
 io/stat.c                                 |  2 +-
 io/sync.c                                 |  2 +-
 libfrog/avl64.c                           |  2 +-
 libfrog/bitmap.c                          |  2 +-
 libfrog/common.h                          | 26 ++++++++++
 libfrog/convert.c                         |  2 +-
 libfrog/crc32.c                           |  2 +-
 libfrog/fsgeom.c                          |  2 +-
 libfrog/linux.c                           | 30 +++++------
 libfrog/paths.c                           |  2 +-
 libfrog/paths.h                           |  2 +-
 libfrog/platform.h                        | 26 ----------
 libfrog/projects.h                        |  2 +-
 libfrog/ptvar.c                           |  2 +-
 libfrog/radix-tree.c                      |  2 +-
 libfrog/topology.c                        |  8 +--
 libfrog/util.c                            |  2 +-
 libhandle/handle.c                        |  2 +-
 libhandle/jdm.c                           |  2 +-
 libxcmd/command.c                         |  4 +-
 libxcmd/help.c                            |  2 +-
 libxcmd/input.c                           |  2 +-
 libxcmd/quit.c                            |  2 +-
 libxfs/init.c                             | 34 ++++++-------
 libxfs/libxfs_io.h                        |  2 +-
 libxfs/libxfs_priv.h                      |  5 +-
 libxfs/rdwr.c                             |  6 +--
 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 +-
 man/man3/xfsctl.3                         |  9 +---
 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                       |  8 +--
 scrub/common.c                            |  2 +-
 scrub/descr.c                             |  2 +-
 scrub/disk.c                              |  6 +--
 scrub/fscounters.c                        |  2 +-
 scrub/inodes.c                            |  2 +-
 scrub/xfs_scrub.c                         |  2 +-
 spaceman/health.c                         |  2 +-
 spaceman/init.c                           |  2 +-
 91 files changed, 235 insertions(+), 281 deletions(-)
 rename include/{platform_defs.h.in => defs.h.in} (95%)
 create mode 100644 libfrog/common.h
 delete mode 100644 libfrog/platform.h

-- 
2.31.1


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

* [PATCH 1/8] xfsprogs: Rename platform_defs.h.in -> defs.h.in
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 21:50 ` [PATCH 2/8] xfsprogs: Rename platform.h -> common.h Pavel Reichl
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

No other platform then linux is supported, so drop the extra "platform_"
from filename.
---
 .gitignore                                |  2 +-
 Makefile                                  | 10 +++++-----
 configure.ac                              |  2 +-
 debian/rules                              |  4 ++--
 include/Makefile                          |  4 ++--
 include/{platform_defs.h.in => defs.h.in} |  6 +++---
 include/libxfs.h                          |  2 +-
 io/bmap.c                                 |  2 +-
 io/bulkstat.c                             |  2 +-
 io/cowextsize.c                           |  2 +-
 io/crc32cselftest.c                       |  2 +-
 io/encrypt.c                              |  2 +-
 io/fiemap.c                               |  2 +-
 io/fsmap.c                                |  2 +-
 io/fsync.c                                |  2 +-
 io/init.c                                 |  2 +-
 io/label.c                                |  2 +-
 io/log_writes.c                           |  2 +-
 io/sync.c                                 |  2 +-
 libfrog/avl64.c                           |  2 +-
 libfrog/bitmap.c                          |  2 +-
 libfrog/convert.c                         |  2 +-
 libfrog/crc32.c                           |  2 +-
 libfrog/fsgeom.c                          |  2 +-
 libfrog/linux.c                           |  2 +-
 libfrog/paths.h                           |  2 +-
 libfrog/projects.h                        |  2 +-
 libfrog/ptvar.c                           |  2 +-
 libfrog/radix-tree.c                      |  2 +-
 libfrog/util.c                            |  2 +-
 libhandle/handle.c                        |  2 +-
 libhandle/jdm.c                           |  2 +-
 libxcmd/command.c                         |  2 +-
 libxcmd/help.c                            |  2 +-
 libxcmd/input.c                           |  2 +-
 libxcmd/quit.c                            |  2 +-
 libxfs/libxfs_priv.h                      |  2 +-
 scrub/common.c                            |  2 +-
 scrub/descr.c                             |  2 +-
 scrub/disk.c                              |  4 ++--
 scrub/fscounters.c                        |  2 +-
 scrub/inodes.c                            |  2 +-
 scrub/xfs_scrub.c                         |  2 +-
 spaceman/health.c                         |  2 +-
 44 files changed, 53 insertions(+), 53 deletions(-)
 rename include/{platform_defs.h.in => defs.h.in} (96%)

diff --git a/.gitignore b/.gitignore
index fd131b6f..59b81d6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,7 @@
 # build system
 .census
 .gitcensus
-/include/platform_defs.h
+/include/defs.h
 /include/builddefs
 /install-sh
 
diff --git a/Makefile b/Makefile
index 0edc2700..296dcc09 100644
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,7 @@ SRCTARINC = m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
            m4/ltversion.m4 po/xfsprogs.pot .gitcensus $(CONFIGURE)
 LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
 	conftest* built .census install.* install-dev.* *.gz *.xz \
-	autom4te.cache/* libtool include/builddefs include/platform_defs.h
+	autom4te.cache/* libtool include/builddefs include/defs.h
 
 ifeq ($(HAVE_BUILDDEFS), yes)
 LDIRDIRT = $(SRCDIR)
@@ -84,7 +84,7 @@ endif
 # include is listed last so it is processed last in clean rules.
 SUBDIRS = $(LIBFROG_SUBDIR) $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include
 
-default: include/builddefs include/platform_defs.h
+default: include/builddefs include/defs.h
 ifeq ($(HAVE_BUILDDEFS), no)
 	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
@@ -130,7 +130,7 @@ configure: configure.ac
 include/builddefs: configure
 	./configure $$LOCAL_CONFIGURE_OPTIONS
 
-include/platform_defs.h: include/builddefs
+include/defs.h: include/builddefs
 ## Recover from the removal of $@
 	@if test -f $@; then :; else \
 		rm -f include/builddefs; \
@@ -160,14 +160,14 @@ realclean: distclean
 #
 # All this gunk is to allow for a make dist on an unconfigured tree
 #
-dist: include/builddefs include/platform_defs.h default
+dist: include/builddefs include/defs.h default
 ifeq ($(HAVE_BUILDDEFS), no)
 	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
 	$(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
 endif
 
-deb: include/builddefs include/platform_defs.h
+deb: include/builddefs include/defs.h
 ifeq ($(HAVE_BUILDDEFS), no)
 	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
diff --git a/configure.ac b/configure.ac
index e1775ed9..b328ccb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.50)
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([include/libxfs.h])
-AC_CONFIG_HEADER(include/platform_defs.h)
+AC_CONFIG_HEADER(include/defs.h)
 AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_INSTALL
diff --git a/debian/rules b/debian/rules
index fe9a1c3a..700df898 100755
--- a/debian/rules
+++ b/debian/rules
@@ -44,14 +44,14 @@ config: .census
 	$(checkdir)
 	AUTOHEADER=/bin/true dh_autoreconf
 	dh_update_autotools_config
-	$(options) $(MAKE) $(PMAKEFLAGS) include/platform_defs.h
+	$(options) $(MAKE) $(PMAKEFLAGS) include/defs.h
 	touch .census
 
 dibuild:
 	$(checkdir)
 	@echo "== dpkg-buildpackage: installer" 1>&2
 	if [ ! -f mkfs/mkfs.xfs-$(bootpkg) ]; then \
-		$(diopts) $(MAKE) include/platform_defs.h; \
+		$(diopts) $(MAKE) include/defs.h; \
 		mkdir -p include/xfs; \
 		for dir in include libxfs; do \
 			$(MAKE) $(PMAKEFLAGS) -C $$dir NODEP=1 install-headers; \
diff --git a/include/Makefile b/include/Makefile
index 632b819f..8e14ffae 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -27,7 +27,7 @@ LIBHFILES = libxfs.h \
 	xfs_trans.h \
 	command.h \
 	input.h \
-	platform_defs.h
+	defs.h
 
 HFILES = handle.h \
 	jdm.h \
@@ -37,7 +37,7 @@ HFILES = handle.h \
 	xfs_fs_compat.h \
 	xfs_arch.h
 
-LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules install-sh
+LSRCFILES = defs.h.in builddefs.in buildmacros buildrules install-sh
 LSRCFILES += $(DKHFILES) $(LIBHFILES)
 LDIRT = disk
 LDIRDIRT = xfs
diff --git a/include/platform_defs.h.in b/include/defs.h.in
similarity index 96%
rename from include/platform_defs.h.in
rename to include/defs.h.in
index 539bdbec..ce0c1a0e 100644
--- a/include/platform_defs.h.in
+++ b/include/defs.h.in
@@ -3,8 +3,8 @@
  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
  * All Rights Reserved.
  */
-#ifndef __XFS_PLATFORM_DEFS_H__
-#define __XFS_PLATFORM_DEFS_H__
+#ifndef __XFS_DEFS_H__
+#define __XFS_DEFS_H__
 
 #include <stdio.h>
 #include <errno.h>
@@ -112,4 +112,4 @@ static inline size_t __ab_c_size(size_t a, size_t b, size_t c)
 		sizeof(*(p)->member) + __must_be_array((p)->member),	\
 		sizeof(*(p)))
 
-#endif	/* __XFS_PLATFORM_DEFS_H__ */
+#endif	/* __XFS_DEFS_H__ */
diff --git a/include/libxfs.h b/include/libxfs.h
index bc07655e..af1feedb 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -8,7 +8,7 @@
 #define __LIBXFS_H__
 
 #include "libxfs_api_defs.h"
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 
 #include "list.h"
diff --git a/io/bmap.c b/io/bmap.c
index 27383ca6..31a27848 100644
--- a/io/bmap.c
+++ b/io/bmap.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "input.h"
 #include "init.h"
diff --git a/io/bulkstat.c b/io/bulkstat.c
index 201470b2..f1a8113e 100644
--- a/io/bulkstat.c
+++ b/io/bulkstat.c
@@ -4,7 +4,7 @@
  * Author: Darrick J. Wong <darrick.wong@oracle.com>
  */
 #include "xfs.h"
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "libfrog/logging.h"
diff --git a/io/cowextsize.c b/io/cowextsize.c
index f6b134df..86496bb3 100644
--- a/io/cowextsize.c
+++ b/io/cowextsize.c
@@ -9,7 +9,7 @@
  * build with the internal definition of struct fsxattr, which has
  * fsx_cowextsize.
  */
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "io.h"
diff --git a/io/crc32cselftest.c b/io/crc32cselftest.c
index f8f757f6..3ae8b98a 100644
--- a/io/crc32cselftest.c
+++ b/io/crc32cselftest.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "io.h"
diff --git a/io/encrypt.c b/io/encrypt.c
index 1b347dc1..8d733363 100644
--- a/io/encrypt.c
+++ b/io/encrypt.c
@@ -7,7 +7,7 @@
 #ifdef OVERRIDE_SYSTEM_FSCRYPT_ADD_KEY_ARG
 #  define fscrypt_add_key_arg sys_fscrypt_add_key_arg
 #endif
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "libfrog/paths.h"
diff --git a/io/fiemap.c b/io/fiemap.c
index f0c74dfe..00bf5ec7 100644
--- a/io/fiemap.c
+++ b/io/fiemap.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "input.h"
 #include <linux/fiemap.h>
diff --git a/io/fsmap.c b/io/fsmap.c
index 4b217595..5cfb7794 100644
--- a/io/fsmap.c
+++ b/io/fsmap.c
@@ -3,7 +3,7 @@
  * Copyright (C) 2017 Oracle.  All Rights Reserved.
  * Author: Darrick J. Wong <darrick.wong@oracle.com>
  */
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "libfrog/paths.h"
diff --git a/io/fsync.c b/io/fsync.c
index b425b612..0ba2fa6f 100644
--- a/io/fsync.c
+++ b/io/fsync.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "io.h"
diff --git a/io/init.c b/io/init.c
index 033ed67d..0fbc703e 100644
--- a/io/init.c
+++ b/io/init.c
@@ -5,7 +5,7 @@
  */
 
 #include <pthread.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "input.h"
 #include "init.h"
diff --git a/io/label.c b/io/label.c
index 890ddde4..25b4adfb 100644
--- a/io/label.c
+++ b/io/label.c
@@ -4,7 +4,7 @@
  */
 
 #include <sys/ioctl.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "libxfs.h"
 #include "libfrog/paths.h"
 #include "command.h"
diff --git a/io/log_writes.c b/io/log_writes.c
index 20049d18..0e24705e 100644
--- a/io/log_writes.c
+++ b/io/log_writes.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include <libdevmapper.h>
 #include "command.h"
 #include "init.h"
diff --git a/io/sync.c b/io/sync.c
index 89f787ec..40c88531 100644
--- a/io/sync.c
+++ b/io/sync.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "init.h"
 #include "io.h"
diff --git a/libfrog/avl64.c b/libfrog/avl64.c
index 2547bf3b..456c20e2 100644
--- a/libfrog/avl64.c
+++ b/libfrog/avl64.c
@@ -5,7 +5,7 @@
  */
 #include <stdint.h>
 #include <stdio.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "avl64.h"
 
 #define CERT	ASSERT
diff --git a/libfrog/bitmap.c b/libfrog/bitmap.c
index 5af5ab8d..3081ecf6 100644
--- a/libfrog/bitmap.c
+++ b/libfrog/bitmap.c
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <pthread.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "avl64.h"
 #include "list.h"
 #include "bitmap.h"
diff --git a/libfrog/convert.c b/libfrog/convert.c
index 0ceeb389..6211e192 100644
--- a/libfrog/convert.c
+++ b/libfrog/convert.c
@@ -3,7 +3,7 @@
  * Copyright (c) 2003-2005 Silicon Graphics, Inc.
  * All Rights Reserved.
  */
-#include "platform_defs.h"
+#include "defs.h"
 #include "input.h"
 #include <ctype.h>
 #include <stdbool.h>
diff --git a/libfrog/crc32.c b/libfrog/crc32.c
index 526ce950..c7f9c24b 100644
--- a/libfrog/crc32.c
+++ b/libfrog/crc32.c
@@ -32,7 +32,7 @@
 #include <inttypes.h>
 #include <asm/types.h>
 #include <sys/time.h>
-#include "platform_defs.h"
+#include "defs.h"
 /* For endian conversion routines */
 #include "xfs_arch.h"
 #include "crc32defs.h"
diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c
index 4f1a1842..62313c6b 100644
--- a/libfrog/fsgeom.c
+++ b/libfrog/fsgeom.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
  */
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 #include "bitops.h"
 #include "fsgeom.h"
diff --git a/libfrog/linux.c b/libfrog/linux.c
index a45d99ab..ea69b29b 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -9,7 +9,7 @@
 #include <sys/ioctl.h>
 #include <sys/sysinfo.h>
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 #include "init.h"
 
diff --git a/libfrog/paths.h b/libfrog/paths.h
index c08e3733..01ca1e29 100644
--- a/libfrog/paths.h
+++ b/libfrog/paths.h
@@ -6,7 +6,7 @@
 #ifndef __LIBFROG_PATH_H__
 #define __LIBFROG_PATH_H__
 
-#include "platform_defs.h"
+#include "defs.h"
 
 /*
  * XFS Filesystem Paths
diff --git a/libfrog/projects.h b/libfrog/projects.h
index 77919474..52c5cd33 100644
--- a/libfrog/projects.h
+++ b/libfrog/projects.h
@@ -6,7 +6,7 @@
 #ifndef __LIBFROG_PROJECTS_H__
 #define __LIBFROG_PROJECTS_H__
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 
 extern int setprojid(const char *__name, int __fd, prid_t __id);
diff --git a/libfrog/ptvar.c b/libfrog/ptvar.c
index 7ac8c541..95e0eb15 100644
--- a/libfrog/ptvar.c
+++ b/libfrog/ptvar.c
@@ -10,7 +10,7 @@
 #include <assert.h>
 #include <pthread.h>
 #include <unistd.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "ptvar.h"
 
 /*
diff --git a/libfrog/radix-tree.c b/libfrog/radix-tree.c
index 261fc248..d07af105 100644
--- a/libfrog/radix-tree.c
+++ b/libfrog/radix-tree.c
@@ -8,7 +8,7 @@
 #include <string.h>
 #include <errno.h>
 #include <stdint.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "radix-tree.h"
 
 #ifndef ARRAY_SIZE
diff --git a/libfrog/util.c b/libfrog/util.c
index 8fb10cf8..8ab901f9 100644
--- a/libfrog/util.c
+++ b/libfrog/util.c
@@ -3,7 +3,7 @@
  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
  * All Rights Reserved.
  */
-#include "platform_defs.h"
+#include "defs.h"
 #include "util.h"
 
 /*
diff --git a/libhandle/handle.c b/libhandle/handle.c
index 27abc6b2..dbf56aba 100644
--- a/libhandle/handle.c
+++ b/libhandle/handle.c
@@ -5,7 +5,7 @@
  */
 
 #include <libgen.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 #include "handle.h"
 #include "parent.h"
diff --git a/libhandle/jdm.c b/libhandle/jdm.c
index 07b0c609..d8f0efc0 100644
--- a/libhandle/jdm.c
+++ b/libhandle/jdm.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 #include "handle.h"
 #include "jdm.h"
diff --git a/libxcmd/command.c b/libxcmd/command.c
index a76d1515..7e37a9d6 100644
--- a/libxcmd/command.c
+++ b/libxcmd/command.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "input.h"
 
diff --git a/libxcmd/help.c b/libxcmd/help.c
index b7e02073..09359dc0 100644
--- a/libxcmd/help.c
+++ b/libxcmd/help.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "../quota/init.h"
 
diff --git a/libxcmd/input.c b/libxcmd/input.c
index e3fa626a..83b5a67d 100644
--- a/libxcmd/input.c
+++ b/libxcmd/input.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "input.h"
 #include <ctype.h>
 #include <stdbool.h>
diff --git a/libxcmd/quit.c b/libxcmd/quit.c
index 7c2d04f8..037b032c 100644
--- a/libxcmd/quit.c
+++ b/libxcmd/quit.c
@@ -4,7 +4,7 @@
  * All Rights Reserved.
  */
 
-#include "platform_defs.h"
+#include "defs.h"
 #include "command.h"
 #include "../quota/init.h"
 
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index e37d5933..2815c79f 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -38,7 +38,7 @@
 #define __LIBXFS_INTERNAL_XFS_H__
 
 #include "libxfs_api_defs.h"
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs.h"
 
 #include "list.h"
diff --git a/scrub/common.c b/scrub/common.c
index 49a87f41..66be3f18 100644
--- a/scrub/common.c
+++ b/scrub/common.c
@@ -7,7 +7,7 @@
 #include <pthread.h>
 #include <sys/statvfs.h>
 #include <syslog.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "libfrog/paths.h"
 #include "xfs_scrub.h"
 #include "common.h"
diff --git a/scrub/descr.c b/scrub/descr.c
index e694d01d..ffd57abe 100644
--- a/scrub/descr.c
+++ b/scrub/descr.c
@@ -6,7 +6,7 @@
 #include "xfs.h"
 #include <assert.h>
 #include <sys/statvfs.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "input.h"
 #include "libfrog/paths.h"
 #include "libfrog/ptvar.h"
diff --git a/scrub/disk.c b/scrub/disk.c
index a1ef798a..8bd2a36d 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -16,13 +16,13 @@
 #ifdef HAVE_HDIO_GETGEO
 # include <linux/hdreg.h>
 #endif
-#include "platform_defs.h"
+#include "defs.h"
 #include "libfrog/util.h"
 #include "libfrog/paths.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "disk.h"
-#include "platform_defs.h"
+#include "defs.h"
 
 #ifndef BLKROTATIONAL
 # define BLKROTATIONAL	_IO(0x12, 126)
diff --git a/scrub/fscounters.c b/scrub/fscounters.c
index f21b24e0..ef197687 100644
--- a/scrub/fscounters.c
+++ b/scrub/fscounters.c
@@ -7,7 +7,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <sys/statvfs.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs_arch.h"
 #include "libfrog/paths.h"
 #include "libfrog/workqueue.h"
diff --git a/scrub/inodes.c b/scrub/inodes.c
index cc73da7f..f4f154da 100644
--- a/scrub/inodes.c
+++ b/scrub/inodes.c
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <sys/statvfs.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "xfs_arch.h"
 #include "handle.h"
 #include "libfrog/paths.h"
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index bc2e84a7..afd2b3c1 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -10,7 +10,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/statvfs.h>
-#include "platform_defs.h"
+#include "defs.h"
 #include "input.h"
 #include "libfrog/paths.h"
 #include "xfs_scrub.h"
diff --git a/spaceman/health.c b/spaceman/health.c
index d83c5ccd..85a73c82 100644
--- a/spaceman/health.c
+++ b/spaceman/health.c
@@ -3,7 +3,7 @@
  * Copyright (c) 2019 Oracle.
  * All Rights Reserved.
  */
-#include "platform_defs.h"
+#include "defs.h"
 #include "libxfs.h"
 #include "command.h"
 #include "init.h"
-- 
2.31.1


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

* [PATCH 2/8] xfsprogs: Rename platform.h -> common.h
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
  2021-08-02 21:50 ` [PATCH 1/8] xfsprogs: Rename platform_defs.h.in -> defs.h.in Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 22:33   ` Darrick J. Wong
  2021-08-02 21:50 ` [PATCH 3/8] xfsprogs: remove platform_uuid_compare() Pavel Reichl
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

No other platform then linux is supported so rename to something more
common.
---
 copy/xfs_copy.c                  | 2 +-
 libfrog/{platform.h => common.h} | 0
 libfrog/topology.c               | 2 +-
 libxfs/init.c                    | 2 +-
 libxfs/rdwr.c                    | 2 +-
 repair/xfs_repair.c              | 2 +-
 6 files changed, 5 insertions(+), 5 deletions(-)
 rename libfrog/{platform.h => common.h} (100%)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index fc7d225f..c80b42d1 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -12,7 +12,7 @@
 #include <stdarg.h>
 #include "xfs_copy.h"
 #include "libxlog.h"
-#include "libfrog/platform.h"
+#include "libfrog/common.h"
 
 #define	rounddown(x, y)	(((x)/(y))*(y))
 #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
diff --git a/libfrog/platform.h b/libfrog/common.h
similarity index 100%
rename from libfrog/platform.h
rename to libfrog/common.h
diff --git a/libfrog/topology.c b/libfrog/topology.c
index b1b470c9..b059829e 100644
--- a/libfrog/topology.c
+++ b/libfrog/topology.c
@@ -11,7 +11,7 @@
 #endif /* ENABLE_BLKID */
 #include "xfs_multidisk.h"
 #include "topology.h"
-#include "platform.h"
+#include "common.h"
 
 #define TERABYTES(count, blog)	((uint64_t)(count) << (40 - (blog)))
 #define GIGABYTES(count, blog)	((uint64_t)(count) << (30 - (blog)))
diff --git a/libxfs/init.c b/libxfs/init.c
index 1ec83791..d1e87002 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -21,7 +21,7 @@
 #include "xfs_trans.h"
 #include "xfs_rmap_btree.h"
 #include "xfs_refcount_btree.h"
-#include "libfrog/platform.h"
+#include "libfrog/common.h"
 
 #include "libxfs.h"		/* for now */
 
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index fd456d6b..f8e4cf0a 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -17,7 +17,7 @@
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
-#include "libfrog/platform.h"
+#include "libfrog/common.h"
 
 #include "libxfs.h"
 
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 38406eea..af24b356 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -23,7 +23,7 @@
 #include "slab.h"
 #include "rmap.h"
 #include "libfrog/fsgeom.h"
-#include "libfrog/platform.h"
+#include "libfrog/common.h"
 #include "bulkload.h"
 #include "quotacheck.h"
 
-- 
2.31.1


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

* [PATCH 3/8] xfsprogs: remove platform_uuid_compare()
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
  2021-08-02 21:50 ` [PATCH 1/8] xfsprogs: Rename platform_defs.h.in -> defs.h.in Pavel Reichl
  2021-08-02 21:50 ` [PATCH 2/8] xfsprogs: Rename platform.h -> common.h Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 22:35   ` Darrick J. Wong
  2021-08-02 21:50 ` [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs} Pavel Reichl
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c      | 2 +-
 db/sb.c              | 2 +-
 include/linux.h      | 5 -----
 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 ++--
 10 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index c80b42d1..2a17bf38 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -15,7 +15,7 @@
 #include "libfrog/common.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/include/linux.h b/include/linux.h
index a22f7812..9c7ea189 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -85,11 +85,6 @@ static __inline__ void platform_getoptreset(void)
 	optind = 0;
 }
 
-static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
-{
-	return uuid_compare(*uu1, *uu2);
-}
-
 static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
 {
 	uuid_unparse(*uu, buffer);
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 2815c79f..22b4f606 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] 16+ messages in thread

* [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (2 preceding siblings ...)
  2021-08-02 21:50 ` [PATCH 3/8] xfsprogs: remove platform_uuid_compare() Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 22:31   ` Darrick J. Wong
  2021-08-02 21:50 ` [PATCH 5/8] xfsprogs: Rename platform_getoptreset -> getoptreset Pavel Reichl
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c     | 4 ++--
 fsr/xfs_fsr.c       | 2 +-
 growfs/xfs_growfs.c | 2 +-
 include/linux.h     | 9 ++-------
 io/init.c           | 2 +-
 io/open.c           | 4 ++--
 io/stat.c           | 2 +-
 libfrog/paths.c     | 2 +-
 quota/free.c        | 2 +-
 spaceman/init.c     | 2 +-
 10 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 2a17bf38..4872621d 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/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/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 9c7ea189..bef4ea00 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,7 +60,7 @@ static __inline__ int platform_test_xfs_fd(int fd)
 	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
 }
 
-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;
@@ -74,11 +74,6 @@ static __inline__ int platform_test_xfs_path(const char *path)
 	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
 }
 
-static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
-{
-	return fstatfs(fd, buf);
-}
-
 static __inline__ void platform_getoptreset(void)
 {
 	extern int optind;
diff --git a/io/init.c b/io/init.c
index 0fbc703e..15df0c03 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/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/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;
 
 	/*
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;
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] 16+ messages in thread

* [PATCH 5/8] xfsprogs: Rename platform_getoptreset -> getoptreset
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (3 preceding siblings ...)
  2021-08-02 21:50 ` [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs} Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 21:50 ` [PATCH 6/8] xfsprogs: remove all platform_ prefixes in linux.h Pavel Reichl
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

---
 db/command.c      | 2 +-
 include/linux.h   | 2 +-
 libxcmd/command.c | 2 +-
 3 files changed, 3 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 bef4ea00..1905640f 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -74,7 +74,7 @@ static __inline__ int test_xfs_path(const char *path)
 	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
 }
 
-static __inline__ void platform_getoptreset(void)
+static __inline__ void getoptreset(void)
 {
 	extern int optind;
 	optind = 0;
diff --git a/libxcmd/command.c b/libxcmd/command.c
index 7e37a9d6..610b3e0c 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] 16+ messages in thread

* [PATCH 6/8] xfsprogs: remove all platform_ prefixes in linux.h
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (4 preceding siblings ...)
  2021-08-02 21:50 ` [PATCH 5/8] xfsprogs: Rename platform_getoptreset -> getoptreset Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 21:50 ` [PATCH 7/8] xfsprogs: Remove platform_ prefixes in libfrog/common.h Pavel Reichl
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c             | 10 +++++-----
 db/fprint.c                 |  2 +-
 db/sb.c                     | 12 ++++++------
 include/linux.h             | 30 ------------------------------
 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 +-
 libxlog/util.c              |  6 +++---
 logprint/log_misc.c         |  2 +-
 mkfs/xfs_mkfs.c             | 12 ++++++------
 repair/agheader.c           | 12 ++++++------
 repair/dinode.c             |  2 +-
 repair/phase5.c             |  6 +++---
 25 files changed, 52 insertions(+), 83 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 4872621d..f06a1557 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))
@@ -946,9 +946,9 @@ 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
-			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/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 7017e1e5..63f43ea4 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -386,9 +386,9 @@ uuid_f(
 		}
 
 		if (!strcasecmp(argv[1], "generate")) {
-			platform_uuid_generate(&uu);
+			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) {
@@ -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;
@@ -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;
 			}
@@ -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/include/linux.h b/include/linux.h
index 1905640f..a12ccee1 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -80,36 +80,6 @@ static __inline__ void getoptreset(void)
 	optind = 0;
 }
 
-static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
-{
-	uuid_unparse(*uu, buffer);
-}
-
-static __inline__ int platform_uuid_parse(const char *buffer, uuid_t *uu)
-{
-	return uuid_parse(buffer, *uu);
-}
-
-static __inline__ int platform_uuid_is_null(uuid_t *uu)
-{
-	return uuid_is_null(*uu);
-}
-
-static __inline__ void platform_uuid_generate(uuid_t *uu)
-{
-	uuid_generate(*uu);
-}
-
-static __inline__ void platform_uuid_clear(uuid_t *uu)
-{
-	uuid_clear(*uu);
-}
-
-static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
-{
-	uuid_copy(*dst, *src);
-}
-
 #ifndef BLKDISCARD
 #define BLKDISCARD	_IO(0x12,119)
 #endif
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 22b4f606..454df465 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/libxlog/util.c b/libxlog/util.c
index b4dfeca0..84c6f99a 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"),
@@ -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/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/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index f84a42f9..c6929a83 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:
@@ -2191,8 +2191,8 @@ _("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))
-		platform_uuid_copy(&cfg->uuid, &cli->uuid);
+	if (!uuid_is_null(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;
@@ -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);
diff --git a/repair/agheader.c b/repair/agheader.c
index 1c4138e4..7e596a66 100644
--- a/repair/agheader.c
+++ b/repair/agheader.c
@@ -104,12 +104,12 @@ 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)
-			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;
 }
@@ -183,12 +183,12 @@ 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)
-			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] 16+ messages in thread

* [PATCH 7/8] xfsprogs: Remove platform_ prefixes in libfrog/common.h
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (5 preceding siblings ...)
  2021-08-02 21:50 ` [PATCH 6/8] xfsprogs: remove all platform_ prefixes in linux.h Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 21:50 ` [PATCH 8/8] xfsprogs: remove platform_ from man xfsctl man page Pavel Reichl
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

---
 copy/xfs_copy.c           |  8 ++++----
 fsr/xfs_fsr.c             |  6 +++---
 include/defs.h.in         |  2 +-
 include/linux.h           | 16 ++++++++--------
 libfrog/common.h          | 24 ++++++++++++------------
 libfrog/linux.c           | 28 ++++++++++++++--------------
 libfrog/topology.c        |  6 +++---
 libxfs/init.c             | 32 ++++++++++++++++----------------
 libxfs/libxfs_io.h        |  2 +-
 libxfs/rdwr.c             |  4 ++--
 mdrestore/xfs_mdrestore.c |  4 ++--
 mkfs/xfs_mkfs.c           | 10 +++++-----
 repair/phase4.c           |  6 +++---
 repair/prefetch.c         |  2 +-
 repair/slab.c             |  2 +-
 repair/xfs_repair.c       |  6 +++---
 scrub/disk.c              |  2 +-
 17 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index f06a1557..d5561ac8 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;
@@ -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;
@@ -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/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 25eb2e12..42f477e8 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -314,12 +314,12 @@ 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);
 	}
 
-	while ((mnt = platform_mntent_next(&cursor)) != NULL) {
+	while ((mnt = mntent_next(&cursor)) != NULL) {
 		int rw = 0;
 
 		if (strcmp(mnt->mnt_type, MNTTYPE_XFS ) != 0 ||
@@ -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/defs.h.in b/include/defs.h.in
index ce0c1a0e..fcf27331 100644
--- a/include/defs.h.in
+++ b/include/defs.h.in
@@ -78,7 +78,7 @@ typedef unsigned short umode_t;
 # define ASSERT(EX)	((void) 0)
 #endif
 
-extern int	platform_nproc(void);
+extern int	libfrog_nproc(void);
 
 #define NSEC_PER_SEC	(1000000000ULL)
 #define NSEC_PER_USEC	(1000ULL)
diff --git a/include/linux.h b/include/linux.h
index a12ccee1..da74ae53 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -41,7 +41,7 @@ static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
 }
 
 /*
- * platform_test_xfs_*() implies that xfsctl will succeed on the file;
+ * test_xfs_*() implies that xfsctl will succeed on the file;
  * on Linux, at least, special files don't get xfs file ops,
  * so return 0 for those
  */
@@ -85,7 +85,7 @@ static __inline__ void getoptreset(void)
 #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 };
 
@@ -111,7 +111,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) {
@@ -121,19 +121,19 @@ static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab
 	return 0;
 }
 
-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 void platform_mntent_close(struct mntent_cursor * cursor)
+static inline void mntent_close(struct mntent_cursor * cursor)
 {
 	endmntent(cursor->mtabp);
 }
 
 #if defined(FALLOC_FL_ZERO_RANGE)
 static inline int
-platform_zero_range(
+zero_range(
 	int		fd,
 	xfs_off_t	start,
 	size_t		len)
@@ -146,7 +146,7 @@ platform_zero_range(
 	return -errno;
 }
 #else
-#define platform_zero_range(fd, s, l)	(-EOPNOTSUPP)
+#define zero_range(fd, s, l)	(-EOPNOTSUPP)
 #endif
 
 /*
@@ -154,7 +154,7 @@ platform_zero_range(
  * atexit handlers.
  */
 static inline void
-platform_crash(void)
+crash(void)
 {
 	kill(getpid(), SIGKILL);
 	assert(0);
diff --git a/libfrog/common.h b/libfrog/common.h
index 0aef318a..4d1d5861 100644
--- a/libfrog/common.h
+++ b/libfrog/common.h
@@ -7,20 +7,20 @@
 #ifndef __LIBFROG_PLATFORM_H__
 #define __LIBFROG_PLATFORM_H__
 
-int platform_check_ismounted(char *path, char *block, struct stat *sptr,
+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 check_iswritable(char *path, char *block, struct stat *sptr);
+int set_blocksize(int fd, char *path, dev_t device, int bsz,
 		int fatal);
-int platform_flush_device(int fd, dev_t device);
-char *platform_findrawpath(char *path);
-char *platform_findblockpath(char *path);
-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);
-int platform_nproc(void);
+int flush_device(int fd, dev_t device);
+char *findrawpath(char *path);
+char *findblockpath(char *path);
+int direct_blockdev(void);
+int align_blockdev(void);
+unsigned long physmem(void);	/* in kilobytes */
+void findsizes(char *path, int fd, long long *sz, int *bsz);
+int libfrog_nproc(void);
 
-void platform_findsizes(char *path, int fd, long long *sz, int *bsz);
+void findsizes(char *path, int fd, long long *sz, int *bsz);
 
 #endif /* __LIBFROG_PLATFORM_H__ */
diff --git a/libfrog/linux.c b/libfrog/linux.c
index ea69b29b..7f4e2a0d 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;
@@ -108,26 +108,26 @@ _("%s: %s contains a mounted filesystem\n"),
 }
 
 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;
 
 	flags = verbose ? CHECK_MOUNT_VERBOSE : 0;
-	return platform_check_mount(name, block, s, flags);
+	return check_mount(name, block, s, flags);
 }
 
 int
-platform_check_iswritable(char *name, char *block, struct stat *s)
+check_iswritable(char *name, char *block, struct stat *s)
 {
 	int flags;
 
 	/* 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
-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;
 
@@ -147,7 +147,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)
 {
@@ -172,7 +172,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;
@@ -232,25 +232,25 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz)
 }
 
 char *
-platform_findrawpath(char *path)
+findrawpath(char *path)
 {
 	return path;
 }
 
 char *
-platform_findblockpath(char *path)
+findblockpath(char *path)
 {
 	return path;
 }
 
 int
-platform_direct_blockdev(void)
+direct_blockdev(void)
 {
 	return 1;
 }
 
 int
-platform_align_blockdev(void)
+align_blockdev(void)
 {
 	if (!max_block_alignment)
 		return getpagesize();
@@ -259,7 +259,7 @@ platform_align_blockdev(void)
 
 /* How many CPUs are online? */
 int
-platform_nproc(void)
+libfrog_nproc(void)
 {
 	long nproc = sysconf(_SC_NPROCESSORS_ONLN);
 
@@ -271,7 +271,7 @@ platform_nproc(void)
 }
 
 unsigned long
-platform_physmem(void)
+physmem(void)
 {
 	struct sysinfo  si;
 
diff --git a/libfrog/topology.c b/libfrog/topology.c
index b059829e..d6e3aa32 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 d1e87002..120714c9 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -59,9 +59,9 @@ 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))
+	if (check_iswritable(name, block, &st))
 		return fatal ? 1 : 0;
 	return 0;
 }
@@ -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) | \
@@ -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);
 		}
 	}
@@ -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,
@@ -200,19 +200,19 @@ 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);
 		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);
 		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)))
@@ -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
@@ -1030,7 +1030,7 @@ libxfs_destroy(
 int
 libxfs_device_alignment(void)
 {
-	return platform_align_blockdev();
+	return align_blockdev();
 }
 
 void
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/libxfs/rdwr.c b/libxfs/rdwr.c
index f8e4cf0a..85094fe6 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;
@@ -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;
 }
 
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]);
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index c6929a83..ffa79b86 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)
+mkfs_discard_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);
+		mkfs_discard_blocks(xi->ddev, xi->dsize, quiet);
 	if (xi->rtdev && !xi->risfile)
-		discard_blocks(xi->rtdev, xi->rtsize, quiet);
+		mkfs_discard_blocks(xi->rtdev, xi->rtsize, quiet);
 	if (xi->logdev && xi->logdev != xi->ddev && !xi->lisfile)
-		discard_blocks(xi->logdev, xi->logBBsize, quiet);
+		mkfs_discard_blocks(xi->logdev, xi->logBBsize, quiet);
 }
 
 static void
diff --git a/repair/phase4.c b/repair/phase4.c
index 191b4842..1d509187 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, libfrog_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, libfrog_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, libfrog_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..57d5e631 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, libfrog_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..996f9d80 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, libfrog_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 af24b356..a112b424 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
@@ -1030,7 +1030,7 @@ main(int argc, char **argv)
 	}
 
 	if (ag_stride) {
-		int max_threads = platform_nproc() * 8;
+		int max_threads = libfrog_nproc() * 8;
 
 		thread_count = (glob_agcount + ag_stride - 1) / ag_stride;
 		while (thread_count > max_threads) {
@@ -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) {
diff --git a/scrub/disk.c b/scrub/disk.c
index 8bd2a36d..f6d37b46 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -43,7 +43,7 @@ __disk_heads(
 {
 	int			iomin;
 	int			ioopt;
-	int			nproc = platform_nproc();
+	int			nproc = libfrog_nproc();
 	unsigned short		rot;
 	int			error;
 
-- 
2.31.1


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

* [PATCH 8/8] xfsprogs: remove platform_ from man xfsctl man page
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (6 preceding siblings ...)
  2021-08-02 21:50 ` [PATCH 7/8] xfsprogs: Remove platform_ prefixes in libfrog/common.h Pavel Reichl
@ 2021-08-02 21:50 ` Pavel Reichl
  2021-08-02 22:24 ` [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Darrick J. Wong
  2021-08-23 22:45 ` Eric Sandeen
  9 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-02 21:50 UTC (permalink / raw)
  To: linux-xfs

---
 man/man3/xfsctl.3 | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/man/man3/xfsctl.3 b/man/man3/xfsctl.3
index 43c2f4eb..dc260bae 100644
--- a/man/man3/xfsctl.3
+++ b/man/man3/xfsctl.3
@@ -6,9 +6,9 @@ xfsctl \- control XFS filesystems and individual files
 .HP
 .BI "int\ xfsctl(const char *" path ", int " fd ", int " cmd ", void *" ptr );
 .PP
-.BI "int platform_test_xfs_fd(int " fd );
+.BI "int test_xfs_fd(int " fd );
 .br
-.BI "int platform_test_xfs_path(const char *" path );
+.BI "int test_xfs_path(const char *" path );
 .SH DESCRIPTION
 Some functionality specific to the XFS filesystem is accessible to
 applications through platform-specific system call interfaces.
@@ -24,11 +24,6 @@ and
 .BR fstatfs (2)
 system calls can be used to determine whether or not an arbitrary
 path or file descriptor belong to an XFS filesystem.
-These are not portable however, so the routines
-.BR platform_test_xfs_fd ()
-and
-.BR platform_test_xfs_path ()
-provide a platform-independent mechanism.
 .SS File Operations
 In order to effect an operation on an individual file, the pathname
 and descriptor arguments passed to
-- 
2.31.1


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

* Re: [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (7 preceding siblings ...)
  2021-08-02 21:50 ` [PATCH 8/8] xfsprogs: remove platform_ from man xfsctl man page Pavel Reichl
@ 2021-08-02 22:24 ` Darrick J. Wong
  2021-08-23 22:45 ` Eric Sandeen
  9 siblings, 0 replies; 16+ messages in thread
From: Darrick J. Wong @ 2021-08-02 22:24 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: linux-xfs

On Mon, Aug 02, 2021 at 11:50:16PM +0200, Pavel Reichl wrote:
> Hi,
> 
> Eric recently suggested that removing prefix 'platform_' from function
> names in xfsprogs could be a good idea.

Please turn on column wrapping for email...

> It seems to be a relict from times when support from other OSes was
> expected. Since it does not seem to happen it might be a good idea to
> remove the prefix and thus simplify the codebase a bit.
> 
> The core of the changes is in removing 'platform' wrappers around
> standard linux calls and fixing the passed parameters from pointers to
> actual values (if appropriate) e.g.
> 
> -static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
> -{
> -	uuid_copy(*dst, *src);
> -}
> ... 
> -		platform_uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
> +		uuid_copy(hdr3->uuid, mp->m_sb.sb_meta_uuid);
> 
> 
> 
> I attached first WIP version (that builds and passes my limited
> testing) to show the scope of changes and find consensus about some
> choices that need to be done:
> 
>  * Is renaming platform_defs.h.in -> defs.h.in OK?
>  * is renaming libfrog/platform.h -> libfrog/common.h OK, maybe
>  libfrog/libfrog.h is better?
>  * Wrapper platform_nproc() defined in/libfrog/linux.c slightly
>  changes the behavior of nproc() is renaming it to libfrog_nproc() OK?

Not sure what "nproc()" is?  Are you asking if it's ok to rename
platform_nproc to libfrog_nproc because it's not just a straight wrapper
of "sysconf(_SC_NPROCESSORS_ONLN)"?

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

--D

>  
> Thanks! 
> 
> Pavel Reichl (8):
>   xfsprogs: Rename platform_defs.h.in -> defs.h.in
>   xfsprogs: Rename platform.h -> common.h
>   xfsprogs: remove platform_uuid_compare()
>   xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
>   xfsprogs: Rename platform_getoptreset -> getoptreset
>   xfsprogs: remove all platform_ prefixes in linux.h
>   xfsprogs: Remove platform_ prefixes in libfrog/common.h
>   xfsprogs: remove platform_ from man xfsctl man page
> 
>  .gitignore                                |  2 +-
>  Makefile                                  | 10 ++--
>  configure.ac                              |  2 +-
>  copy/xfs_copy.c                           | 26 +++++-----
>  db/command.c                              |  2 +-
>  db/fprint.c                               |  2 +-
>  db/sb.c                                   | 14 ++---
>  debian/rules                              |  4 +-
>  fsr/xfs_fsr.c                             |  8 +--
>  growfs/xfs_growfs.c                       |  2 +-
>  include/Makefile                          |  4 +-
>  include/{platform_defs.h.in => defs.h.in} |  8 +--
>  include/libxfs.h                          |  2 +-
>  include/linux.h                           | 62 ++++-------------------
>  io/bmap.c                                 |  2 +-
>  io/bulkstat.c                             |  2 +-
>  io/cowextsize.c                           |  2 +-
>  io/crc32cselftest.c                       |  2 +-
>  io/encrypt.c                              |  2 +-
>  io/fiemap.c                               |  2 +-
>  io/fsmap.c                                |  2 +-
>  io/fsync.c                                |  2 +-
>  io/init.c                                 |  4 +-
>  io/label.c                                |  2 +-
>  io/log_writes.c                           |  2 +-
>  io/open.c                                 |  4 +-
>  io/stat.c                                 |  2 +-
>  io/sync.c                                 |  2 +-
>  libfrog/avl64.c                           |  2 +-
>  libfrog/bitmap.c                          |  2 +-
>  libfrog/common.h                          | 26 ++++++++++
>  libfrog/convert.c                         |  2 +-
>  libfrog/crc32.c                           |  2 +-
>  libfrog/fsgeom.c                          |  2 +-
>  libfrog/linux.c                           | 30 +++++------
>  libfrog/paths.c                           |  2 +-
>  libfrog/paths.h                           |  2 +-
>  libfrog/platform.h                        | 26 ----------
>  libfrog/projects.h                        |  2 +-
>  libfrog/ptvar.c                           |  2 +-
>  libfrog/radix-tree.c                      |  2 +-
>  libfrog/topology.c                        |  8 +--
>  libfrog/util.c                            |  2 +-
>  libhandle/handle.c                        |  2 +-
>  libhandle/jdm.c                           |  2 +-
>  libxcmd/command.c                         |  4 +-
>  libxcmd/help.c                            |  2 +-
>  libxcmd/input.c                           |  2 +-
>  libxcmd/quit.c                            |  2 +-
>  libxfs/init.c                             | 34 ++++++-------
>  libxfs/libxfs_io.h                        |  2 +-
>  libxfs/libxfs_priv.h                      |  5 +-
>  libxfs/rdwr.c                             |  6 +--
>  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 +-
>  man/man3/xfsctl.3                         |  9 +---
>  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                       |  8 +--
>  scrub/common.c                            |  2 +-
>  scrub/descr.c                             |  2 +-
>  scrub/disk.c                              |  6 +--
>  scrub/fscounters.c                        |  2 +-
>  scrub/inodes.c                            |  2 +-
>  scrub/xfs_scrub.c                         |  2 +-
>  spaceman/health.c                         |  2 +-
>  spaceman/init.c                           |  2 +-
>  91 files changed, 235 insertions(+), 281 deletions(-)
>  rename include/{platform_defs.h.in => defs.h.in} (95%)
>  create mode 100644 libfrog/common.h
>  delete mode 100644 libfrog/platform.h
> 
> -- 
> 2.31.1
> 

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

* Re: [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
  2021-08-02 21:50 ` [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs} Pavel Reichl
@ 2021-08-02 22:31   ` Darrick J. Wong
  0 siblings, 0 replies; 16+ messages in thread
From: Darrick J. Wong @ 2021-08-02 22:31 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: linux-xfs

On Mon, Aug 02, 2021 at 11:50:20PM +0200, Pavel Reichl wrote:
> ---
>  copy/xfs_copy.c     | 4 ++--
>  fsr/xfs_fsr.c       | 2 +-
>  growfs/xfs_growfs.c | 2 +-
>  include/linux.h     | 9 ++-------
>  io/init.c           | 2 +-
>  io/open.c           | 4 ++--
>  io/stat.c           | 2 +-
>  libfrog/paths.c     | 2 +-
>  quota/free.c        | 2 +-
>  spaceman/init.c     | 2 +-
>  10 files changed, 13 insertions(+), 18 deletions(-)
> 
> diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> index 2a17bf38..4872621d 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/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/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 9c7ea189..bef4ea00 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,7 +60,7 @@ static __inline__ int platform_test_xfs_fd(int fd)
>  	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
>  }
>  
> -static __inline__ int platform_test_xfs_path(const char *path)
> +static __inline__ int test_xfs_path(const char *path)

These ship in the userspace development headers package (xfslibs-dev),
which means they're part of userspace ABI and cannot be renamed without
breaking userspace programs such as xfsdump.

--D

>  {
>  	struct statfs statfsbuf;
>  	struct stat statbuf;
> @@ -74,11 +74,6 @@ static __inline__ int platform_test_xfs_path(const char *path)
>  	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
>  }
>  
> -static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
> -{
> -	return fstatfs(fd, buf);
> -}
> -
>  static __inline__ void platform_getoptreset(void)
>  {
>  	extern int optind;
> diff --git a/io/init.c b/io/init.c
> index 0fbc703e..15df0c03 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/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/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;
>  
>  	/*
> 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;
> 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	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/8] xfsprogs: Rename platform.h -> common.h
  2021-08-02 21:50 ` [PATCH 2/8] xfsprogs: Rename platform.h -> common.h Pavel Reichl
@ 2021-08-02 22:33   ` Darrick J. Wong
  2021-08-03 16:15     ` Pavel Reichl
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2021-08-02 22:33 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: linux-xfs

On Mon, Aug 02, 2021 at 11:50:18PM +0200, Pavel Reichl wrote:
> No other platform then linux is supported so rename to something more
> common.
> ---
>  copy/xfs_copy.c                  | 2 +-
>  libfrog/{platform.h => common.h} | 0

This is confusing, we already have a scrub/common.h.  Renaming files
breaks git blame; why change them?

--D

>  libfrog/topology.c               | 2 +-
>  libxfs/init.c                    | 2 +-
>  libxfs/rdwr.c                    | 2 +-
>  repair/xfs_repair.c              | 2 +-
>  6 files changed, 5 insertions(+), 5 deletions(-)
>  rename libfrog/{platform.h => common.h} (100%)
> 
> diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> index fc7d225f..c80b42d1 100644
> --- a/copy/xfs_copy.c
> +++ b/copy/xfs_copy.c
> @@ -12,7 +12,7 @@
>  #include <stdarg.h>
>  #include "xfs_copy.h"
>  #include "libxlog.h"
> -#include "libfrog/platform.h"
> +#include "libfrog/common.h"
>  
>  #define	rounddown(x, y)	(((x)/(y))*(y))
>  #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
> diff --git a/libfrog/platform.h b/libfrog/common.h
> similarity index 100%
> rename from libfrog/platform.h
> rename to libfrog/common.h
> diff --git a/libfrog/topology.c b/libfrog/topology.c
> index b1b470c9..b059829e 100644
> --- a/libfrog/topology.c
> +++ b/libfrog/topology.c
> @@ -11,7 +11,7 @@
>  #endif /* ENABLE_BLKID */
>  #include "xfs_multidisk.h"
>  #include "topology.h"
> -#include "platform.h"
> +#include "common.h"
>  
>  #define TERABYTES(count, blog)	((uint64_t)(count) << (40 - (blog)))
>  #define GIGABYTES(count, blog)	((uint64_t)(count) << (30 - (blog)))
> diff --git a/libxfs/init.c b/libxfs/init.c
> index 1ec83791..d1e87002 100644
> --- a/libxfs/init.c
> +++ b/libxfs/init.c
> @@ -21,7 +21,7 @@
>  #include "xfs_trans.h"
>  #include "xfs_rmap_btree.h"
>  #include "xfs_refcount_btree.h"
> -#include "libfrog/platform.h"
> +#include "libfrog/common.h"
>  
>  #include "libxfs.h"		/* for now */
>  
> diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
> index fd456d6b..f8e4cf0a 100644
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -17,7 +17,7 @@
>  #include "xfs_inode_fork.h"
>  #include "xfs_inode.h"
>  #include "xfs_trans.h"
> -#include "libfrog/platform.h"
> +#include "libfrog/common.h"
>  
>  #include "libxfs.h"
>  
> diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> index 38406eea..af24b356 100644
> --- a/repair/xfs_repair.c
> +++ b/repair/xfs_repair.c
> @@ -23,7 +23,7 @@
>  #include "slab.h"
>  #include "rmap.h"
>  #include "libfrog/fsgeom.h"
> -#include "libfrog/platform.h"
> +#include "libfrog/common.h"
>  #include "bulkload.h"
>  #include "quotacheck.h"
>  
> -- 
> 2.31.1
> 

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

* Re: [PATCH 3/8] xfsprogs: remove platform_uuid_compare()
  2021-08-02 21:50 ` [PATCH 3/8] xfsprogs: remove platform_uuid_compare() Pavel Reichl
@ 2021-08-02 22:35   ` Darrick J. Wong
  2021-08-03 16:07     ` Pavel Reichl
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2021-08-02 22:35 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: linux-xfs

On Mon, Aug 02, 2021 at 11:50:19PM +0200, Pavel Reichl wrote:
> ---
>  copy/xfs_copy.c      | 2 +-
>  db/sb.c              | 2 +-
>  include/linux.h      | 5 -----

It's fine to change the platform_uuid_compare usages inside xfsprogs
itself, but linux.h is shipped as part of the development headers, which
means that you can't get rid of the wrapper functions without causing
build problems for other userspace programs.

--D

>  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 ++--
>  10 files changed, 13 insertions(+), 18 deletions(-)
> 
> diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> index c80b42d1..2a17bf38 100644
> --- a/copy/xfs_copy.c
> +++ b/copy/xfs_copy.c
> @@ -15,7 +15,7 @@
>  #include "libfrog/common.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/include/linux.h b/include/linux.h
> index a22f7812..9c7ea189 100644
> --- a/include/linux.h
> +++ b/include/linux.h
> @@ -85,11 +85,6 @@ static __inline__ void platform_getoptreset(void)
>  	optind = 0;
>  }
>  
> -static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
> -{
> -	return uuid_compare(*uu1, *uu2);
> -}
> -
>  static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
>  {
>  	uuid_unparse(*uu, buffer);
> diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
> index 2815c79f..22b4f606 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	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/8] xfsprogs: remove platform_uuid_compare()
  2021-08-02 22:35   ` Darrick J. Wong
@ 2021-08-03 16:07     ` Pavel Reichl
  0 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-03 16:07 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs


On 8/3/21 12:35 AM, Darrick J. Wong wrote:
> On Mon, Aug 02, 2021 at 11:50:19PM +0200, Pavel Reichl wrote:
>> ---
>>   copy/xfs_copy.c      | 2 +-
>>   db/sb.c              | 2 +-
>>   include/linux.h      | 5 -----
> It's fine to change the platform_uuid_compare usages inside xfsprogs
> itself, but linux.h is shipped as part of the development headers, which
> means that you can't get rid of the wrapper functions without causing
> build problems for other userspace programs.
>
> --D
>
OK, maybe it would be best to split the effort into more steps:

1) A patchset that stops using platform_* functions and replace them 
with standard linux calls inside xfsprogs

2) A patchset that adds deprecation warnings into publicly visible 
platform_*() calls

3) Fix userspace programs now using the deprecated functions

4) Remove completely platform_*() functions from xfsprogs

Would that be a suitable path?

Thanks!


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

* Re: [PATCH 2/8] xfsprogs: Rename platform.h -> common.h
  2021-08-02 22:33   ` Darrick J. Wong
@ 2021-08-03 16:15     ` Pavel Reichl
  0 siblings, 0 replies; 16+ messages in thread
From: Pavel Reichl @ 2021-08-03 16:15 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs


On 8/3/21 12:33 AM, Darrick J. Wong wrote:
> On Mon, Aug 02, 2021 at 11:50:18PM +0200, Pavel Reichl wrote:
>> No other platform then linux is supported so rename to something more
>> common.
>> ---
>>   copy/xfs_copy.c                  | 2 +-
>>   libfrog/{platform.h => common.h} | 0
> This is confusing, we already have a scrub/common.h.  Renaming files
> breaks git blame; why change them?
>
I wanted to rename the file because it contains functions that were 
supposed to be multi-platform (at least that's my understanding) but it 
never became the case. So since we are trying to get rid of the obsolete 
'platform_' prefix I thought that more proper name for the file should 
be chosen. However, I respect the git blame consideration and I'm fine 
with keeping the name.


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

* Re: [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix
  2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
                   ` (8 preceding siblings ...)
  2021-08-02 22:24 ` [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Darrick J. Wong
@ 2021-08-23 22:45 ` Eric Sandeen
  9 siblings, 0 replies; 16+ messages in thread
From: Eric Sandeen @ 2021-08-23 22:45 UTC (permalink / raw)
  To: Pavel Reichl, linux-xfs

On 8/2/21 4:50 PM, Pavel Reichl wrote:
> Hi,
> 
> Eric recently suggested that removing prefix 'platform_' from function names in xfsprogs could be a good idea.

So, that wasn't *quite* what I had in mind. I'm less worried about function
names, and more interested in getting rid of indirections that have become
pointless after we removed the other "platforms" (irix, bsd, osx)

For example:

char *
platform_findrawpath(char *path)
{
         return path;
}

char *
platform_findblockpath(char *path)
{
         return path;
}

int
platform_direct_blockdev(void)
{
         return 1;
}

Those did something more interesting or complex under some other OS, but for
the code today, they're just pointless and confusing.  So my suggestion is
to remove them (and anything similarly pointless) to make the code less
confusing.

Later on if we want to remove the "platform_" namespace altogether that might
be fine but for now, let's just remove the silly stuff like shown above.

Thanks,
-Eric

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

end of thread, other threads:[~2021-08-23 22:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 21:50 [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
2021-08-02 21:50 ` [PATCH 1/8] xfsprogs: Rename platform_defs.h.in -> defs.h.in Pavel Reichl
2021-08-02 21:50 ` [PATCH 2/8] xfsprogs: Rename platform.h -> common.h Pavel Reichl
2021-08-02 22:33   ` Darrick J. Wong
2021-08-03 16:15     ` Pavel Reichl
2021-08-02 21:50 ` [PATCH 3/8] xfsprogs: remove platform_uuid_compare() Pavel Reichl
2021-08-02 22:35   ` Darrick J. Wong
2021-08-03 16:07     ` Pavel Reichl
2021-08-02 21:50 ` [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs} Pavel Reichl
2021-08-02 22:31   ` Darrick J. Wong
2021-08-02 21:50 ` [PATCH 5/8] xfsprogs: Rename platform_getoptreset -> getoptreset Pavel Reichl
2021-08-02 21:50 ` [PATCH 6/8] xfsprogs: remove all platform_ prefixes in linux.h Pavel Reichl
2021-08-02 21:50 ` [PATCH 7/8] xfsprogs: Remove platform_ prefixes in libfrog/common.h Pavel Reichl
2021-08-02 21:50 ` [PATCH 8/8] xfsprogs: remove platform_ from man xfsctl man page Pavel Reichl
2021-08-02 22:24 ` [PATCH 0/8] xfsprogs: Drop the 'platform_' prefix Darrick J. Wong
2021-08-23 22:45 ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.