public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* decrufify the configure checks
@ 2024-01-29  7:31 Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 01/27] include: remove the filldir_t typedef Christoph Hellwig
                   ` (27 more replies)
  0 siblings, 28 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

Hi all,

I've been starting to look into making the xfsprogs build system suck
less.  This series stops generating platform_defs.h and removes a lot
of superfluous configure checks.

Diffstat:
 b/Makefile                |   15 -
 b/configure.ac            |   33 ----
 b/fsr/Makefile            |    4 
 b/fsr/xfs_fsr.c           |    2 
 b/include/bitops.h        |    2 
 b/include/builddefs.in    |   37 ----
 b/include/linux.h         |    2 
 b/include/platform_defs.h |   10 -
 b/io/Makefile             |   69 ---------
 b/io/io.h                 |   36 ----
 b/io/mmap.c               |    8 -
 b/io/pread.c              |    8 -
 b/io/prealloc.c           |    8 -
 b/io/pwrite.c             |    8 -
 b/io/seek.c               |    5 
 b/io/stat.c               |    2 
 b/io/sync.c               |    4 
 b/libfrog/Makefile        |    4 
 b/libfrog/paths.c         |    9 -
 b/libxfs/topology.c       |   37 ----
 b/m4/Makefile             |    1 
 b/m4/package_libcdev.m4   |  349 ----------------------------------------------
 b/repair/bmap.c           |   23 +--
 b/repair/bmap.h           |   13 -
 b/scrub/Makefile          |   20 --
 b/scrub/common.h          |    8 -
 b/scrub/disk.c            |   30 +--
 b/scrub/xfs_scrub.c       |    6 
 m4/package_types.m4       |   14 -
 29 files changed, 35 insertions(+), 732 deletions(-)

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

* [PATCH 01/27] include: remove the filldir_t typedef
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 02/27] include: unconditionally define umode_t Christoph Hellwig
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

Neither struct filldir, nor filldir_t is used anywhere in xfsprogs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/platform_defs.h.in | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
index 64e7efdbf..02b0e08b5 100644
--- a/include/platform_defs.h.in
+++ b/include/platform_defs.h.in
@@ -25,8 +25,6 @@
 #include <libgen.h>
 #include <urcu.h>
 
-typedef struct filldir		filldir_t;
-
 /* long and pointer must be either 32 bit or 64 bit */
 #undef SIZEOF_LONG
 #undef SIZEOF_CHAR_P
-- 
2.39.2


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

* [PATCH 02/27] include: unconditionally define umode_t
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 01/27] include: remove the filldir_t typedef Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check Christoph Hellwig
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

No system or kernel uapi header defines umode_t, so just define it
unconditionally.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac               |  1 -
 include/builddefs.in       |  3 ---
 include/platform_defs.h.in |  3 ---
 m4/Makefile                |  1 -
 m4/package_types.m4        | 14 --------------
 5 files changed, 22 deletions(-)
 delete mode 100644 m4/package_types.m4

diff --git a/configure.ac b/configure.ac
index 2034f02e5..482b2452c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -250,7 +250,6 @@ fi
 
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([char *])
-AC_TYPE_UMODE_T
 AC_MANUAL_FORMAT
 AC_HAVE_LIBURCU_ATOMIC64
 
diff --git a/include/builddefs.in b/include/builddefs.in
index a3745efbe..6e7eaface 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -136,9 +136,6 @@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
 
 # _LGPL_SOURCE is for liburcu to work correctly with GPL/LGPL programs
 PCFLAGS = -D_LGPL_SOURCE -D_GNU_SOURCE $(GCCFLAGS)
-ifeq ($(HAVE_UMODE_T),yes)
-PCFLAGS += -DHAVE_UMODE_T
-endif
 DEPENDFLAGS = -D__linux__
 ifeq ($(HAVE_FLS),yes)
 LCFLAGS+= -DHAVE_FLS
diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
index 02b0e08b5..17262dcff 100644
--- a/include/platform_defs.h.in
+++ b/include/platform_defs.h.in
@@ -30,10 +30,7 @@
 #undef SIZEOF_CHAR_P
 #define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT)
 
-/* Check whether to define umode_t ourselves. */
-#ifndef HAVE_UMODE_T
 typedef unsigned short umode_t;
-#endif
 
 /* Define if you want gettext (I18N) support */
 #undef ENABLE_GETTEXT
diff --git a/m4/Makefile b/m4/Makefile
index 731205303..84174c3d3 100644
--- a/m4/Makefile
+++ b/m4/Makefile
@@ -22,7 +22,6 @@ LSRCFILES = \
 	package_pthread.m4 \
 	package_sanitizer.m4 \
 	package_services.m4 \
-	package_types.m4 \
 	package_icu.m4 \
 	package_urcu.m4 \
 	package_utilies.m4 \
diff --git a/m4/package_types.m4 b/m4/package_types.m4
deleted file mode 100644
index 6e817a310..000000000
--- a/m4/package_types.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Check if we have umode_t
-#
-AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
-AC_DEFUN([AC_TYPE_UMODE_T],
-  [ AC_MSG_CHECKING([for umode_t])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#include <asm/types.h>
-	]], [[
-umode_t umode;
-	]])
-    ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
-  ])
-- 
2.39.2


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

* [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 01/27] include: remove the filldir_t typedef Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 02/27] include: unconditionally define umode_t Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-02-14 23:11   ` Dave Chinner
  2024-01-29  7:31 ` [PATCH 04/27] include: stop using SIZEOF_LONG Christoph Hellwig
                   ` (24 subsequent siblings)
  27 siblings, 1 reply; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

Check the 32-bit limits using sizeof instead of cpp ifdefs so that we
can get rid of BITS_PER_LONG.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 repair/bmap.c | 23 +++++++++++++++--------
 repair/bmap.h | 13 -------------
 2 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/repair/bmap.c b/repair/bmap.c
index cd1a8b07b..d1b2faaec 100644
--- a/repair/bmap.c
+++ b/repair/bmap.c
@@ -22,6 +22,15 @@
 pthread_key_t	dblkmap_key;
 pthread_key_t	ablkmap_key;
 
+/*
+ * For 32 bit platforms, we are limited to extent arrays of 2^31 bytes, which
+ * limits the number of extents in an inode we can check. If we don't limit the
+ * valid range, we can overflow the BLKMAP_SIZE() calculation and allocate less
+ * memory than we think we needed, and hence walk off the end of the array and
+ * corrupt memory.
+ */
+#define BLKMAP_NEXTS32_MAX	((INT_MAX / sizeof(bmap_ext_t)) - 1)
+
 blkmap_t *
 blkmap_alloc(
 	xfs_extnum_t	nex,
@@ -35,8 +44,7 @@ blkmap_alloc(
 	if (nex < 1)
 		nex = 1;
 
-#if (BITS_PER_LONG == 32)	/* on 64-bit platforms this is never true */
-	if (nex > BLKMAP_NEXTS_MAX) {
+	if (sizeof(long) == 32 && nex > BLKMAP_NEXTS32_MAX) {
 		do_warn(
 	_("Number of extents requested in blkmap_alloc (%llu) overflows 32 bits.\n"
 	  "If this is not a corruption, then you will need a 64 bit system\n"
@@ -44,7 +52,6 @@ blkmap_alloc(
 			(unsigned long long)nex);
 		return NULL;
 	}
-#endif
 
 	key = whichfork ? ablkmap_key : dblkmap_key;
 	blkmap = pthread_getspecific(key);
@@ -278,20 +285,20 @@ blkmap_grow(
 		ASSERT(pthread_getspecific(key) == blkmap);
 	}
 
-#if (BITS_PER_LONG == 32)	/* on 64-bit platforms this is never true */
-	if (new_naexts > BLKMAP_NEXTS_MAX) {
+	if (sizeof(long) == 32 && new_naexts > BLKMAP_NEXTS32_MAX) {
 		do_error(
 	_("Number of extents requested in blkmap_grow (%d) overflows 32 bits.\n"
 	  "You need a 64 bit system to repair this filesystem.\n"),
 			new_naexts);
 		return NULL;
 	}
-#endif
+
 	if (new_naexts <= 0) {
 		do_error(
 	_("Number of extents requested in blkmap_grow (%d) overflowed the\n"
-	  "maximum number of supported extents (%d).\n"),
-			new_naexts, BLKMAP_NEXTS_MAX);
+	  "maximum number of supported extents (%ld).\n"),
+			new_naexts,
+			sizeof(long) == 32 ? BLKMAP_NEXTS32_MAX : INT_MAX);
 		return NULL;
 	}
 
diff --git a/repair/bmap.h b/repair/bmap.h
index 4b588df8c..df9602b31 100644
--- a/repair/bmap.h
+++ b/repair/bmap.h
@@ -28,19 +28,6 @@ typedef	struct blkmap {
 #define	BLKMAP_SIZE(n)	\
 	(offsetof(blkmap_t, exts) + (sizeof(bmap_ext_t) * (n)))
 
-/*
- * For 32 bit platforms, we are limited to extent arrays of 2^31 bytes, which
- * limits the number of extents in an inode we can check. If we don't limit the
- * valid range, we can overflow the BLKMAP_SIZE() calculation and allocate less
- * memory than we think we needed, and hence walk off the end of the array and
- * corrupt memory.
- */
-#if BITS_PER_LONG == 32
-#define BLKMAP_NEXTS_MAX	((INT_MAX / sizeof(bmap_ext_t)) - 1)
-#else
-#define BLKMAP_NEXTS_MAX	INT_MAX
-#endif
-
 extern pthread_key_t dblkmap_key;
 extern pthread_key_t ablkmap_key;
 
-- 
2.39.2


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

* [PATCH 04/27] include: stop using SIZEOF_LONG
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (2 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 05/27] include: stop generating platform_defs.h Christoph Hellwig
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

SIZEOF_LONG together with the unused SIZEOF_CHAR_P is the last thing that
really needs a generated configuration header.  Switch to just using
sizeof(long) so that we can stop generating platform_defs.h.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac               | 2 --
 include/platform_defs.h.in | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 482b2452c..e4da95638 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,8 +248,6 @@ if test "$enable_lto" = "yes" && test "$have_lto" != "yes"; then
 	AC_MSG_ERROR([LTO not supported by compiler.])
 fi
 
-AC_CHECK_SIZEOF([long])
-AC_CHECK_SIZEOF([char *])
 AC_MANUAL_FORMAT
 AC_HAVE_LIBURCU_ATOMIC64
 
diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
index 17262dcff..dce7154cd 100644
--- a/include/platform_defs.h.in
+++ b/include/platform_defs.h.in
@@ -26,9 +26,7 @@
 #include <urcu.h>
 
 /* long and pointer must be either 32 bit or 64 bit */
-#undef SIZEOF_LONG
-#undef SIZEOF_CHAR_P
-#define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT)
+#define BITS_PER_LONG (sizeof(long) * CHAR_BIT)
 
 typedef unsigned short umode_t;
 
-- 
2.39.2


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

* [PATCH 05/27] include: stop generating platform_defs.h
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (3 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 04/27] include: stop using SIZEOF_LONG Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 06/27] io: don't redefine SEEK_DATA and SEEK_HOLE Christoph Hellwig
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

Now that the sizeof checks are gone, we can stop generating platform_defs.h.
The only caveat is that we need to stop undefining ENABLE_GETTEXT, which the
generation process had removed before.  The actual ENABLE_GETTEXT will be
passd on the compiler command line, just like other ENABLE or HAVE values
from autoconf.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 Makefile                                        | 15 ++++-----------
 configure.ac                                    |  1 -
 include/{platform_defs.h.in => platform_defs.h} |  1 -
 3 files changed, 4 insertions(+), 13 deletions(-)
 rename include/{platform_defs.h.in => platform_defs.h} (99%)

diff --git a/Makefile b/Makefile
index c12df98db..4e768526c 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
 
 ifeq ($(HAVE_BUILDDEFS), yes)
 LDIRDIRT = $(SRCDIR)
@@ -76,7 +76,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
 ifeq ($(HAVE_BUILDDEFS), no)
 	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
@@ -116,13 +116,6 @@ configure: configure.ac
 include/builddefs: configure
 	./configure $$LOCAL_CONFIGURE_OPTIONS
 
-include/platform_defs.h: include/builddefs
-## Recover from the removal of $@
-	@if test -f $@; then :; else \
-		rm -f include/builddefs; \
-		$(MAKE) $(MAKEOPTS) $(AM_MAKEFLAGS) include/builddefs; \
-	fi
-
 install: $(addsuffix -install,$(SUBDIRS))
 	$(INSTALL) -m 755 -d $(PKG_DOC_DIR)
 	$(INSTALL) -m 644 README $(PKG_DOC_DIR)
@@ -146,14 +139,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 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
 ifeq ($(HAVE_BUILDDEFS), no)
 	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
diff --git a/configure.ac b/configure.ac
index e4da95638..3e40931b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,6 @@ AC_PREREQ([2.69])
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([include/libxfs.h])
-AC_CONFIG_HEADERS([include/platform_defs.h])
 AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_INSTALL
diff --git a/include/platform_defs.h.in b/include/platform_defs.h
similarity index 99%
rename from include/platform_defs.h.in
rename to include/platform_defs.h
index dce7154cd..c01d4c426 100644
--- a/include/platform_defs.h.in
+++ b/include/platform_defs.h
@@ -31,7 +31,6 @@
 typedef unsigned short umode_t;
 
 /* Define if you want gettext (I18N) support */
-#undef ENABLE_GETTEXT
 #ifdef ENABLE_GETTEXT
 # include <libintl.h>
 # define _(x)                   gettext(x)
-- 
2.39.2


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

* [PATCH 06/27] io: don't redefine SEEK_DATA and SEEK_HOLE
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (4 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 05/27] include: stop generating platform_defs.h Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 07/27] configure: don't check for getmntent Christoph Hellwig
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

HAVE_SEEK_DATA is never defined, so the code in xfs_io just
unconditionally redefines SEEK_DATA and SEEK_HOLE.  Switch to the
system version instead, which has been around since Linux 3.1 and
glibc of similar vintage.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 io/seek.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/io/seek.c b/io/seek.c
index 6734ecb56..61d352660 100644
--- a/io/seek.c
+++ b/io/seek.c
@@ -35,11 +35,6 @@ seek_help(void)
 "\n"));
 }
 
