xfsprogs: Drop the 'platform_' prefix
cover xfsprogs: Drop the 'platform_' prefix
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.hSignature · 1 line
2.31.1
PATCH 1/8 xfsprogs: Rename platform_defs.h.in -> defs.h.in
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%).gitignore +1 -1
@@ -6,7 +6,7 @@ # build system .census .gitcensus -/include/platform_defs.h +/include/defs.h /include/builddefs /install-sh
Makefile +5 -5
@@ -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
configure.ac +1 -1
@@ -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
debian/rules +2 -2
@@ -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; \
include/Makefile +2 -2
@@ -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
include/defs.h.in renamed from include/platform_defs.h.in +3 -3
@@ -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__ */
include/libxfs.h +1 -1
@@ -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"
io/bmap.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "input.h" #include "init.h"
io/bulkstat.c +1 -1
@@ -4,7 +4,7 @@* Author: Darrick J. Wong <[email protected]> */ #include "xfs.h" -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "init.h" #include "libfrog/logging.h"
io/cowextsize.c +1 -1
@@ -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"
io/crc32cselftest.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "init.h" #include "io.h"
io/encrypt.c +1 -1
@@ -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"
io/fiemap.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "input.h" #include <linux/fiemap.h>
io/fsmap.c +1 -1
@@ -3,7 +3,7 @@* Copyright (C) 2017 Oracle. All Rights Reserved. * Author: Darrick J. Wong <[email protected]> */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "init.h" #include "libfrog/paths.h"
io/fsync.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "init.h" #include "io.h"
io/init.c +1 -1
@@ -5,7 +5,7 @@*/ #include <pthread.h> -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "input.h" #include "init.h"
io/label.c +1 -1
@@ -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"
io/log_writes.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include <libdevmapper.h> #include "command.h" #include "init.h"
io/sync.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "init.h" #include "io.h"
libfrog/avl64.c +1 -1
@@ -5,7 +5,7 @@*/ #include <stdint.h> #include <stdio.h> -#include "platform_defs.h" +#include "defs.h" #include "avl64.h" #define CERT ASSERT
libfrog/bitmap.c +1 -1
@@ -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"
libfrog/convert.c +1 -1
@@ -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>
libfrog/crc32.c +1 -1
@@ -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"
libfrog/fsgeom.c +1 -1
@@ -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"
libfrog/linux.c +1 -1
@@ -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"
libfrog/paths.h +1 -1
@@ -6,7 +6,7 @@#ifndef __LIBFROG_PATH_H__#define __LIBFROG_PATH_H__ -#include "platform_defs.h" +#include "defs.h" /* * XFS Filesystem Paths
libfrog/projects.h +1 -1
@@ -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);
libfrog/ptvar.c +1 -1
@@ -10,7 +10,7 @@#include <assert.h> #include <pthread.h> #include <unistd.h> -#include "platform_defs.h" +#include "defs.h" #include "ptvar.h" /*
libfrog/radix-tree.c +1 -1
@@ -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
libfrog/util.c +1 -1
@@ -3,7 +3,7 @@* Copyright (c) 2000-2005 Silicon Graphics, Inc. * All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "util.h" /*
libhandle/handle.c +1 -1
@@ -5,7 +5,7 @@*/ #include <libgen.h> -#include "platform_defs.h" +#include "defs.h" #include "xfs.h" #include "handle.h" #include "parent.h"
libhandle/jdm.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "xfs.h" #include "handle.h" #include "jdm.h"
libxcmd/command.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "input.h"
libxcmd/help.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "../quota/init.h"
libxcmd/input.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "input.h" #include <ctype.h> #include <stdbool.h>
libxcmd/quit.c +1 -1
@@ -4,7 +4,7 @@* All Rights Reserved. */ -#include "platform_defs.h" +#include "defs.h" #include "command.h" #include "../quota/init.h"
libxfs/libxfs_priv.h +1 -1
@@ -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"
scrub/common.c +1 -1
@@ -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"
scrub/descr.c +1 -1
@@ -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"
scrub/disk.c +2 -2
@@ -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)
scrub/fscounters.c +1 -1
@@ -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"
scrub/inodes.c +1 -1
@@ -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"
scrub/xfs_scrub.c +1 -1
@@ -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"
spaceman/health.c +1 -1
@@ -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"
Signature · 1 line
2.31.1
PATCH 2/8 xfsprogs: Rename platform.h -> common.h
In reply to Pavel ReichlNo 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%)copy/xfs_copy.c +1 -1
@@ -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)
libfrog/common.h renamed from libfrog/platform.h +0 -0
libfrog/topology.c +1 -1
@@ -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)))
libxfs/init.c +1 -1
@@ -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 */
libxfs/rdwr.c +1 -1
@@ -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"
repair/xfs_repair.c +1 -1
@@ -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"
Signature · 1 line
2.31.1
Re: [PATCH 2/8] xfsprogs: Rename platform.h -> common.h
Quoted 5 lines · Pavel Reichl
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
Quoted 79 lines
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%)copy/xfs_copy.c +1
-1@@ -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)libfrog/common.h renamed from libfrog/platform.h +0
-0libfrog/topology.c +1
-1@@ -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)))libxfs/init.c +1
-1@@ -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 */ libxfs/rdwr.c +1
-1@@ -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" repair/xfs_repair.c +1
-1@@ -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" Signature · 1 line
2.31.1
Re: [PATCH 2/8] xfsprogs: Rename platform.h -> common.h
Quoted 9 lines · Darrick J. Wong
Quoted 5 lines · Pavel Reichl
No other platform then linux is supported so rename to something more common.
--- copy/xfs_copy.c | 2 +- libfrog/{platform.h => common.h} | 0This 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.
PATCH 3/8 xfsprogs: remove platform_uuid_compare()
In reply to Pavel Reichl--- 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(-)
copy/xfs_copy.c +1 -1
@@ -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 );
db/sb.c +1 -1
@@ -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 );
include/linux.h +0 -5
@@ -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);
libxfs/libxfs_priv.h +1 -1
@@ -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)
libxlog/util.c +1 -1
@@ -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);
repair/agheader.c +2 -2
@@ -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 ;
repair/attr_repair.c +1 -1
@@ -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);
repair/dinode.c +3 -3
@@ -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);
repair/phase6.c +1 -1
@@ -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);
repair/scan.c +2 -2
@@ -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);
Signature · 1 line
2.31.1
Re: [PATCH 3/8] xfsprogs: remove platform_uuid_compare()
Quoted 4 lines · Pavel Reichl
--- 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
Quoted 167 lines
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(-)copy/xfs_copy.c +1
-1@@ -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 );db/sb.c +1
-1@@ -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 );include/linux.h +0
-5@@ -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);libxfs/libxfs_priv.h +1
-1@@ -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)libxlog/util.c +1
-1@@ -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);repair/agheader.c +2
-2@@ -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 ;repair/attr_repair.c +1
-1@@ -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);repair/dinode.c +3
-3@@ -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);repair/phase6.c +1
-1@@ -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);repair/scan.c +2
-2@@ -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);Signature · 1 line
2.31.1
Re: [PATCH 3/8] xfsprogs: remove platform_uuid_compare()
Quoted 5 lines · Darrick J. Wong
Quoted 4 lines · Pavel Reichl
--- copy/xfs_copy.c | 2 +- db/sb.c | 2 +- include/linux.h | 5 -----
Quoted 7 lines
It's fine to change the
platform_uuid_compareusages inside xfsprogs itself, butlinux.his 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!
PATCH 4/8 xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
In reply to Pavel Reichl--- 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(-)
copy/xfs_copy.c +2 -2
@@ -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(
fsr/xfs_fsr.c +1 -1
@@ -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);
growfs/xfs_growfs.c +1 -1
@@ -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);
include/linux.h +2 -7
@@ -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;
io/init.c +1 -1
@@ -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 );
io/open.c +2 -2
@@ -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 ) {
io/stat.c +1 -1
@@ -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 {
libfrog/paths.c +1 -1
@@ -161,7 +161,7 @@ fs_table_insert( goto out_nodev; } -if (!platform_test_xfs_path (dir)) +if (!test_xfs_path (dir)) flags |=FS_FOREIGN ;/*
quota/free.c +1 -1
@@ -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 ;
spaceman/init.c +1 -1
@@ -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 )
Signature · 1 line
2.31.1
Re: [PATCH 4/8] xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
Quoted 75 lines · Pavel Reichl
--- 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(-)copy/xfs_copy.c +2
-2@@ -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(fsr/xfs_fsr.c +1
-1@@ -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);growfs/xfs_growfs.c +1
-1@@ -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);include/linux.h +1
-1@@ -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;
include/linux.h static __inline__ int platform_test_xfs_fd(int fd) · line 63
Quoted 5 lines
include/linux.h +1
-1@@ -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
Quoted 105 lines
include/linux.h +0
-5{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;io/init.c +1
-1@@ -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 );io/open.c +2
-2@@ -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 ) {io/stat.c +1
-1@@ -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 {libfrog/paths.c +1
-1@@ -161,7 +161,7 @@ fs_table_insert( goto out_nodev; } -if (!platform_test_xfs_path (dir)) +if (!test_xfs_path (dir)) flags |=FS_FOREIGN ;/* quota/free.c +1
-1@@ -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 ;spaceman/init.c +1
-1@@ -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 )Signature · 1 line
2.31.1
PATCH 5/8 xfsprogs: Rename platform_getoptreset -> getoptreset
In reply to Pavel Reichl--- db/command.c | 2 +- include/linux.h | 2 +- libxcmd/command.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
db/command.c +1 -1
@@ -84,7 +84,7 @@ command(dbprintf (_ (" arguments\n" ));return 0 ; } -platform_getoptreset (); +getoptreset ();return ct->cfunc (argc, argv); }
include/linux.h +1 -1
@@ -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 ;
libxcmd/command.c +1 -1
@@ -92,7 +92,7 @@ command( argc-1, cmd, ct->argmin, ct->argmax);return 0 ; } -platform_getoptreset (); +getoptreset ();return ct->cfunc (argc, argv); }
Signature · 1 line
2.31.1
PATCH 6/8 xfsprogs: remove all platform_ prefixes in linux.h
In reply to Pavel Reichl--- 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(-)
copy/xfs_copy.c +5 -5
@@ -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);
db/fprint.c +1 -1
@@ -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 (" " );
db/sb.c +6 -6
@@ -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); }
include/linux.h +0 -30
@@ -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
libxfs/libxfs_priv.h +0 -1
@@ -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)
libxfs/xfs_ag.c +3 -3
@@ -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 );
libxfs/xfs_attr_leaf.c +1 -1
@@ -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 {
libxfs/xfs_attr_remote.c +1 -1
@@ -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);
libxfs/xfs_btree.c +2 -2
@@ -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 ; } }
libxfs/xfs_da_btree.c +1 -1
@@ -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 ; }
libxfs/xfs_dir2_block.c +1 -1
@@ -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 ; }
libxfs/xfs_dir2_data.c +1 -1
@@ -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 );
libxfs/xfs_dir2_leaf.c +1 -1
@@ -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);
libxfs/xfs_dir2_node.c +1 -1
@@ -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);
libxfs/xfs_dquot_buf.c +1 -1
@@ -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 ); }
libxfs/xfs_ialloc.c +2 -2
@@ -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 */
libxfs/xfs_inode_buf.c +1 -1
@@ -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 ;
libxfs/xfs_sb.c +3 -3
@@ -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); } }
libxfs/xfs_symlink_remote.c +1 -1
@@ -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;
libxlog/util.c +3 -3
@@ -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)
logprint/log_misc.c +1 -1
@@ -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 :
mkfs/xfs_mkfs.c +6 -6
@@ -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 );
repair/agheader.c +6 -6
@@ -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;
repair/dinode.c +1 -1
@@ -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 ; }
repair/phase5.c +3 -3
@@ -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 ); }
Signature · 1 line
2.31.1
PATCH 7/8 xfsprogs: Remove platform_ prefixes in libfrog/common.h
In reply to Pavel Reichl--- 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(-)
copy/xfs_copy.c +4 -4
@@ -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"
fsr/xfs_fsr.c +3 -3
@@ -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);
include/defs.h.in +1 -1
@@ -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)
include/linux.h +8 -8
@@ -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 *mtabreturn 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 );
libfrog/common.h +12 -12
@@ -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__ */
libfrog/linux.c +14 -14
@@ -40,7 +40,7 @@ static int max_block_alignment;#define CHECK_MOUNT_WRITABLE 0x2static 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;
libfrog/topology.c +3 -3
@@ -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
libxfs/init.c +16 -16
@@ -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
libxfs/libxfs_io.h +1 -1
@@ -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); }
libxfs/rdwr.c +2 -2
@@ -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 ; }
mdrestore/xfs_mdrestore.c +2 -2
@@ -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]);
mkfs/xfs_mkfs.c +5 -5
@@ -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
repair/phase4.c +3 -3
@@ -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 );
repair/prefetch.c +1 -1
@@ -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);
repair/slab.c +1 -1
@@ -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 ));
repair/xfs_repair.c +3 -3
@@ -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 ) {
scrub/disk.c +1 -1
@@ -43,7 +43,7 @@ __disk_heads( {int iomin;int ioopt; -int nproc =platform_nproc (); +int nproc =libfrog_nproc ();unsigned short rot;int error;
Signature · 1 line
2.31.1
PATCH 8/8 xfsprogs: remove platform_ from man xfsctl man page
In reply to Pavel Reichl--- man/man3/xfsctl.3 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
man/man3/xfsctl.3 +2 -7
@@ -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
Signature · 1 line
2.31.1
Quoted 4 lines · Pavel Reichl
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...
Quoted 22 lines
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.
(quoted diff) +1
-5-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:
Quoted 5 lines
* Is renaming platform_defs.h.in -> defs.h.in OK?
* is renaminglibfrog/platform.h->libfrog/common.hOK, maybelibfrog/libfrog.his better?
* Wrapperplatform_nproc()definedin/libfrog/linux.cslightly changes the behavior ofnproc()is renaming it tolibfrog_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)"?
Quoted 3 lines
* 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
Quoted 112 lines
Thanks!
Pavel Reichl (8):
xfsprogs: Rename platform_defs.h.in -> defs.h.in
xfsprogs: Renameplatform.h->common.h
xfsprogs: removeplatform_uuid_compare()
xfsprogs: remove platform_{test_xfs_fd,path,fstatfs}
xfsprogs: Renameplatform_getoptreset-> getoptreset
xfsprogs: remove allplatform_prefixes inlinux.h
xfsprogs: Removeplatform_prefixes inlibfrog/common.h
xfsprogs: removeplatform_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.hSignature · 1 line
2.31.1
Quoted 3 lines · Pavel Reichl
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;
}intplatform_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