-#ifndef HAVE_SEEK_DATA
-#define	SEEK_DATA	3	/* seek to the next data */
-#define	SEEK_HOLE	4	/* seek to the next hole */
-#endif
-
 /* values for flag variable */
 #define	SEEK_DFLAG	(1 << 0)
 #define	SEEK_HFLAG	(1 << 1)
-- 
2.39.2


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

* [PATCH 07/27] configure: don't check for getmntent
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (5 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 06/27] io: don't redefine SEEK_DATA and SEEK_HOLE Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 08/27] configure: require libblkid Christoph Hellwig
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

getmntent always exists on Linux (and always has), so don't bother
checking for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  2 --
 fsr/Makefile          |  4 ----
 include/builddefs.in  |  2 --
 libfrog/Makefile      |  4 ----
 libfrog/paths.c       |  9 +--------
 m4/package_libcdev.m4 | 27 ---------------------------
 6 files changed, 1 insertion(+), 47 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3e40931b1..58048945c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,7 +171,6 @@ AC_HAVE_FADVISE
 AC_HAVE_MADVISE
 AC_HAVE_MINCORE
 AC_HAVE_SENDFILE
-AC_HAVE_GETMNTENT
 AC_HAVE_FALLOCATE
 AC_HAVE_FIEMAP
 AC_HAVE_PWRITEV2
@@ -179,7 +178,6 @@ AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
 AC_HAVE_SYNC_FILE_RANGE
 AC_HAVE_SYNCFS
-AC_HAVE_MNTENT
 AC_HAVE_FLS
 AC_HAVE_READDIR
 AC_HAVE_FSETXATTR
diff --git a/fsr/Makefile b/fsr/Makefile
index 86486fc9c..d57f2de24 100644
--- a/fsr/Makefile
+++ b/fsr/Makefile
@@ -11,10 +11,6 @@ LLDLIBS = $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBBLKID)
 LTDEPENDENCIES = $(LIBHANDLE) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
-ifeq ($(HAVE_GETMNTENT),yes)
-LCFLAGS += -DHAVE_GETMNTENT
-endif
-
 default: depend $(LTCOMMAND)
 
 include $(BUILDRULES)
diff --git a/include/builddefs.in b/include/builddefs.in
index 6e7eaface..b5bfbb1f2 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -95,7 +95,6 @@ HAVE_FADVISE = @have_fadvise@
 HAVE_MADVISE = @have_madvise@
 HAVE_MINCORE = @have_mincore@
 HAVE_SENDFILE = @have_sendfile@
-HAVE_GETMNTENT = @have_getmntent@
 HAVE_FALLOCATE = @have_fallocate@
 HAVE_FIEMAP = @have_fiemap@
 HAVE_PREADV = @have_preadv@
@@ -104,7 +103,6 @@ HAVE_COPY_FILE_RANGE = @have_copy_file_range@
 HAVE_SYNC_FILE_RANGE = @have_sync_file_range@
 HAVE_SYNCFS = @have_syncfs@
 HAVE_READDIR = @have_readdir@
-HAVE_MNTENT = @have_mntent@
 HAVE_FLS = @have_fls@
 HAVE_FSETXATTR = @have_fsetxattr@
 HAVE_MREMAP = @have_mremap@
diff --git a/libfrog/Makefile b/libfrog/Makefile
index dcfd1fb8a..cafee073f 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -54,10 +54,6 @@ workqueue.h
 
 LSRCFILES += gen_crc32table.c
 
-ifeq ($(HAVE_GETMNTENT),yes)
-LCFLAGS += -DHAVE_GETMNTENT
-endif
-
 LDIRT = gen_crc32table crc32table.h
 
 default: ltdepend $(LTLIBRARY)
diff --git a/libfrog/paths.c b/libfrog/paths.c
index d8c42163a..320b26dbf 100644
--- a/libfrog/paths.c
+++ b/libfrog/paths.c
@@ -15,6 +15,7 @@
 #include "paths.h"
 #include "input.h"
 #include "projects.h"
+#include <mntent.h>
 #include <limits.h>
 
 extern char *progname;
@@ -295,10 +296,6 @@ fs_cursor_next_entry(
 	return NULL;
 }
 
-
-#if defined(HAVE_GETMNTENT)
-#include <mntent.h>
-
 /*
  * Determines whether the "logdev" or "rtdev" mount options are
  * present for the given mount point.  If so, the value for each (a
@@ -417,10 +414,6 @@ fs_table_initialise_mounts(
 	return error;
 }
 
-#else
-# error "How do I extract info about mounted filesystems on this platform?"
-#endif
-
 /*
  * Given a directory, match it up to a filesystem mount point.
  */
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 174070651..5d947a024 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -70,24 +70,6 @@ sendfile(0, 0, 0, 0);
     AC_SUBST(have_sendfile)
   ])
 
-#
-# Check if we have a getmntent libc call (Linux)
-#
-AC_DEFUN([AC_HAVE_GETMNTENT],
-  [ AC_MSG_CHECKING([for getmntent ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#include <stdio.h>
-#include <mntent.h>
-	]], [[
-getmntent(0);
-	]])
-    ], have_getmntent=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_getmntent)
-  ])
-
 #
 # Check if we have a fallocate libc call (Linux)
 #
@@ -262,15 +244,6 @@ AC_DEFUN([AC_HAVE_FSETXATTR],
     AC_SUBST(have_fsetxattr)
   ])
 
-#
-# Check if there is mntent.h
-#
-AC_DEFUN([AC_HAVE_MNTENT],
-  [ AC_CHECK_HEADERS(mntent.h,
-    have_mntent=yes)
-    AC_SUBST(have_mntent)
-  ])
-
 #
 # Check if we have a mremap call (not on Mac OS X)
 #
-- 
2.39.2


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

* [PATCH 08/27] configure: require libblkid
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (6 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 07/27] configure: don't check for getmntent Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 09/27] configure: don't check for fadvise Christoph Hellwig
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

We can't support block device access (which is the reason for xfsprogs
to exist) without blkid.  Make it a hard requirement and remove the
stubs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac         |  8 --------
 include/builddefs.in |  4 ----
 libxfs/topology.c    | 37 +------------------------------------
 3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/configure.ac b/configure.ac
index 58048945c..a94360090 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,11 +36,6 @@ AC_ARG_ENABLE(gettext,
 	enable_gettext=yes)
 AC_SUBST(enable_gettext)
 
-AC_ARG_ENABLE(blkid,
-[  --enable-blkid=[yes/no]   Enable use of block device id library [default=yes]],,
-	enable_blkid=yes)
-AC_SUBST(enable_blkid)
-
 AC_ARG_ENABLE(editline,
 [  --enable-editline=[yes/no] Enable editline command editing [default=no]],
 	test $enable_editline = yes && libeditline="-ledit",
@@ -208,10 +203,7 @@ AC_HAVE_HDIO_GETGEO
 AC_CONFIG_SYSTEMD_SYSTEM_UNIT_DIR
 AC_CONFIG_CROND_DIR
 AC_CONFIG_UDEV_RULE_DIR
-
-if test "$enable_blkid" = yes; then
 AC_HAVE_BLKID_TOPO
-fi
 
 if test "$enable_ubsan" = "yes" || test "$enable_ubsan" = "probe"; then
         AC_PACKAGE_CHECK_UBSAN
diff --git a/include/builddefs.in b/include/builddefs.in
index b5bfbb1f2..a00283da1 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -86,7 +86,6 @@ RPM_VERSION	= @rpm_version@
 ENABLE_SHARED	= @enable_shared@
 ENABLE_GETTEXT	= @enable_gettext@
 ENABLE_EDITLINE	= @enable_editline@
-ENABLE_BLKID	= @enable_blkid@
 ENABLE_SCRUB	= @enable_scrub@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
@@ -144,9 +143,6 @@ endif
 ifeq ($(HAVE_FSETXATTR),yes)
 PCFLAGS+= -DHAVE_FSETXATTR
 endif
-ifeq ($(ENABLE_BLKID),yes)
-PCFLAGS+= -DENABLE_BLKID
-endif
 ifeq ($(NEED_INTERNAL_FSXATTR),yes)
 PCFLAGS+= -DOVERRIDE_SYSTEM_FSXATTR
 endif
diff --git a/libxfs/topology.c b/libxfs/topology.c
index 06013d429..4515d238d 100644
--- a/libxfs/topology.c
+++ b/libxfs/topology.c
@@ -6,9 +6,7 @@
 
 #include "libxfs_priv.h"
 #include "libxcmd.h"
-#ifdef ENABLE_BLKID
-#  include <blkid/blkid.h>
-#endif /* ENABLE_BLKID */
+#include <blkid/blkid.h>
 #include "xfs_multidisk.h"
 #include "libfrog/platform.h"
 
@@ -96,7 +94,6 @@ done:
  *	 0 for nothing found
  *	-1 for internal error
  */
-#ifdef ENABLE_BLKID
 int
 check_overwrite(
 	const char	*device)
@@ -253,38 +250,6 @@ out_free_probe:
 		_("warning: unable to probe device topology for device %s\n"),
 		device);
 }
-#else /* ifdef ENABLE_BLKID */
-/*
- * Without blkid, we can't do a good check for signatures.
- * So instead of some messy attempts, just disable any checks
- * and always return 'nothing found'.
- */
-#  warning BLKID is disabled, so signature detection and block device\
- access are not working!
-int
-check_overwrite(
-	const char	*device)
-{
-	return 1;
-}
-
-static void blkid_get_topology(
-	const char	*device,
-	int		*sunit,
-	int		*swidth,
-	int		*lsectorsize,
-	int		*psectorsize,
-	int		force_overwrite)
-{
-	/*
-	 * Shouldn't make any difference (no blkid = no block device access),
-	 * but make sure this dummy replacement returns with at least some
-	 * sanity.
-	 */
-	*lsectorsize = *psectorsize = 512;
-}
-
-#endif /* ENABLE_BLKID */
 
 void
 get_topology(
-- 
2.39.2


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

* [PATCH 09/27] configure: don't check for fadvise
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (7 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 08/27] configure: require libblkid Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 10/27] configure: don't check for sendfile Christoph Hellwig
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

fadvise has been supported since Linux 2.5.60 and glibc 2.2.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  9 +--------
 io/io.h               |  5 -----
 m4/package_libcdev.m4 | 18 ------------------
 5 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index a94360090..478eadc6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,6 @@ AC_PACKAGE_NEED_PTHREADMUTEXINIT
 AC_PACKAGE_NEED_URCU_H
 AC_PACKAGE_NEED_RCU_INIT
 
-AC_HAVE_FADVISE
 AC_HAVE_MADVISE
 AC_HAVE_MINCORE
 AC_HAVE_SENDFILE
diff --git a/include/builddefs.in b/include/builddefs.in
index a00283da1..42dc23174 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -90,7 +90,6 @@ ENABLE_SCRUB	= @enable_scrub@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
-HAVE_FADVISE = @have_fadvise@
 HAVE_MADVISE = @have_madvise@
 HAVE_MINCORE = @have_mincore@
 HAVE_SENDFILE = @have_sendfile@
diff --git a/io/Makefile b/io/Makefile
index 53fef09e8..a8ea64010 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -13,19 +13,12 @@ CFILES = init.c \
 	file.c freeze.c fsuuid.c fsync.c getrusage.c imap.c inject.c label.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
-	truncate.c utimes.c
+	truncate.c utimes.c fadvise.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
-ifeq ($(HAVE_FADVISE),yes)
-CFILES += fadvise.c
-LCFLAGS += -DHAVE_FADVISE
-else
-LSRCFILES += fadvise.c
-endif
-
 ifeq ($(HAVE_MADVISE),yes)
 CFILES += madvise.c
 LCFLAGS += -DHAVE_MADVISE
diff --git a/io/io.h b/io/io.h
index fe474faf4..ad90cf3cb 100644
--- a/io/io.h
+++ b/io/io.h
@@ -116,12 +116,7 @@ extern void		swapext_init(void);
 extern void		sync_init(void);
 extern void		truncate_init(void);
 extern void		utimes_init(void);
-
-#ifdef HAVE_FADVISE
 extern void		fadvise_init(void);
-#else
-#define fadvise_init()	do { } while (0)
-#endif
 
 #ifdef HAVE_SENDFILE
 extern void		sendfile_init(void);
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 5d947a024..53d19a1b6 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -1,21 +1,3 @@
-# 
-# Check if we have a working fadvise system call
-#
-AC_DEFUN([AC_HAVE_FADVISE],
-  [ AC_MSG_CHECKING([for fadvise ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <fcntl.h>
-	]], [[
-posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
-	]])
-    ],	have_fadvise=yes
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no))
-    AC_SUBST(have_fadvise)
-  ])
-
 #
 # Check if we have a working madvise system call
 #
-- 
2.39.2


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

* [PATCH 10/27] configure: don't check for sendfile
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (8 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 09/27] configure: don't check for fadvise Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:31 ` [PATCH 11/27] configure: don't check for madvise Christoph Hellwig
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

sendfile has been supported since Linux 2.2 and glibc 2.1.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  9 +--------
 io/io.h               |  5 -----
 m4/package_libcdev.m4 | 18 ------------------
 5 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index 478eadc6c..cc9d9c268 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,7 +164,6 @@ AC_PACKAGE_NEED_RCU_INIT
 
 AC_HAVE_MADVISE
 AC_HAVE_MINCORE
-AC_HAVE_SENDFILE
 AC_HAVE_FALLOCATE
 AC_HAVE_FIEMAP
 AC_HAVE_PWRITEV2
diff --git a/include/builddefs.in b/include/builddefs.in
index 42dc23174..9c7ef93e8 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -92,7 +92,6 @@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
 HAVE_MADVISE = @have_madvise@
 HAVE_MINCORE = @have_mincore@
-HAVE_SENDFILE = @have_sendfile@
 HAVE_FALLOCATE = @have_fallocate@
 HAVE_FIEMAP = @have_fiemap@
 HAVE_PREADV = @have_preadv@
diff --git a/io/Makefile b/io/Makefile
index a8ea64010..9309f1a4f 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -13,7 +13,7 @@ CFILES = init.c \
 	file.c freeze.c fsuuid.c fsync.c getrusage.c imap.c inject.c label.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
-	truncate.c utimes.c fadvise.c
+	truncate.c utimes.c fadvise.c sendfile.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
@@ -33,13 +33,6 @@ else
 LSRCFILES += mincore.c
 endif
 
-ifeq ($(HAVE_SENDFILE),yes)
-CFILES += sendfile.c
-LCFLAGS += -DHAVE_SENDFILE
-else
-LSRCFILES += sendfile.c
-endif
-
 ifeq ($(HAVE_FIEMAP),yes)
 CFILES += fiemap.c
 LCFLAGS += -DHAVE_FIEMAP
diff --git a/io/io.h b/io/io.h
index ad90cf3cb..9f176685e 100644
--- a/io/io.h
+++ b/io/io.h
@@ -117,12 +117,7 @@ extern void		sync_init(void);
 extern void		truncate_init(void);
 extern void		utimes_init(void);
 extern void		fadvise_init(void);
-
-#ifdef HAVE_SENDFILE
 extern void		sendfile_init(void);
-#else
-#define sendfile_init()	do { } while (0)
-#endif
 
 #ifdef HAVE_MADVISE
 extern void		madvise_init(void);
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 53d19a1b6..ef20ae41a 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -34,24 +34,6 @@ mincore(0, 0, 0);
     AC_SUBST(have_mincore)
   ])
 
-#
-# Check if we have a working sendfile system call
-#
-AC_DEFUN([AC_HAVE_SENDFILE],
-  [ AC_MSG_CHECKING([for sendfile ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <sys/sendfile.h>
-	]], [[
-sendfile(0, 0, 0, 0);
-	]])
-    ],	have_sendfile=yes
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no))
-    AC_SUBST(have_sendfile)
-  ])
-
 #
 # Check if we have a fallocate libc call (Linux)
 #
-- 
2.39.2


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

* [PATCH 11/27] configure: don't check for madvise
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (9 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 10/27] configure: don't check for sendfile Christoph Hellwig
@ 2024-01-29  7:31 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 12/27] configure: don't check for mincor Christoph Hellwig
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:31 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

madvise has been supported since before the dawn of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  9 +--------
 io/io.h               |  5 -----
 m4/package_libcdev.m4 | 18 ------------------
 5 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index cc9d9c268..4d5609129 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,6 @@ AC_PACKAGE_NEED_PTHREADMUTEXINIT
 AC_PACKAGE_NEED_URCU_H
 AC_PACKAGE_NEED_RCU_INIT
 
-AC_HAVE_MADVISE
 AC_HAVE_MINCORE
 AC_HAVE_FALLOCATE
 AC_HAVE_FIEMAP
diff --git a/include/builddefs.in b/include/builddefs.in
index 9c7ef93e8..f8558a79f 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -90,7 +90,6 @@ ENABLE_SCRUB	= @enable_scrub@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
-HAVE_MADVISE = @have_madvise@
 HAVE_MINCORE = @have_mincore@
 HAVE_FALLOCATE = @have_fallocate@
 HAVE_FIEMAP = @have_fiemap@
diff --git a/io/Makefile b/io/Makefile
index 9309f1a4f..f01f32d16 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -13,19 +13,12 @@ CFILES = init.c \
 	file.c freeze.c fsuuid.c fsync.c getrusage.c imap.c inject.c label.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
-	truncate.c utimes.c fadvise.c sendfile.c
+	truncate.c utimes.c fadvise.c sendfile.c madvise.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
-ifeq ($(HAVE_MADVISE),yes)
-CFILES += madvise.c
-LCFLAGS += -DHAVE_MADVISE
-else
-LSRCFILES += madvise.c
-endif
-
 ifeq ($(HAVE_MINCORE),yes)
 CFILES += mincore.c
 LCFLAGS += -DHAVE_MINCORE
diff --git a/io/io.h b/io/io.h
index 9f176685e..d90dc91cb 100644
--- a/io/io.h
+++ b/io/io.h
@@ -118,12 +118,7 @@ extern void		truncate_init(void);
 extern void		utimes_init(void);
 extern void		fadvise_init(void);
 extern void		sendfile_init(void);
-
-#ifdef HAVE_MADVISE
 extern void		madvise_init(void);
-#else
-#define madvise_init()	do { } while (0)
-#endif
 
 #ifdef HAVE_MINCORE
 extern void		mincore_init(void);
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index ef20ae41a..9586ef03d 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -1,21 +1,3 @@
-#
-# Check if we have a working madvise system call
-#
-AC_DEFUN([AC_HAVE_MADVISE],
-  [ AC_MSG_CHECKING([for madvise ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <sys/mman.h>
-	]], [[
-posix_madvise(0, 0, MADV_NORMAL);
-	]])
-    ],	have_madvise=yes
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no))
-    AC_SUBST(have_madvise)
-  ])
-
 #
 # Check if we have a working mincore system call
 #
-- 
2.39.2


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

* [PATCH 12/27] configure: don't check for mincor
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (10 preceding siblings ...)
  2024-01-29  7:31 ` [PATCH 11/27] configure: don't check for madvise Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 13/27] configure: don't check for fiemap Christoph Hellwig
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

mincore has been supported since Linux 2.3.99pre1 and glibc 2.2.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  9 +--------
 io/io.h               |  5 -----
 m4/package_libcdev.m4 | 18 ------------------
 5 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4d5609129..3b5ebf375 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,6 @@ AC_PACKAGE_NEED_PTHREADMUTEXINIT
 AC_PACKAGE_NEED_URCU_H
 AC_PACKAGE_NEED_RCU_INIT
 
-AC_HAVE_MINCORE
 AC_HAVE_FALLOCATE
 AC_HAVE_FIEMAP
 AC_HAVE_PWRITEV2
diff --git a/include/builddefs.in b/include/builddefs.in
index f8558a79f..353a03d18 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -90,7 +90,6 @@ ENABLE_SCRUB	= @enable_scrub@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
-HAVE_MINCORE = @have_mincore@
 HAVE_FALLOCATE = @have_fallocate@
 HAVE_FIEMAP = @have_fiemap@
 HAVE_PREADV = @have_preadv@
diff --git a/io/Makefile b/io/Makefile
index f01f32d16..f480272ae 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -13,19 +13,12 @@ CFILES = init.c \
 	file.c freeze.c fsuuid.c fsync.c getrusage.c imap.c inject.c label.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
-	truncate.c utimes.c fadvise.c sendfile.c madvise.c
+	truncate.c utimes.c fadvise.c sendfile.c madvise.c mincore.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
-ifeq ($(HAVE_MINCORE),yes)
-CFILES += mincore.c
-LCFLAGS += -DHAVE_MINCORE
-else
-LSRCFILES += mincore.c
-endif
-
 ifeq ($(HAVE_FIEMAP),yes)
 CFILES += fiemap.c
 LCFLAGS += -DHAVE_FIEMAP
diff --git a/io/io.h b/io/io.h
index d90dc91cb..9c056efb5 100644
--- a/io/io.h
+++ b/io/io.h
@@ -119,12 +119,7 @@ extern void		utimes_init(void);
 extern void		fadvise_init(void);
 extern void		sendfile_init(void);
 extern void		madvise_init(void);
-
-#ifdef HAVE_MINCORE
 extern void		mincore_init(void);
-#else
-#define mincore_init()	do { } while (0)
-#endif
 
 #ifdef HAVE_FIEMAP
 extern void		fiemap_init(void);
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 9586ef03d..87c294b24 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -1,21 +1,3 @@
-#
-# Check if we have a working mincore system call
-#
-AC_DEFUN([AC_HAVE_MINCORE],
-  [ AC_MSG_CHECKING([for mincore ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <sys/mman.h>
-	]], [[
-mincore(0, 0, 0);
-	]])
-    ],	have_mincore=yes
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no))
-    AC_SUBST(have_mincore)
-  ])
-
 #
 # Check if we have a fallocate libc call (Linux)
 #
-- 
2.39.2


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

* [PATCH 13/27] configure: don't check for fiemap
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (11 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 12/27] configure: don't check for mincor Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 14/27] configure: don't check for sync_file_range Christoph Hellwig
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

fiemap has been supported since Linux 2.6.28.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  9 +--------
 io/io.h               |  5 -----
 m4/package_libcdev.m4 | 21 ---------------------
 5 files changed, 1 insertion(+), 36 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b5ebf375..40999b598 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,7 +163,6 @@ AC_PACKAGE_NEED_URCU_H
 AC_PACKAGE_NEED_RCU_INIT
 
 AC_HAVE_FALLOCATE
-AC_HAVE_FIEMAP
 AC_HAVE_PWRITEV2
 AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
diff --git a/include/builddefs.in b/include/builddefs.in
index 353a03d18..a5408014d 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -91,7 +91,6 @@ ENABLE_SCRUB	= @enable_scrub@
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
 HAVE_FALLOCATE = @have_fallocate@
-HAVE_FIEMAP = @have_fiemap@
 HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
diff --git a/io/Makefile b/io/Makefile
index f480272ae..2271389f5 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -13,19 +13,12 @@ CFILES = init.c \
 	file.c freeze.c fsuuid.c fsync.c getrusage.c imap.c inject.c label.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
-	truncate.c utimes.c fadvise.c sendfile.c madvise.c mincore.c
+	truncate.c utimes.c fadvise.c sendfile.c madvise.c mincore.c fiemap.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
-ifeq ($(HAVE_FIEMAP),yes)
-CFILES += fiemap.c
-LCFLAGS += -DHAVE_FIEMAP
-else
-LSRCFILES += fiemap.c
-endif
-
 ifeq ($(HAVE_COPY_FILE_RANGE),yes)
 CFILES += copy_file_range.c
 LCFLAGS += -DHAVE_COPY_FILE_RANGE
diff --git a/io/io.h b/io/io.h
index 9c056efb5..982d37c38 100644
--- a/io/io.h
+++ b/io/io.h
@@ -120,12 +120,7 @@ extern void		fadvise_init(void);
 extern void		sendfile_init(void);
 extern void		madvise_init(void);
 extern void		mincore_init(void);
-
-#ifdef HAVE_FIEMAP
 extern void		fiemap_init(void);
-#else
-#define fiemap_init()	do { } while (0)
-#endif
 
 #ifdef HAVE_COPY_FILE_RANGE
 extern void		copy_range_init(void);
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 87c294b24..93daf3640 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -17,27 +17,6 @@ fallocate(0, 0, 0, 0);
     AC_SUBST(have_fallocate)
   ])
 
-#
-# Check if we have the fiemap ioctl (Linux)
-#
-AC_DEFUN([AC_HAVE_FIEMAP],
-  [ AC_MSG_CHECKING([for fiemap])
-    AC_LINK_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <linux/fs.h>
-#include <linux/fiemap.h>
-#include <sys/ioctl.h>
-	]], [[
-struct fiemap *fiemap;
-ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
-	]])
-    ], have_fiemap=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_fiemap)
-  ])
-
 #
 # Check if we have a preadv libc call (Linux)
 #
-- 
2.39.2


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

* [PATCH 14/27] configure: don't check for sync_file_range
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (12 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 13/27] configure: don't check for fiemap Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 15/27] configure: don't check for readdir Christoph Hellwig
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

sync_file_range has been supported since Linux 2.6.17.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  8 ++------
 io/io.h               |  4 ----
 m4/package_libcdev.m4 | 18 ------------------
 5 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/configure.ac b/configure.ac
index 40999b598..7c1248583 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,7 +166,6 @@ AC_HAVE_FALLOCATE
 AC_HAVE_PWRITEV2
 AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
-AC_HAVE_SYNC_FILE_RANGE
 AC_HAVE_SYNCFS
 AC_HAVE_FLS
 AC_HAVE_READDIR
diff --git a/include/builddefs.in b/include/builddefs.in
index a5408014d..247dd9956 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -94,7 +94,6 @@ HAVE_FALLOCATE = @have_fallocate@
 HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
-HAVE_SYNC_FILE_RANGE = @have_sync_file_range@
 HAVE_SYNCFS = @have_syncfs@
 HAVE_READDIR = @have_readdir@
 HAVE_FLS = @have_fls@
diff --git a/io/Makefile b/io/Makefile
index 2271389f5..0709f8f21 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -13,7 +13,8 @@ CFILES = init.c \
 	file.c freeze.c fsuuid.c fsync.c getrusage.c imap.c inject.c label.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
-	truncate.c utimes.c fadvise.c sendfile.c madvise.c mincore.c fiemap.c
+	truncate.c utimes.c fadvise.c sendfile.c madvise.c mincore.c fiemap.c \
+	sync_file_range.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
@@ -24,11 +25,6 @@ CFILES += copy_file_range.c
 LCFLAGS += -DHAVE_COPY_FILE_RANGE
 endif
 
-ifeq ($(HAVE_SYNC_FILE_RANGE),yes)
-CFILES += sync_file_range.c
-LCFLAGS += -DHAVE_SYNC_FILE_RANGE
-endif
-
 ifeq ($(HAVE_SYNCFS),yes)
 LCFLAGS += -DHAVE_SYNCFS
 endif
diff --git a/io/io.h b/io/io.h
index 982d37c38..ad025c51d 100644
--- a/io/io.h
+++ b/io/io.h
@@ -128,11 +128,7 @@ extern void		copy_range_init(void);
 #define copy_range_init()	do { } while (0)
 #endif
 
-#ifdef HAVE_SYNC_FILE_RANGE
 extern void		sync_range_init(void);
-#else
-#define sync_range_init()	do { } while (0)
-#endif
 
 #ifdef HAVE_READDIR
 extern void		readdir_init(void);
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 93daf3640..5a2290de1 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -73,24 +73,6 @@ syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
     AC_SUBST(have_copy_file_range)
   ])
 
-#
-# Check if we have a sync_file_range libc call (Linux)
-#
-AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
-  [ AC_MSG_CHECKING([for sync_file_range])
-    AC_LINK_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <fcntl.h>
-	]], [[
-sync_file_range(0, 0, 0, 0);
-	]])
-    ], have_sync_file_range=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_sync_file_range)
-  ])
-
 #
 # Check if we have a syncfs libc call (Linux)
 #
-- 
2.39.2


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

* [PATCH 15/27] configure: don't check for readdir
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (13 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 14/27] configure: don't check for sync_file_range Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 16/27] configure: don't check for fls Christoph Hellwig
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

readdir has been part of Posix since the very beginning.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  7 +------
 io/io.h               |  7 -------
 m4/package_libcdev.m4 | 17 -----------------
 5 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7c1248583..6510a4fb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,7 +168,6 @@ AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
 AC_HAVE_SYNCFS
 AC_HAVE_FLS
-AC_HAVE_READDIR
 AC_HAVE_FSETXATTR
 AC_HAVE_MREMAP
 AC_NEED_INTERNAL_FSXATTR
diff --git a/include/builddefs.in b/include/builddefs.in
index 247dd9956..4951ae9d9 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -95,7 +95,6 @@ HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
 HAVE_SYNCFS = @have_syncfs@
-HAVE_READDIR = @have_readdir@
 HAVE_FLS = @have_fls@
 HAVE_FSETXATTR = @have_fsetxattr@
 HAVE_MREMAP = @have_mremap@
diff --git a/io/Makefile b/io/Makefile
index 0709f8f21..837716238 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -14,7 +14,7 @@ CFILES = init.c \
 	link.c mmap.c open.c parent.c pread.c prealloc.c pwrite.c reflink.c \
 	resblks.c scrub.c seek.c shutdown.c stat.c swapext.c sync.c \
 	truncate.c utimes.c fadvise.c sendfile.c madvise.c mincore.c fiemap.c \
-	sync_file_range.c
+	sync_file_range.c readdir.c
 
 LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUUID)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE) $(LIBFROG)
@@ -46,11 +46,6 @@ ifeq ($(HAVE_PWRITEV2),yes)
 LCFLAGS += -DHAVE_PWRITEV2
 endif
 
-ifeq ($(HAVE_READDIR),yes)
-CFILES += readdir.c
-LCFLAGS += -DHAVE_READDIR
-endif
-
 ifeq ($(HAVE_MREMAP),yes)
 LCFLAGS += -DHAVE_MREMAP
 endif
diff --git a/io/io.h b/io/io.h
index ad025c51d..e807bb0de 100644
--- a/io/io.h
+++ b/io/io.h
@@ -129,15 +129,8 @@ extern void		copy_range_init(void);
 #endif
 
 extern void		sync_range_init(void);
-
-#ifdef HAVE_READDIR
 extern void		readdir_init(void);
-#else
-#define readdir_init()		do { } while (0)
-#endif
-
 extern void		reflink_init(void);
-
 extern void		cowextsize_init(void);
 
 #ifdef HAVE_GETFSMAP
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 5a2290de1..25d869841 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -91,23 +91,6 @@ syncfs(0);
     AC_SUBST(have_syncfs)
   ])
 
-#
-# Check if we have a readdir libc call
-#
-AC_DEFUN([AC_HAVE_READDIR],
-  [ AC_MSG_CHECKING([for readdir])
-    AC_LINK_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#include <dirent.h>
-	]], [[
-readdir(0);
-	]])
-    ], have_readdir=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_readdir)
-  ])
-
 #
 # Check if we have a flc call (Mac OS X)
 #
-- 
2.39.2


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

* [PATCH 16/27] configure: don't check for fls
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (14 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 15/27] configure: don't check for readdir Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 17/27] configure: don't check for fallocate Christoph Hellwig
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

fls should never be provided by system headers.  It seems like on MacOS
it did, but as we're not supporting MacOS anymore there is no need to
check for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/bitops.h      |  2 --
 include/builddefs.in  |  4 ----
 m4/package_libcdev.m4 | 12 ------------
 4 files changed, 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6510a4fb3..abedaacf2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,7 +167,6 @@ AC_HAVE_PWRITEV2
 AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
 AC_HAVE_SYNCFS
-AC_HAVE_FLS
 AC_HAVE_FSETXATTR
 AC_HAVE_MREMAP
 AC_NEED_INTERNAL_FSXATTR
diff --git a/include/bitops.h b/include/bitops.h
index fe6173039..1f1adcecc 100644
--- a/include/bitops.h
+++ b/include/bitops.h
@@ -6,7 +6,6 @@
  * fls: find last bit set.
  */
 
-#ifndef HAVE_FLS
 static inline int fls(int x)
 {
 	int r = 32;
@@ -34,7 +33,6 @@ static inline int fls(int x)
 	}
 	return r;
 }
-#endif /* HAVE_FLS */
 
 static inline int fls64(__u64 x)
 {
diff --git a/include/builddefs.in b/include/builddefs.in
index 4951ae9d9..47ac7173c 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -95,7 +95,6 @@ HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
 HAVE_SYNCFS = @have_syncfs@
-HAVE_FLS = @have_fls@
 HAVE_FSETXATTR = @have_fsetxattr@
 HAVE_MREMAP = @have_mremap@
 NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
@@ -127,9 +126,6 @@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
 # _LGPL_SOURCE is for liburcu to work correctly with GPL/LGPL programs
 PCFLAGS = -D_LGPL_SOURCE -D_GNU_SOURCE $(GCCFLAGS)
 DEPENDFLAGS = -D__linux__
-ifeq ($(HAVE_FLS),yes)
-LCFLAGS+= -DHAVE_FLS
-endif
 ifeq ($(HAVE_MNTENT),yes)
 PCFLAGS+= -DHAVE_MNTENT
 endif
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 25d869841..17319bb23 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -91,18 +91,6 @@ syncfs(0);
     AC_SUBST(have_syncfs)
   ])
 
-#
-# Check if we have a flc call (Mac OS X)
-#
-AC_DEFUN([AC_HAVE_FLS],
-  [ AC_CHECK_DECL([fls],
-       have_fls=yes,
-       [],
-       [#include <string.h>]
-       )
-    AC_SUBST(have_fls)
-  ])
-
 #
 # Check if we have a fsetxattr call
 #
-- 
2.39.2


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

* [PATCH 17/27] configure: don't check for fallocate
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (15 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 16/27] configure: don't check for fls Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 18/27] configure: don't check for syncfs Christoph Hellwig
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

fallocate has been supported since Linux 2.6.23 and glibc 2.10.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  4 ----
 include/linux.h       |  2 --
 io/Makefile           |  4 ----
 io/prealloc.c         |  8 --------
 m4/package_libcdev.m4 | 19 -------------------
 6 files changed, 38 deletions(-)

diff --git a/configure.ac b/configure.ac
index abedaacf2..8c903ea2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,6 @@ AC_PACKAGE_NEED_PTHREADMUTEXINIT
 AC_PACKAGE_NEED_URCU_H
 AC_PACKAGE_NEED_RCU_INIT
 
-AC_HAVE_FALLOCATE
 AC_HAVE_PWRITEV2
 AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
diff --git a/include/builddefs.in b/include/builddefs.in
index 47ac7173c..64468f486 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -90,7 +90,6 @@ ENABLE_SCRUB	= @enable_scrub@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
-HAVE_FALLOCATE = @have_fallocate@
 HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
@@ -144,9 +143,6 @@ endif
 ifeq ($(HAVE_GETFSMAP),yes)
 PCFLAGS+= -DHAVE_GETFSMAP
 endif
-ifeq ($(HAVE_FALLOCATE),yes)
-PCFLAGS += -DHAVE_FALLOCATE
-endif
 
 LIBICU_LIBS = @libicu_LIBS@
 LIBICU_CFLAGS = @libicu_CFLAGS@
diff --git a/include/linux.h b/include/linux.h
index eddc4ad9c..95a0deee2 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -27,9 +27,7 @@
 #include <asm/types.h>
 #include <mntent.h>
 #include <fcntl.h>
-#if defined(HAVE_FALLOCATE)
 #include <linux/falloc.h>
-#endif
 #ifdef OVERRIDE_SYSTEM_FSXATTR
 # define fsxattr sys_fsxattr
 #endif
diff --git a/io/Makefile b/io/Makefile
index 837716238..eb6ad0574 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -33,10 +33,6 @@ ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
 
-ifeq ($(HAVE_FALLOCATE),yes)
-LCFLAGS += -DHAVE_FALLOCATE
-endif
-
 # Also implies PWRITEV
 ifeq ($(HAVE_PREADV),yes)
 LCFLAGS += -DHAVE_PREADV -DHAVE_PWRITEV
diff --git a/io/prealloc.c b/io/prealloc.c
index 5805897a4..8e968c9f2 100644
--- a/io/prealloc.c
+++ b/io/prealloc.c
@@ -4,9 +4,7 @@
  * All Rights Reserved.
  */
 
-#if defined(HAVE_FALLOCATE)
 #include <linux/falloc.h>
-#endif
 #include "command.h"
 #include "input.h"
 #include "init.h"
@@ -37,14 +35,12 @@ static cmdinfo_t freesp_cmd;
 static cmdinfo_t resvsp_cmd;
 static cmdinfo_t unresvsp_cmd;
 static cmdinfo_t zero_cmd;
-#if defined(HAVE_FALLOCATE)
 static cmdinfo_t falloc_cmd;
 static cmdinfo_t fpunch_cmd;
 static cmdinfo_t fcollapse_cmd;
 static cmdinfo_t finsert_cmd;
 static cmdinfo_t fzero_cmd;
 static cmdinfo_t funshare_cmd;
-#endif
 
 static int
 offset_length(
@@ -182,7 +178,6 @@ zero_f(
 }
 
 
-#if defined (HAVE_FALLOCATE)
 static void
 falloc_help(void)
 {
@@ -381,7 +376,6 @@ funshare_f(
 	}
 	return 0;
 }
-#endif	/* HAVE_FALLOCATE */
 
 void
 prealloc_init(void)
@@ -435,7 +429,6 @@ prealloc_init(void)
 	add_command(&unresvsp_cmd);
 	add_command(&zero_cmd);
 
-#if defined (HAVE_FALLOCATE)
 	falloc_cmd.name = "falloc";
 	falloc_cmd.cfunc = fallocate_f;
 	falloc_cmd.argmin = 2;
@@ -496,5 +489,4 @@ prealloc_init(void)
 	funshare_cmd.oneline =
 	_("unshares shared blocks within the range");
 	add_command(&funshare_cmd);
-#endif	/* HAVE_FALLOCATE */
 }
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 17319bb23..758b9378c 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -1,22 +1,3 @@
-#
-# Check if we have a fallocate libc call (Linux)
-#
-AC_DEFUN([AC_HAVE_FALLOCATE],
-  [ AC_MSG_CHECKING([for fallocate])
-    AC_LINK_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <fcntl.h>
-#include <linux/falloc.h>
-	]], [[
-fallocate(0, 0, 0, 0);
-	]])
-    ], have_fallocate=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_fallocate)
-  ])
-
 #
 # Check if we have a preadv libc call (Linux)
 #
-- 
2.39.2


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

* [PATCH 18/27] configure: don't check for syncfs
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (16 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 17/27] configure: don't check for fallocate Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 19/27] configure: don't check for preadv and pwritev Christoph Hellwig
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

syncfs has been supported since Linux 2.6.39.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  4 ----
 io/sync.c             |  4 ----
 m4/package_libcdev.m4 | 18 ------------------
 scrub/Makefile        |  4 ----
 scrub/common.h        |  8 --------
 7 files changed, 40 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8c903ea2d..3a131982f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,7 +165,6 @@ AC_PACKAGE_NEED_RCU_INIT
 AC_HAVE_PWRITEV2
 AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
-AC_HAVE_SYNCFS
 AC_HAVE_FSETXATTR
 AC_HAVE_MREMAP
 AC_NEED_INTERNAL_FSXATTR
diff --git a/include/builddefs.in b/include/builddefs.in
index 64468f486..cb63751fd 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -93,7 +93,6 @@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
-HAVE_SYNCFS = @have_syncfs@
 HAVE_FSETXATTR = @have_fsetxattr@
 HAVE_MREMAP = @have_mremap@
 NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
diff --git a/io/Makefile b/io/Makefile
index eb6ad0574..acef8957d 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -25,10 +25,6 @@ CFILES += copy_file_range.c
 LCFLAGS += -DHAVE_COPY_FILE_RANGE
 endif
 
-ifeq ($(HAVE_SYNCFS),yes)
-LCFLAGS += -DHAVE_SYNCFS
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
diff --git a/io/sync.c b/io/sync.c
index 89f787ecd..f3b900d86 100644
--- a/io/sync.c
+++ b/io/sync.c
@@ -21,7 +21,6 @@ sync_f(
 	return 0;
 }
 
-#ifdef HAVE_SYNCFS
 static cmdinfo_t syncfs_cmd;
 
 static int
@@ -35,7 +34,6 @@ syncfs_f(
 	}
 	return 0;
 }
-#endif
 
 void
 sync_init(void)
@@ -49,7 +47,6 @@ sync_init(void)
 
 	add_command(&sync_cmd);
 
-#ifdef HAVE_SYNCFS
 	syncfs_cmd.name = "syncfs";
 	syncfs_cmd.cfunc = syncfs_f;
 	syncfs_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
@@ -57,5 +54,4 @@ sync_init(void)
 		_("calls syncfs(2) to flush all in-core filesystem state to disk");
 
 	add_command(&syncfs_cmd);
-#endif
 }
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 758b9378c..37d11e338 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -54,24 +54,6 @@ syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
     AC_SUBST(have_copy_file_range)
   ])
 
-#
-# Check if we have a syncfs libc call (Linux)
-#
-AC_DEFUN([AC_HAVE_SYNCFS],
-  [ AC_MSG_CHECKING([for syncfs])
-    AC_LINK_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <unistd.h>
-	]], [[
-syncfs(0);
-	]])
-    ], have_syncfs=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_syncfs)
-  ])
-
 #
 # Check if we have a fsetxattr call
 #
diff --git a/scrub/Makefile b/scrub/Makefile
index 4368897f2..f3e22a9d6 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -89,10 +89,6 @@ ifeq ($(HAVE_MALLINFO2),yes)
 LCFLAGS += -DHAVE_MALLINFO2
 endif
 
-ifeq ($(HAVE_SYNCFS),yes)
-LCFLAGS += -DHAVE_SYNCFS
-endif
-
 ifeq ($(HAVE_LIBATTR),yes)
 LCFLAGS += -DHAVE_LIBATTR
 endif
diff --git a/scrub/common.h b/scrub/common.h
index 865c1caa4..764639c06 100644
--- a/scrub/common.h
+++ b/scrub/common.h
@@ -74,14 +74,6 @@ double auto_units(unsigned long long number, char **units, int *precision);
 unsigned int scrub_nproc(struct scrub_ctx *ctx);
 unsigned int scrub_nproc_workqueue(struct scrub_ctx *ctx);
 
-#ifndef HAVE_SYNCFS
-static inline int syncfs(int fd)
-{
-	sync();
-	return 0;
-}
-#endif
-
 void background_sleep(void);
 char *string_escape(const char *in);
 
-- 
2.39.2


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

* [PATCH 19/27] configure: don't check for preadv and pwritev
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (17 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 18/27] configure: don't check for syncfs Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 20/27] configure: don't check for mremap Christoph Hellwig
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

preadv and pwritev have been supported since Linux 2.6.30.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  5 -----
 io/pread.c            |  8 --------
 io/pwrite.c           |  8 --------
 m4/package_libcdev.m4 | 19 -------------------
 6 files changed, 42 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3a131982f..a332b7694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,7 +163,6 @@ AC_PACKAGE_NEED_URCU_H
 AC_PACKAGE_NEED_RCU_INIT
 
 AC_HAVE_PWRITEV2
-AC_HAVE_PREADV
 AC_HAVE_COPY_FILE_RANGE
 AC_HAVE_FSETXATTR
 AC_HAVE_MREMAP
diff --git a/include/builddefs.in b/include/builddefs.in
index cb63751fd..0e0f26144 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -90,7 +90,6 @@ ENABLE_SCRUB	= @enable_scrub@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
-HAVE_PREADV = @have_preadv@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
 HAVE_FSETXATTR = @have_fsetxattr@
diff --git a/io/Makefile b/io/Makefile
index acef8957d..a81a75fc8 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -29,11 +29,6 @@ ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
 
-# Also implies PWRITEV
-ifeq ($(HAVE_PREADV),yes)
-LCFLAGS += -DHAVE_PREADV -DHAVE_PWRITEV
-endif
-
 ifeq ($(HAVE_PWRITEV2),yes)
 LCFLAGS += -DHAVE_PWRITEV2
 endif
diff --git a/io/pread.c b/io/pread.c
index 0f1d8b97b..75b4390a8 100644
--- a/io/pread.c
+++ b/io/pread.c
@@ -37,9 +37,7 @@ pread_help(void)
 " -R   -- read at random offsets in the range of bytes\n"
 " -Z N -- zeed the random number generator (used when reading randomly)\n"
 "         (heh, zorry, the -s/-S arguments were already in use in pwrite)\n"
-#ifdef HAVE_PREADV
 " -V N -- use vectored IO with N iovecs of blocksize each (preadv)\n"
-#endif
 "\n"
 " When in \"random\" mode, the number of read operations will equal the\n"
 " number required to do a complete forward/backward scan of the range.\n"
@@ -160,7 +158,6 @@ dump_buffer(
 	}
 }
 
-#ifdef HAVE_PREADV
 static ssize_t
 do_preadv(
 	int		fd,
@@ -192,9 +189,6 @@ do_preadv(
 
 	return bytes;
 }
-#else
-#define do_preadv(fd, offset, count) (0)
-#endif
 
 static ssize_t
 do_pread(
@@ -414,7 +408,6 @@ pread_f(
 		case 'v':
 			vflag = 1;
 			break;
-#ifdef HAVE_PREADV
 		case 'V':
 			vectors = strtoul(optarg, &sp, 0);
 			if (!sp || sp == optarg) {
@@ -424,7 +417,6 @@ pread_f(
 				return 0;
 			}
 			break;
-#endif
 		case 'Z':
 			zeed = strtoul(optarg, &sp, 0);
 			if (!sp || sp == optarg) {
diff --git a/io/pwrite.c b/io/pwrite.c
index 467bfa9f8..56171a696 100644
--- a/io/pwrite.c
+++ b/io/pwrite.c
@@ -40,9 +40,7 @@ pwrite_help(void)
 " -R   -- write at random offsets in the specified range of bytes\n"
 " -Z N -- zeed the random number generator (used when writing randomly)\n"
 "         (heh, zorry, the -s/-S arguments were already in use in pwrite)\n"
-#ifdef HAVE_PWRITEV
 " -V N -- use vectored IO with N iovecs of blocksize each (pwritev)\n"
-#endif
 #ifdef HAVE_PWRITEV2
 " -N   -- Perform the pwritev2() with RWF_NOWAIT\n"
 " -D   -- Perform the pwritev2() with RWF_DSYNC\n"
@@ -50,7 +48,6 @@ pwrite_help(void)
 "\n"));
 }
 
-#ifdef HAVE_PWRITEV
 static ssize_t
 do_pwritev(
 	int		fd,
@@ -90,9 +87,6 @@ do_pwritev(
 
 	return bytes;
 }
-#else
-#define do_pwritev(fd, offset, count, pwritev2_flags) (0)
-#endif
 
 static ssize_t
 do_pwrite(
@@ -353,7 +347,6 @@ pwrite_f(
 		case 'u':
 			uflag = 1;
 			break;
-#ifdef HAVE_PWRITEV
 		case 'V':
 			vectors = strtoul(optarg, &sp, 0);
 			if (!sp || sp == optarg) {
@@ -363,7 +356,6 @@ pwrite_f(
 				return 0;
 			}
 			break;
-#endif
 		case 'w':
 			wflag = 1;
 			break;
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 37d11e338..7d7679fa0 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -1,22 +1,3 @@
-#
-# Check if we have a preadv libc call (Linux)
-#
-AC_DEFUN([AC_HAVE_PREADV],
-  [ AC_MSG_CHECKING([for preadv])
-    AC_LINK_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#define _BSD_SOURCE
-#define _DEFAULT_SOURCE
-#include <sys/uio.h>
-	]], [[
-preadv(0, 0, 0, 0);
-	]])
-    ], have_preadv=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_preadv)
-  ])
-
 #
 # Check if we have a pwritev2 libc call (Linux)
 #
-- 
2.39.2


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

* [PATCH 20/27] configure: don't check for mremap
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (18 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 19/27] configure: don't check for preadv and pwritev Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 21/27] configure: don't check for fsetxattr Christoph Hellwig
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

mremap has been around since before the dawn of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  4 ----
 io/mmap.c             |  8 --------
 m4/package_libcdev.m4 | 13 -------------
 5 files changed, 27 deletions(-)

diff --git a/configure.ac b/configure.ac
index a332b7694..dd000f11c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,7 +165,6 @@ AC_PACKAGE_NEED_RCU_INIT
 AC_HAVE_PWRITEV2
 AC_HAVE_COPY_FILE_RANGE
 AC_HAVE_FSETXATTR
-AC_HAVE_MREMAP
 AC_NEED_INTERNAL_FSXATTR
 AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG
 AC_NEED_INTERNAL_FSCRYPT_POLICY_V2
diff --git a/include/builddefs.in b/include/builddefs.in
index 0e0f26144..4b55f97cd 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -93,7 +93,6 @@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
 HAVE_FSETXATTR = @have_fsetxattr@
-HAVE_MREMAP = @have_mremap@
 NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
 NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG = @need_internal_fscrypt_add_key_arg@
 NEED_INTERNAL_FSCRYPT_POLICY_V2 = @need_internal_fscrypt_policy_v2@
diff --git a/io/Makefile b/io/Makefile
index a81a75fc8..35b3ebd52 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -33,10 +33,6 @@ ifeq ($(HAVE_PWRITEV2),yes)
 LCFLAGS += -DHAVE_PWRITEV2
 endif
 
-ifeq ($(HAVE_MREMAP),yes)
-LCFLAGS += -DHAVE_MREMAP
-endif
-
 ifeq ($(HAVE_MAP_SYNC),yes)
 LCFLAGS += -DHAVE_MAP_SYNC
 endif
diff --git a/io/mmap.c b/io/mmap.c
index 425957d4b..c3bb211a8 100644
--- a/io/mmap.c
+++ b/io/mmap.c
@@ -16,9 +16,7 @@ static cmdinfo_t mread_cmd;
 static cmdinfo_t msync_cmd;
 static cmdinfo_t munmap_cmd;
 static cmdinfo_t mwrite_cmd;
-#ifdef HAVE_MREMAP
 static cmdinfo_t mremap_cmd;
-#endif /* HAVE_MREMAP */
 
 mmap_region_t	*maptable;
 int		mapcount;
@@ -636,7 +634,6 @@ mwrite_f(
 	return 0;
 }
 
-#ifdef HAVE_MREMAP
 static void
 mremap_help(void)
 {
@@ -712,7 +709,6 @@ mremap_f(
 	mapping->length = new_length;
 	return 0;
 }
-#endif /* HAVE_MREMAP */
 
 void
 mmap_init(void)
@@ -769,7 +765,6 @@ mmap_init(void)
 		_("writes data into a region in the current memory mapping");
 	mwrite_cmd.help = mwrite_help;
 
-#ifdef HAVE_MREMAP
 	mremap_cmd.name = "mremap";
 	mremap_cmd.altname = "mrm";
 	mremap_cmd.cfunc = mremap_f;
@@ -780,14 +775,11 @@ mmap_init(void)
 	mremap_cmd.oneline =
 		_("alters the size of the current memory mapping");
 	mremap_cmd.help = mremap_help;
-#endif /* HAVE_MREMAP */
 
 	add_command(&mmap_cmd);
 	add_command(&mread_cmd);
 	add_command(&msync_cmd);
 	add_command(&munmap_cmd);
 	add_command(&mwrite_cmd);
-#ifdef HAVE_MREMAP
 	add_command(&mremap_cmd);
-#endif /* HAVE_MREMAP */
 }
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 7d7679fa0..dd04be5f0 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -48,19 +48,6 @@ AC_DEFUN([AC_HAVE_FSETXATTR],
     AC_SUBST(have_fsetxattr)
   ])
 
-#
-# Check if we have a mremap call (not on Mac OS X)
-#
-AC_DEFUN([AC_HAVE_MREMAP],
-  [ AC_CHECK_DECL([mremap],
-       have_mremap=yes,
-       [],
-       [#define _GNU_SOURCE
-        #include <sys/mman.h>]
-       )
-    AC_SUBST(have_mremap)
-  ])
-
 #
 # Check if we need to override the system struct fsxattr with
 # the internal definition.  This /only/ happens if the system
-- 
2.39.2


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

* [PATCH 21/27] configure: don't check for fsetxattr
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (19 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 20/27] configure: don't check for mremap Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 22/27] configure: don't check for the f_flags field in statfs Christoph Hellwig
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

fsetxattr has been supported since Linux 2.4 and glibc 2.3.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 fsr/xfs_fsr.c         |  2 --
 include/builddefs.in  |  4 ----
 m4/package_libcdev.m4 | 13 -------------
 4 files changed, 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index dd000f11c..ce9a8a935 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,7 +164,6 @@ AC_PACKAGE_NEED_RCU_INIT
 
 AC_HAVE_PWRITEV2
 AC_HAVE_COPY_FILE_RANGE
-AC_HAVE_FSETXATTR
 AC_NEED_INTERNAL_FSXATTR
 AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG
 AC_NEED_INTERNAL_FSCRYPT_POLICY_V2
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index ba02506d8..971445c2d 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -954,7 +954,6 @@ fsr_setup_attr_fork(
 	int		tfd,
 	struct xfs_bstat *bstatp)
 {
-#ifdef HAVE_FSETXATTR
 	struct xfs_fd	txfd = XFS_FD_INIT(tfd);
 	struct stat	tstatbuf;
 	int		i;
@@ -1119,7 +1118,6 @@ out:
 	if (dflag && diff)
 		fsrprintf(_("failed to match fork offset\n"));;
 
-#endif /* HAVE_FSETXATTR */
 	return 0;
 }
 
diff --git a/include/builddefs.in b/include/builddefs.in
index 4b55f97cd..b84369ea7 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -92,7 +92,6 @@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
 HAVE_PWRITEV2 = @have_pwritev2@
 HAVE_COPY_FILE_RANGE = @have_copy_file_range@
-HAVE_FSETXATTR = @have_fsetxattr@
 NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
 NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG = @need_internal_fscrypt_add_key_arg@
 NEED_INTERNAL_FSCRYPT_POLICY_V2 = @need_internal_fscrypt_policy_v2@
@@ -125,9 +124,6 @@ DEPENDFLAGS = -D__linux__
 ifeq ($(HAVE_MNTENT),yes)
 PCFLAGS+= -DHAVE_MNTENT
 endif
-ifeq ($(HAVE_FSETXATTR),yes)
-PCFLAGS+= -DHAVE_FSETXATTR
-endif
 ifeq ($(NEED_INTERNAL_FSXATTR),yes)
 PCFLAGS+= -DOVERRIDE_SYSTEM_FSXATTR
 endif
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index dd04be5f0..ff0e83752 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -35,19 +35,6 @@ syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
     AC_SUBST(have_copy_file_range)
   ])
 
-#
-# Check if we have a fsetxattr call
-#
-AC_DEFUN([AC_HAVE_FSETXATTR],
-  [ AC_CHECK_DECL([fsetxattr],
-       have_fsetxattr=yes,
-       [],
-       [#include <sys/types.h>
-        #include <sys/xattr.h>]
-       )
-    AC_SUBST(have_fsetxattr)
-  ])
-
 #
 # Check if we need to override the system struct fsxattr with
 # the internal definition.  This /only/ happens if the system
-- 
2.39.2


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

* [PATCH 22/27] configure: don't check for the f_flags field in statfs
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (20 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 21/27] configure: don't check for fsetxattr Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 23/27] configure: don't check for mallinfo Christoph Hellwig
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

The f_flags field has been supported since Linux 2.6.36.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  4 ----
 io/stat.c             |  2 --
 m4/package_libcdev.m4 | 14 --------------
 5 files changed, 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index ce9a8a935..32efad760 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,7 +168,6 @@ AC_NEED_INTERNAL_FSXATTR
 AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG
 AC_NEED_INTERNAL_FSCRYPT_POLICY_V2
 AC_HAVE_GETFSMAP
-AC_HAVE_STATFS_FLAGS
 AC_HAVE_MAP_SYNC
 AC_HAVE_DEVMAPPER
 AC_HAVE_MALLINFO
diff --git a/include/builddefs.in b/include/builddefs.in
index b84369ea7..c359cde45 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -96,7 +96,6 @@ NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
 NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG = @need_internal_fscrypt_add_key_arg@
 NEED_INTERNAL_FSCRYPT_POLICY_V2 = @need_internal_fscrypt_policy_v2@
 HAVE_GETFSMAP = @have_getfsmap@
-HAVE_STATFS_FLAGS = @have_statfs_flags@
 HAVE_MAP_SYNC = @have_map_sync@
 HAVE_DEVMAPPER = @have_devmapper@
 HAVE_MALLINFO = @have_mallinfo@
diff --git a/io/Makefile b/io/Makefile
index 35b3ebd52..17d499de9 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -47,10 +47,6 @@ ifeq ($(HAVE_GETFSMAP),yes)
 CFILES += fsmap.c
 endif
 
-ifeq ($(HAVE_STATFS_FLAGS),yes)
-LCFLAGS += -DHAVE_STATFS_FLAGS
-endif
-
 default: depend $(LTCOMMAND)
 
 include $(BUILDRULES)
diff --git a/io/stat.c b/io/stat.c
index b57f9eefe..7f9f633bb 100644
--- a/io/stat.c
+++ b/io/stat.c
@@ -238,10 +238,8 @@ statfs_f(
 					(long long) st.f_files);
 			printf(_("statfs.f_ffree = %lld\n"),
 					(long long) st.f_ffree);
-#ifdef HAVE_STATFS_FLAGS
 			printf(_("statfs.f_flags = 0x%llx\n"),
 					(long long) st.f_flags);
-#endif
 		}
 	}
 
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index ff0e83752..320809a62 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -120,20 +120,6 @@ struct fsmap_head fh;
     AC_SUBST(have_getfsmap)
   ])
 
-AC_DEFUN([AC_HAVE_STATFS_FLAGS],
-  [
-    AC_CHECK_TYPE(struct statfs,
-      [
-        AC_CHECK_MEMBER(struct statfs.f_flags,
-          have_statfs_flags=yes,,
-          [#include <sys/vfs.h>]
-        )
-      ],,
-      [#include <sys/vfs.h>]
-    )
-    AC_SUBST(have_statfs_flags)
-  ])
-
 #
 # Check if we have MAP_SYNC defines (Linux)
 #
-- 
2.39.2


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

* [PATCH 23/27] configure: don't check for mallinfo
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (21 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 22/27] configure: don't check for the f_flags field in statfs Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-02-02  6:44   ` Sam James
  2024-01-29  7:32 ` [PATCH 24/27] configure: don't check for openat Christoph Hellwig
                   ` (4 subsequent siblings)
  27 siblings, 1 reply; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

mallinfo has been supported since the beginning in glibc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 20 --------------------
 scrub/Makefile        |  4 ----
 scrub/xfs_scrub.c     |  6 ------
 5 files changed, 32 deletions(-)

diff --git a/configure.ac b/configure.ac
index 32efad760..0fa900d95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,7 +170,6 @@ AC_NEED_INTERNAL_FSCRYPT_POLICY_V2
 AC_HAVE_GETFSMAP
 AC_HAVE_MAP_SYNC
 AC_HAVE_DEVMAPPER
-AC_HAVE_MALLINFO
 AC_HAVE_MALLINFO2
 AC_PACKAGE_WANT_ATTRIBUTES_H
 AC_HAVE_LIBATTR
diff --git a/include/builddefs.in b/include/builddefs.in
index c359cde45..0df78f933 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -98,7 +98,6 @@ NEED_INTERNAL_FSCRYPT_POLICY_V2 = @need_internal_fscrypt_policy_v2@
 HAVE_GETFSMAP = @have_getfsmap@
 HAVE_MAP_SYNC = @have_map_sync@
 HAVE_DEVMAPPER = @have_devmapper@
-HAVE_MALLINFO = @have_mallinfo@
 HAVE_MALLINFO2 = @have_mallinfo2@
 HAVE_LIBATTR = @have_libattr@
 HAVE_LIBICU = @have_libicu@
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 320809a62..f29bdd76f 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -137,26 +137,6 @@ int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
     AC_SUBST(have_map_sync)
   ])
 
-#
-# Check if we have a mallinfo libc call
-#
-AC_DEFUN([AC_HAVE_MALLINFO],
-  [ AC_MSG_CHECKING([for mallinfo ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#include <malloc.h>
-	]], [[
-struct mallinfo test;
-
-test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
-test = mallinfo();
-	]])
-    ], have_mallinfo=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_mallinfo)
-  ])
-
 #
 # Check if we have a mallinfo2 libc call
 #
diff --git a/scrub/Makefile b/scrub/Makefile
index f3e22a9d6..846774619 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -81,10 +81,6 @@ LLDLIBS += $(LIBHANDLE) $(LIBFROG) $(LIBICU_LIBS) $(LIBRT) $(LIBURCU) \
 LTDEPENDENCIES += $(LIBHANDLE) $(LIBFROG)
 LLDFLAGS = -static
 
-ifeq ($(HAVE_MALLINFO),yes)
-LCFLAGS += -DHAVE_MALLINFO
-endif
-
 ifeq ($(HAVE_MALLINFO2),yes)
 LCFLAGS += -DHAVE_MALLINFO2
 endif
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index 752180d64..736af2711 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -296,7 +296,6 @@ report_mem_usage(
 	const char			*phase,
 	const struct phase_rusage	*pi)
 {
-#if defined(HAVE_MALLINFO2) || defined(HAVE_MALLINFO)
 # ifdef HAVE_MALLINFO2
 	struct mallinfo2		mall_now = mallinfo2();
 # else
@@ -306,11 +305,6 @@ report_mem_usage(
 		phase,
 		kbytes(mall_now.arena), kbytes(mall_now.hblkhd),
 		kbytes(mall_now.uordblks), kbytes(mall_now.fordblks));
-#else
-	fprintf(stdout, _("%sMemory used: %lluk, "),
-		phase,
-		kbytes(((char *) sbrk(0)) - ((char *) pi->brk_start)));
-#endif
 }
 
 /* Report usage stats. */
-- 
2.39.2


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

* [PATCH 24/27] configure: don't check for openat
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (22 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 23/27] configure: don't check for mallinfo Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 25/27] configure: don't check for fstatat Christoph Hellwig
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

openat has been supported since Linux 2.6.16 and glibc 2.4.

Note that xfs_db already uses it without the ifdef.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 14 --------------
 scrub/Makefile        |  4 ++--
 4 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0fa900d95..47531fce5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,7 +181,6 @@ if test "$enable_scrub" = "yes"; then
                 AC_MSG_ERROR([libicu not found.])
         fi
 fi
-AC_HAVE_OPENAT
 AC_HAVE_FSTATAT
 AC_HAVE_SG_IO
 AC_HAVE_HDIO_GETGEO
diff --git a/include/builddefs.in b/include/builddefs.in
index 0df78f933..c768d0411 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -101,7 +101,6 @@ HAVE_DEVMAPPER = @have_devmapper@
 HAVE_MALLINFO2 = @have_mallinfo2@
 HAVE_LIBATTR = @have_libattr@
 HAVE_LIBICU = @have_libicu@
-HAVE_OPENAT = @have_openat@
 HAVE_FSTATAT = @have_fstatat@
 HAVE_SG_IO = @have_sg_io@
 HAVE_HDIO_GETGEO = @have_hdio_getgeo@
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index f29bdd76f..f857bcd94 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -157,20 +157,6 @@ test = mallinfo2();
     AC_SUBST(have_mallinfo2)
   ])
 
-#
-# Check if we have a openat call
-#
-AC_DEFUN([AC_HAVE_OPENAT],
-  [ AC_CHECK_DECL([openat],
-       have_openat=yes,
-       [],
-       [#include <sys/types.h>
-        #include <sys/stat.h>
-        #include <fcntl.h>]
-       )
-    AC_SUBST(have_openat)
-  ])
-
 #
 # Check if we have a fstatat call
 #
diff --git a/scrub/Makefile b/scrub/Makefile
index 846774619..1d613b946 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -6,11 +6,11 @@ TOPDIR = ..
 builddefs=$(TOPDIR)/include/builddefs
 include $(builddefs)
 
-SCRUB_PREREQS=$(HAVE_OPENAT)$(HAVE_FSTATAT)$(HAVE_GETFSMAP)
+SCRUB_PREREQS=$(HAVE_FSTATAT)$(HAVE_GETFSMAP)
 
 scrub_svcname=xfs_scrub@.service
 
-ifeq ($(SCRUB_PREREQS),yesyesyes)
+ifeq ($(SCRUB_PREREQS),yesyes)
 LTCOMMAND = xfs_scrub
 INSTALL_SCRUB = install-scrub
 XFS_SCRUB_ALL_PROG = xfs_scrub_all
-- 
2.39.2


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

* [PATCH 25/27] configure: don't check for fstatat
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (23 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 24/27] configure: don't check for openat Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 26/27] configure: don't check for SG_IO Christoph Hellwig
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

fstatat has been supported since Linux 2.6.16 and glibc 2.4.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 14 --------------
 scrub/Makefile        |  4 ++--
 4 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 47531fce5..260772a6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,7 +181,6 @@ if test "$enable_scrub" = "yes"; then
                 AC_MSG_ERROR([libicu not found.])
         fi
 fi
-AC_HAVE_FSTATAT
 AC_HAVE_SG_IO
 AC_HAVE_HDIO_GETGEO
 AC_CONFIG_SYSTEMD_SYSTEM_UNIT_DIR
diff --git a/include/builddefs.in b/include/builddefs.in
index c768d0411..e02600f09 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -101,7 +101,6 @@ HAVE_DEVMAPPER = @have_devmapper@
 HAVE_MALLINFO2 = @have_mallinfo2@
 HAVE_LIBATTR = @have_libattr@
 HAVE_LIBICU = @have_libicu@
-HAVE_FSTATAT = @have_fstatat@
 HAVE_SG_IO = @have_sg_io@
 HAVE_HDIO_GETGEO = @have_hdio_getgeo@
 HAVE_SYSTEMD = @have_systemd@
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index f857bcd94..0ff05a04b 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -157,20 +157,6 @@ test = mallinfo2();
     AC_SUBST(have_mallinfo2)
   ])
 
-#
-# Check if we have a fstatat call
-#
-AC_DEFUN([AC_HAVE_FSTATAT],
-  [ AC_CHECK_DECL([fstatat],
-       have_fstatat=yes,
-       [],
-       [#define _GNU_SOURCE
-       #include <sys/types.h>
-       #include <sys/stat.h>
-       #include <unistd.h>])
-    AC_SUBST(have_fstatat)
-  ])
-
 #
 # Check if we have the SG_IO ioctl
 #
diff --git a/scrub/Makefile b/scrub/Makefile
index 1d613b946..4eac20a13 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -6,11 +6,11 @@ TOPDIR = ..
 builddefs=$(TOPDIR)/include/builddefs
 include $(builddefs)
 
-SCRUB_PREREQS=$(HAVE_FSTATAT)$(HAVE_GETFSMAP)
+SCRUB_PREREQS=$(HAVE_GETFSMAP)
 
 scrub_svcname=xfs_scrub@.service
 
-ifeq ($(SCRUB_PREREQS),yesyes)
+ifeq ($(SCRUB_PREREQS),yes)
 LTCOMMAND = xfs_scrub
 INSTALL_SCRUB = install-scrub
 XFS_SCRUB_ALL_PROG = xfs_scrub_all
-- 
2.39.2


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

* [PATCH 26/27] configure: don't check for SG_IO
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (24 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 25/27] configure: don't check for fstatat Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-29  7:32 ` [PATCH 27/27] configure: don't check for HDIO_GETGEO Christoph Hellwig
  2024-01-30  4:52 ` decrufify the configure checks Darrick J. Wong
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

SG_IO has been around longer than XFS.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 19 -------------------
 scrub/Makefile        |  4 ----
 scrub/disk.c          | 22 ++++++++--------------
 5 files changed, 8 insertions(+), 39 deletions(-)

diff --git a/configure.ac b/configure.ac
index 260772a6b..db967055b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,7 +181,6 @@ if test "$enable_scrub" = "yes"; then
                 AC_MSG_ERROR([libicu not found.])
         fi
 fi
-AC_HAVE_SG_IO
 AC_HAVE_HDIO_GETGEO
 AC_CONFIG_SYSTEMD_SYSTEM_UNIT_DIR
 AC_CONFIG_CROND_DIR
diff --git a/include/builddefs.in b/include/builddefs.in
index e02600f09..61981fc6a 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -101,7 +101,6 @@ HAVE_DEVMAPPER = @have_devmapper@
 HAVE_MALLINFO2 = @have_mallinfo2@
 HAVE_LIBATTR = @have_libattr@
 HAVE_LIBICU = @have_libicu@
-HAVE_SG_IO = @have_sg_io@
 HAVE_HDIO_GETGEO = @have_hdio_getgeo@
 HAVE_SYSTEMD = @have_systemd@
 SYSTEMD_SYSTEM_UNIT_DIR = @systemd_system_unit_dir@
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 0ff05a04b..a85894a11 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -157,25 +157,6 @@ test = mallinfo2();
     AC_SUBST(have_mallinfo2)
   ])
 
-#
-# Check if we have the SG_IO ioctl
-#
-AC_DEFUN([AC_HAVE_SG_IO],
-  [ AC_MSG_CHECKING([for struct sg_io_hdr ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#include <scsi/sg.h>
-#include <sys/ioctl.h>
-	]], [[
-struct sg_io_hdr hdr;
-ioctl(0, SG_IO, &hdr);
-	]])
-    ], have_sg_io=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_sg_io)
-  ])
-
 #
 # Check if we have the HDIO_GETGEO ioctl
 #
diff --git a/scrub/Makefile b/scrub/Makefile
index 4eac20a13..f9dfb016f 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -94,10 +94,6 @@ CFILES += unicrash.c
 LCFLAGS += -DHAVE_LIBICU $(LIBICU_CFLAGS)
 endif
 
-ifeq ($(HAVE_SG_IO),yes)
-LCFLAGS += -DHAVE_SG_IO
-endif
-
 ifeq ($(HAVE_HDIO_GETGEO),yes)
 LCFLAGS += -DHAVE_HDIO_GETGEO
 endif
diff --git a/scrub/disk.c b/scrub/disk.c
index addb964d7..0ec29d965 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -10,9 +10,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/statvfs.h>
-#ifdef HAVE_SG_IO
-# include <scsi/sg.h>
-#endif
+#include <scsi/sg.h>
 #ifdef HAVE_HDIO_GETGEO
 # include <linux/hdreg.h>
 #endif
@@ -90,14 +88,13 @@ disk_heads(
  * works if we're talking to a raw SCSI device, and only if we trust the
  * firmware.
  */
-#ifdef HAVE_SG_IO
-# define SENSE_BUF_LEN		64
-# define VERIFY16_CMDLEN	16
-# define VERIFY16_CMD		0x8F
-
-# ifndef SG_FLAG_Q_AT_TAIL
-#  define SG_FLAG_Q_AT_TAIL	0x10
-# endif
+#define SENSE_BUF_LEN		64
+#define VERIFY16_CMDLEN	16
+#define VERIFY16_CMD		0x8F
+
+#ifndef SG_FLAG_Q_AT_TAIL
+# define SG_FLAG_Q_AT_TAIL	0x10
+#endif
 static int
 disk_scsi_verify(
 	struct disk		*disk,
@@ -167,9 +164,6 @@ disk_scsi_verify(
 
 	return blockcount << BBSHIFT;
 }
-#else
-# define disk_scsi_verify(...)		(ENOTTY)
-#endif /* HAVE_SG_IO */
 
 /* Test the availability of the kernel scrub ioctl. */
 static bool
-- 
2.39.2


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

* [PATCH 27/27] configure: don't check for HDIO_GETGEO
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (25 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 26/27] configure: don't check for SG_IO Christoph Hellwig
@ 2024-01-29  7:32 ` Christoph Hellwig
  2024-01-30  4:52 ` decrufify the configure checks Darrick J. Wong
  27 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-01-29  7:32 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

HDIO_GETGEO has been around longer than XFS.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 19 -------------------
 scrub/Makefile        |  4 ----
 scrub/disk.c          |  8 +-------
 5 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/configure.ac b/configure.ac
index db967055b..d85a6e774 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,7 +181,6 @@ if test "$enable_scrub" = "yes"; then
                 AC_MSG_ERROR([libicu not found.])
         fi
 fi
-AC_HAVE_HDIO_GETGEO
 AC_CONFIG_SYSTEMD_SYSTEM_UNIT_DIR
 AC_CONFIG_CROND_DIR
 AC_CONFIG_UDEV_RULE_DIR
diff --git a/include/builddefs.in b/include/builddefs.in
index 61981fc6a..aa69859c0 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -101,7 +101,6 @@ HAVE_DEVMAPPER = @have_devmapper@
 HAVE_MALLINFO2 = @have_mallinfo2@
 HAVE_LIBATTR = @have_libattr@
 HAVE_LIBICU = @have_libicu@
-HAVE_HDIO_GETGEO = @have_hdio_getgeo@
 HAVE_SYSTEMD = @have_systemd@
 SYSTEMD_SYSTEM_UNIT_DIR = @systemd_system_unit_dir@
 HAVE_CROND = @have_crond@
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index a85894a11..13dcdec1b 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -157,25 +157,6 @@ test = mallinfo2();
     AC_SUBST(have_mallinfo2)
   ])
 
-#
-# Check if we have the HDIO_GETGEO ioctl
-#
-AC_DEFUN([AC_HAVE_HDIO_GETGEO],
-  [ AC_MSG_CHECKING([for struct hd_geometry ])
-    AC_COMPILE_IFELSE(
-    [	AC_LANG_PROGRAM([[
-#include <linux/hdreg.h>
-#include <sys/ioctl.h>
-	]], [[
-struct hd_geometry hdr;
-ioctl(0, HDIO_GETGEO, &hdr);
-	]])
-    ], have_hdio_getgeo=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
-    AC_SUBST(have_hdio_getgeo)
-  ])
-
 AC_DEFUN([AC_PACKAGE_CHECK_LTO],
   [ AC_MSG_CHECKING([if C compiler supports LTO])
     OLD_CFLAGS="$CFLAGS"
diff --git a/scrub/Makefile b/scrub/Makefile
index f9dfb016f..9bb485f91 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -94,10 +94,6 @@ CFILES += unicrash.c
 LCFLAGS += -DHAVE_LIBICU $(LIBICU_CFLAGS)
 endif
 
-ifeq ($(HAVE_HDIO_GETGEO),yes)
-LCFLAGS += -DHAVE_HDIO_GETGEO
-endif
-
 LDIRT = $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) *.service *.cron
 
 default: depend $(LTCOMMAND) $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) $(OPTIONAL_TARGETS)
diff --git a/scrub/disk.c b/scrub/disk.c
index 0ec29d965..2cf84d918 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -11,9 +11,7 @@
 #include <sys/types.h>
 #include <sys/statvfs.h>
 #include <scsi/sg.h>
-#ifdef HAVE_HDIO_GETGEO
-# include <linux/hdreg.h>
-#endif
+#include <linux/hdreg.h>
 #include "platform_defs.h"
 #include "libfrog/util.h"
 #include "libfrog/paths.h"
@@ -184,9 +182,7 @@ struct disk *
 disk_open(
 	const char		*pathname)
 {
-#ifdef HAVE_HDIO_GETGEO
 	struct hd_geometry	bdgeo;
-#endif
 	struct disk		*disk;
 	bool			suspicious_disk = false;
 	int			error;
@@ -218,7 +214,6 @@ disk_open(
 		error = ioctl(disk->d_fd, BLKBSZGET, &disk->d_blksize);
 		if (error)
 			disk->d_blksize = 0;
-#ifdef HAVE_HDIO_GETGEO
 		error = ioctl(disk->d_fd, HDIO_GETGEO, &bdgeo);
 		if (!error) {
 			/*
@@ -234,7 +229,6 @@ disk_open(
 				suspicious_disk = true;
 			disk->d_start = bdgeo.start << BBSHIFT;
 		} else
-#endif
 			disk->d_start = 0;
 	} else {
 		disk->d_size = disk->d_sb.st_size;
-- 
2.39.2


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

* Re: decrufify the configure checks
  2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
                   ` (26 preceding siblings ...)
  2024-01-29  7:32 ` [PATCH 27/27] configure: don't check for HDIO_GETGEO Christoph Hellwig
@ 2024-01-30  4:52 ` Darrick J. Wong
  27 siblings, 0 replies; 33+ messages in thread
From: Darrick J. Wong @ 2024-01-30  4:52 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: cem, linux-xfs

On Mon, Jan 29, 2024 at 08:31:48AM +0100, Christoph Hellwig wrote:
> Hi all,
> 
> I've been starting to look into making the xfsprogs build system suck
> less.  This series stops generating platform_defs.h and removes a lot
> of superfluous configure checks.

For the whole series,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

I really like ripping out autoconf crap for pre-2.6.40 kernels. :)

--D

> 
> Diffstat:
>  b/Makefile                |   15 -
>  b/configure.ac            |   33 ----
>  b/fsr/Makefile            |    4 
>  b/fsr/xfs_fsr.c           |    2 
>  b/include/bitops.h        |    2 
>  b/include/builddefs.in    |   37 ----
>  b/include/linux.h         |    2 
>  b/include/platform_defs.h |   10 -
>  b/io/Makefile             |   69 ---------
>  b/io/io.h                 |   36 ----
>  b/io/mmap.c               |    8 -
>  b/io/pread.c              |    8 -
>  b/io/prealloc.c           |    8 -
>  b/io/pwrite.c             |    8 -
>  b/io/seek.c               |    5 
>  b/io/stat.c               |    2 
>  b/io/sync.c               |    4 
>  b/libfrog/Makefile        |    4 
>  b/libfrog/paths.c         |    9 -
>  b/libxfs/topology.c       |   37 ----
>  b/m4/Makefile             |    1 
>  b/m4/package_libcdev.m4   |  349 ----------------------------------------------
>  b/repair/bmap.c           |   23 +--
>  b/repair/bmap.h           |   13 -
>  b/scrub/Makefile          |   20 --
>  b/scrub/common.h          |    8 -
>  b/scrub/disk.c            |   30 +--
>  b/scrub/xfs_scrub.c       |    6 
>  m4/package_types.m4       |   14 -
>  29 files changed, 35 insertions(+), 732 deletions(-)
> 

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

* Re: [PATCH 23/27] configure: don't check for mallinfo
  2024-01-29  7:32 ` [PATCH 23/27] configure: don't check for mallinfo Christoph Hellwig
@ 2024-02-02  6:44   ` Sam James
  2024-02-03  7:44     ` Christoph Hellwig
  0 siblings, 1 reply; 33+ messages in thread
From: Sam James @ 2024-02-02  6:44 UTC (permalink / raw)
  To: hch; +Cc: cem, linux-xfs

musl doesn't support mallinfo* (as it's kind of nasty anyway - exposing
allocator internals), so this won't work there.

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

* Re: [PATCH 23/27] configure: don't check for mallinfo
  2024-02-02  6:44   ` Sam James
@ 2024-02-03  7:44     ` Christoph Hellwig
  0 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-02-03  7:44 UTC (permalink / raw)
  To: Sam James; +Cc: hch, cem, linux-xfs

On Fri, Feb 02, 2024 at 06:44:31AM +0000, Sam James wrote:
> musl doesn't support mallinfo* (as it's kind of nasty anyway - exposing
> allocator internals), so this won't work there.

Well, we can drop the patch then, the following ons apply fine without
it.

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

* Re: [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check
  2024-01-29  7:31 ` [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check Christoph Hellwig
@ 2024-02-14 23:11   ` Dave Chinner
  2024-02-15  5:24     ` Christoph Hellwig
  0 siblings, 1 reply; 33+ messages in thread
From: Dave Chinner @ 2024-02-14 23:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: cem, linux-xfs

On Mon, Jan 29, 2024 at 08:31:51AM +0100, Christoph Hellwig wrote:
> Check the 32-bit limits using sizeof instead of cpp ifdefs so that we
> can get rid of BITS_PER_LONG.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  repair/bmap.c | 23 +++++++++++++++--------
>  repair/bmap.h | 13 -------------
>  2 files changed, 15 insertions(+), 21 deletions(-)
> 
> diff --git a/repair/bmap.c b/repair/bmap.c
> index cd1a8b07b..d1b2faaec 100644
> --- a/repair/bmap.c
> +++ b/repair/bmap.c
> @@ -22,6 +22,15 @@
>  pthread_key_t	dblkmap_key;
>  pthread_key_t	ablkmap_key;
>  
> +/*
> + * For 32 bit platforms, we are limited to extent arrays of 2^31 bytes, which
> + * limits the number of extents in an inode we can check. If we don't limit the
> + * valid range, we can overflow the BLKMAP_SIZE() calculation and allocate less
> + * memory than we think we needed, and hence walk off the end of the array and
> + * corrupt memory.
> + */
> +#define BLKMAP_NEXTS32_MAX	((INT_MAX / sizeof(bmap_ext_t)) - 1)
> +
>  blkmap_t *
>  blkmap_alloc(
>  	xfs_extnum_t	nex,
> @@ -35,8 +44,7 @@ blkmap_alloc(
>  	if (nex < 1)
>  		nex = 1;
>  
> -#if (BITS_PER_LONG == 32)	/* on 64-bit platforms this is never true */
> -	if (nex > BLKMAP_NEXTS_MAX) {
> +	if (sizeof(long) == 32 && nex > BLKMAP_NEXTS32_MAX) {

That's a really, really big long. sizeof(long) = 4, perhaps?

-Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check
  2024-02-14 23:11   ` Dave Chinner
@ 2024-02-15  5:24     ` Christoph Hellwig
  0 siblings, 0 replies; 33+ messages in thread
From: Christoph Hellwig @ 2024-02-15  5:24 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, cem, linux-xfs

On Thu, Feb 15, 2024 at 10:11:09AM +1100, Dave Chinner wrote:
> > -#if (BITS_PER_LONG == 32)	/* on 64-bit platforms this is never true */
> > -	if (nex > BLKMAP_NEXTS_MAX) {
> > +	if (sizeof(long) == 32 && nex > BLKMAP_NEXTS32_MAX) {
> 
> That's a really, really big long. sizeof(long) = 4, perhaps?

Yes.

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

end of thread, other threads:[~2024-02-15  5:24 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29  7:31 decrufify the configure checks Christoph Hellwig
2024-01-29  7:31 ` [PATCH 01/27] include: remove the filldir_t typedef Christoph Hellwig
2024-01-29  7:31 ` [PATCH 02/27] include: unconditionally define umode_t Christoph Hellwig
2024-01-29  7:31 ` [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check Christoph Hellwig
2024-02-14 23:11   ` Dave Chinner
2024-02-15  5:24     ` Christoph Hellwig
2024-01-29  7:31 ` [PATCH 04/27] include: stop using SIZEOF_LONG Christoph Hellwig
2024-01-29  7:31 ` [PATCH 05/27] include: stop generating platform_defs.h Christoph Hellwig
2024-01-29  7:31 ` [PATCH 06/27] io: don't redefine SEEK_DATA and SEEK_HOLE Christoph Hellwig
2024-01-29  7:31 ` [PATCH 07/27] configure: don't check for getmntent Christoph Hellwig
2024-01-29  7:31 ` [PATCH 08/27] configure: require libblkid Christoph Hellwig
2024-01-29  7:31 ` [PATCH 09/27] configure: don't check for fadvise Christoph Hellwig
2024-01-29  7:31 ` [PATCH 10/27] configure: don't check for sendfile Christoph Hellwig
2024-01-29  7:31 ` [PATCH 11/27] configure: don't check for madvise Christoph Hellwig
2024-01-29  7:32 ` [PATCH 12/27] configure: don't check for mincor Christoph Hellwig
2024-01-29  7:32 ` [PATCH 13/27] configure: don't check for fiemap Christoph Hellwig
2024-01-29  7:32 ` [PATCH 14/27] configure: don't check for sync_file_range Christoph Hellwig
2024-01-29  7:32 ` [PATCH 15/27] configure: don't check for readdir Christoph Hellwig
2024-01-29  7:32 ` [PATCH 16/27] configure: don't check for fls Christoph Hellwig
2024-01-29  7:32 ` [PATCH 17/27] configure: don't check for fallocate Christoph Hellwig
2024-01-29  7:32 ` [PATCH 18/27] configure: don't check for syncfs Christoph Hellwig
2024-01-29  7:32 ` [PATCH 19/27] configure: don't check for preadv and pwritev Christoph Hellwig
2024-01-29  7:32 ` [PATCH 20/27] configure: don't check for mremap Christoph Hellwig
2024-01-29  7:32 ` [PATCH 21/27] configure: don't check for fsetxattr Christoph Hellwig
2024-01-29  7:32 ` [PATCH 22/27] configure: don't check for the f_flags field in statfs Christoph Hellwig
2024-01-29  7:32 ` [PATCH 23/27] configure: don't check for mallinfo Christoph Hellwig
2024-02-02  6:44   ` Sam James
2024-02-03  7:44     ` Christoph Hellwig
2024-01-29  7:32 ` [PATCH 24/27] configure: don't check for openat Christoph Hellwig
2024-01-29  7:32 ` [PATCH 25/27] configure: don't check for fstatat Christoph Hellwig
2024-01-29  7:32 ` [PATCH 26/27] configure: don't check for SG_IO Christoph Hellwig
2024-01-29  7:32 ` [PATCH 27/27] configure: don't check for HDIO_GETGEO Christoph Hellwig
2024-01-30  4:52 ` decrufify the configure checks Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox