Skip to contentSkip to conversation

decrufify the configure checks

PATCH In review Christoph Hellwig 4 participants 33 messages Jan 29, 2024 – Feb 15, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

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(-)
#1 lore raw

PATCH 1/27 include: remove the filldir_t typedef

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

---
 include/platform_defs.h.in | 2 --
 1 file changed, 2 deletions(-)
include/platform_defs.h.in +0 -2
index 64e7efdbf..02b0e08b5 100644
@@ -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
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/27 include: unconditionally define umode_t

In reply to Christoph Hellwig

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

---
 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
configure.ac +0 -1
index 2034f02e5..482b2452c 100644
@@ -250,7 +250,6 @@ fi
 
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([char *])
-AC_TYPE_UMODE_T
 AC_MANUAL_FORMAT
 AC_HAVE_LIBURCU_ATOMIC64
 
include/builddefs.in +0 -3
index a3745efbe..6e7eaface 100644
@@ -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
include/platform_defs.h.in +0 -3
index 02b0e08b5..17262dcff 100644
@@ -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
m4/Makefile +0 -1
index 731205303..84174c3d3 100644
@@ -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 \
m4/package_types.m4 deleted +0 -14
deleted file mode 100644
index 6e817a310..000000000
@@ -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))
-  ])
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/27 repair: refactor the BLKMAP_NEXTS_MAX check

In reply to Christoph Hellwig

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

---
 repair/bmap.c | 23 +++++++++++++++--------
 repair/bmap.h | 13 -------------
 2 files changed, 15 insertions(+), 21 deletions(-)
repair/bmap.c +15 -8
index cd1a8b07b..d1b2faaec 100644
@@ -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;
 	}
 
repair/bmap.h +0 -13
index 4b588df8c..df9602b31 100644
@@ -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;
 
Signature · 1 line
2.39.2
#4 lore raw

Re: [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check

Quoted 30 lines · Christoph Hellwig

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

---
 repair/bmap.c | 23 +++++++++++++++--------
 repair/bmap.h | 13 -------------
 2 files changed, 15 insertions(+), 21 deletions(-)
repair/bmap.c +9 -0
index cd1a8b07b..d1b2faaec 100644
@@ -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,

repair/bmap.c blkmap_alloc( · line 47

Quoted 6 lines
repair/bmap.c +1 -2
@@ -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.

Signature · 2 lines
Dave Chinner
[email protected]
#5 lore raw

Re: [PATCH 03/27] repair: refactor the BLKMAP_NEXTS_MAX check

Quoted 5 lines · Dave Chinner

repair/bmap.c blkmap_alloc( · line 47

Quoted 3 lines
repair/bmap.c +1 -2
-#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.

#6 lore raw

PATCH 4/27 include: stop using SIZEOF_LONG

In reply to Christoph Hellwig

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.

---
 configure.ac               | 2 --
 include/platform_defs.h.in | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)
configure.ac +0 -2
index 482b2452c..e4da95638 100644
@@ -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
 
include/platform_defs.h.in +1 -3
index 17262dcff..dce7154cd 100644
@@ -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;
 
Signature · 1 line
2.39.2
#7 lore raw

PATCH 5/27 include: stop generating platform_defs.h

In reply to Christoph Hellwig

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.

---
 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%)
Makefile +4 -11
index c12df98db..4e768526c 100644
@@ -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
configure.ac +0 -1
index e4da95638..3e40931b1 100644
@@ -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
include/platform_defs.h renamed from include/platform_defs.h.in +0 -1
similarity index 99%
rename from include/platform_defs.h.in
rename to include/platform_defs.h
index dce7154cd..c01d4c426 100644
@@ -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)
Signature · 1 line
2.39.2
#8 lore raw

PATCH 6/27 io: don't redefine SEEK_DATA and SEEK_HOLE

In reply to Christoph Hellwig

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.

---
 io/seek.c | 5 -----
 1 file changed, 5 deletions(-)
io/seek.c +0 -5
index 6734ecb56..61d352660 100644
@@ -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)
Signature · 1 line
2.39.2
#9 lore raw

PATCH 7/27 configure: don't check for getmntent

In reply to Christoph Hellwig

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

---
 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(-)
configure.ac +0 -2
index 3e40931b1..58048945c 100644
@@ -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
fsr/Makefile +0 -4
index 86486fc9c..d57f2de24 100644
@@ -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)
include/builddefs.in +0 -2
index 6e7eaface..b5bfbb1f2 100644
@@ -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@
libfrog/Makefile +0 -4
index dcfd1fb8a..cafee073f 100644
@@ -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)
libfrog/paths.c +1 -8
index d8c42163a..320b26dbf 100644
@@ -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.
  */
m4/package_libcdev.m4 +0 -27
index 174070651..5d947a024 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#10 lore raw

PATCH 8/27 configure: require libblkid

In reply to Christoph Hellwig

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.

---
 configure.ac         |  8 --------
 include/builddefs.in |  4 ----
 libxfs/topology.c    | 37 +------------------------------------
 3 files changed, 1 insertion(+), 48 deletions(-)
configure.ac +0 -8
index 58048945c..a94360090 100644
@@ -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
include/builddefs.in +0 -4
index b5bfbb1f2..a00283da1 100644
@@ -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
libxfs/topology.c +1 -36
index 06013d429..4515d238d 100644
@@ -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(
Signature · 1 line
2.39.2
#11 lore raw

PATCH 9/27 configure: don't check for fadvise

In reply to Christoph Hellwig

fadvise has been supported since Linux 2.5.60 and glibc 2.2.

---
 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(-)
configure.ac +0 -1
index a94360090..478eadc6c 100644
@@ -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
include/builddefs.in +0 -1
index a00283da1..42dc23174 100644
@@ -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@
io/Makefile +1 -8
index 53fef09e8..a8ea64010 100644
@@ -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
io/io.h +0 -5
index fe474faf4..ad90cf3cb 100644
@@ -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);
m4/package_libcdev.m4 +0 -18
index 5d947a024..53d19a1b6 100644
@@ -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
 #
Signature · 1 line
2.39.2
#12 lore raw

PATCH 10/27 configure: don't check for sendfile

In reply to Christoph Hellwig

sendfile has been supported since Linux 2.2 and glibc 2.1.

---
 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(-)
configure.ac +0 -1
index 478eadc6c..cc9d9c268 100644
@@ -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
include/builddefs.in +0 -1
index 42dc23174..9c7ef93e8 100644
@@ -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@
io/Makefile +1 -8
index a8ea64010..9309f1a4f 100644
@@ -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
io/io.h +0 -5
index ad90cf3cb..9f176685e 100644
@@ -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);
m4/package_libcdev.m4 +0 -18
index 53d19a1b6..ef20ae41a 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#13 lore raw

PATCH 11/27 configure: don't check for madvise

In reply to Christoph Hellwig

madvise has been supported since before the dawn of it.

---
 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(-)
configure.ac +0 -1
index cc9d9c268..4d5609129 100644
@@ -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
include/builddefs.in +0 -1
index 9c7ef93e8..f8558a79f 100644
@@ -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@
io/Makefile +1 -8
index 9309f1a4f..f01f32d16 100644
@@ -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
io/io.h +0 -5
index 9f176685e..d90dc91cb 100644
@@ -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);
m4/package_libcdev.m4 +0 -18
index ef20ae41a..9586ef03d 100644
@@ -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
 #
Signature · 1 line
2.39.2
#14 lore raw

PATCH 12/27 configure: don't check for mincor

In reply to Christoph Hellwig

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

---
 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(-)
configure.ac +0 -1
index 4d5609129..3b5ebf375 100644
@@ -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
include/builddefs.in +0 -1
index f8558a79f..353a03d18 100644
@@ -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@
io/Makefile +1 -8
index f01f32d16..f480272ae 100644
@@ -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
io/io.h +0 -5
index d90dc91cb..9c056efb5 100644
@@ -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);
m4/package_libcdev.m4 +0 -18
index 9586ef03d..87c294b24 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#15 lore raw

PATCH 13/27 configure: don't check for fiemap

In reply to Christoph Hellwig

fiemap has been supported since Linux 2.6.28.

---
 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(-)
configure.ac +0 -1
index 3b5ebf375..40999b598 100644
@@ -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
include/builddefs.in +0 -1
index 353a03d18..a5408014d 100644
@@ -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@
io/Makefile +1 -8
index f480272ae..2271389f5 100644
@@ -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
io/io.h +0 -5
index 9c056efb5..982d37c38 100644
@@ -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);
m4/package_libcdev.m4 +0 -21
index 87c294b24..93daf3640 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#16 lore raw

PATCH 14/27 configure: don't check for sync_file_range

In reply to Christoph Hellwig

sync_file_range has been supported since Linux 2.6.17.

---
 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(-)
configure.ac +0 -1
index 40999b598..7c1248583 100644
@@ -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
include/builddefs.in +0 -1
index a5408014d..247dd9956 100644
@@ -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@
io/Makefile +2 -6
index 2271389f5..0709f8f21 100644
@@ -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
io/io.h +0 -4
index 982d37c38..ad025c51d 100644
@@ -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);
m4/package_libcdev.m4 +0 -18
index 93daf3640..5a2290de1 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#17 lore raw

PATCH 15/27 configure: don't check for readdir

In reply to Christoph Hellwig

readdir has been part of Posix since the very beginning.

---
 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(-)
configure.ac +0 -1
index 7c1248583..6510a4fb3 100644
@@ -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
include/builddefs.in +0 -1
index 247dd9956..4951ae9d9 100644
@@ -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@
io/Makefile +1 -6
index 0709f8f21..837716238 100644
@@ -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
io/io.h +0 -7
index ad025c51d..e807bb0de 100644
@@ -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
m4/package_libcdev.m4 +0 -17
index 5a2290de1..25d869841 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#18 lore raw

PATCH 16/27 configure: don't check for fls

In reply to Christoph Hellwig

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.

---
 configure.ac          |  1 -
 include/bitops.h      |  2 --
 include/builddefs.in  |  4 ----
 m4/package_libcdev.m4 | 12 ------------
 4 files changed, 19 deletions(-)
configure.ac +0 -1
index 6510a4fb3..abedaacf2 100644
@@ -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
include/bitops.h +0 -2
index fe6173039..1f1adcecc 100644
@@ -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)
 {
include/builddefs.in +0 -4
index 4951ae9d9..47ac7173c 100644
@@ -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
m4/package_libcdev.m4 +0 -12
index 25d869841..17319bb23 100644
@@ -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
 #
Signature · 1 line
2.39.2
#19 lore raw

PATCH 17/27 configure: don't check for fallocate

In reply to Christoph Hellwig

fallocate has been supported since Linux 2.6.23 and glibc 2.10.

---
 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(-)
configure.ac +0 -1
index abedaacf2..8c903ea2d 100644
@@ -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
include/builddefs.in +0 -4
index 47ac7173c..64468f486 100644
@@ -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@
include/linux.h +0 -2
index eddc4ad9c..95a0deee2 100644
@@ -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
io/Makefile +0 -4
index 837716238..eb6ad0574 100644
@@ -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
io/prealloc.c +0 -8
index 5805897a4..8e968c9f2 100644
@@ -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 */
 }
m4/package_libcdev.m4 +0 -19
index 17319bb23..758b9378c 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#20 lore raw

PATCH 18/27 configure: don't check for syncfs

In reply to Christoph Hellwig

syncfs has been supported since Linux 2.6.39.

---
 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(-)
configure.ac +0 -1
index 8c903ea2d..3a131982f 100644
@@ -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
include/builddefs.in +0 -1
index 64468f486..cb63751fd 100644
@@ -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@
io/Makefile +0 -4
index eb6ad0574..acef8957d 100644
@@ -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
io/sync.c +0 -4
index 89f787ecd..f3b900d86 100644
@@ -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
 }
m4/package_libcdev.m4 +0 -18
index 758b9378c..37d11e338 100644
@@ -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
 #
scrub/Makefile +0 -4
index 4368897f2..f3e22a9d6 100644
@@ -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
scrub/common.h +0 -8
index 865c1caa4..764639c06 100644
@@ -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);
 
Signature · 1 line
2.39.2
#21 lore raw

PATCH 19/27 configure: don't check for preadv and pwritev

In reply to Christoph Hellwig

preadv and pwritev have been supported since Linux 2.6.30.

---
 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(-)
configure.ac +0 -1
index 3a131982f..a332b7694 100644
@@ -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
include/builddefs.in +0 -1
index cb63751fd..0e0f26144 100644
@@ -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@
io/Makefile +0 -5
index acef8957d..a81a75fc8 100644
@@ -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
io/pread.c +0 -8
index 0f1d8b97b..75b4390a8 100644
@@ -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) {
io/pwrite.c +0 -8
index 467bfa9f8..56171a696 100644
@@ -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;
m4/package_libcdev.m4 +0 -19
index 37d11e338..7d7679fa0 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#22 lore raw

PATCH 20/27 configure: don't check for mremap

In reply to Christoph Hellwig

mremap has been around since before the dawn of it.

---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  4 ----
 io/mmap.c             |  8 --------
 m4/package_libcdev.m4 | 13 -------------
 5 files changed, 27 deletions(-)
configure.ac +0 -1
index a332b7694..dd000f11c 100644
@@ -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
include/builddefs.in +0 -1
index 0e0f26144..4b55f97cd 100644
@@ -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@
io/Makefile +0 -4
index a81a75fc8..35b3ebd52 100644
@@ -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
io/mmap.c +0 -8
index 425957d4b..c3bb211a8 100644
@@ -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 */
 }
m4/package_libcdev.m4 +0 -13
index 7d7679fa0..dd04be5f0 100644
@@ -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
Signature · 1 line
2.39.2
#23 lore raw

PATCH 21/27 configure: don't check for fsetxattr

In reply to Christoph Hellwig

fsetxattr has been supported since Linux 2.4 and glibc 2.3.

---
 configure.ac          |  1 -
 fsr/xfs_fsr.c         |  2 --
 include/builddefs.in  |  4 ----
 m4/package_libcdev.m4 | 13 -------------
 4 files changed, 20 deletions(-)
configure.ac +0 -1
index dd000f11c..ce9a8a935 100644
@@ -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
fsr/xfs_fsr.c +0 -2
index ba02506d8..971445c2d 100644
@@ -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;
 }
 
include/builddefs.in +0 -4
index 4b55f97cd..b84369ea7 100644
@@ -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
m4/package_libcdev.m4 +0 -13
index dd04be5f0..ff0e83752 100644
@@ -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
Signature · 1 line
2.39.2
#24 lore raw

PATCH 22/27 configure: don't check for the f_flags field in statfs

In reply to Christoph Hellwig

The f_flags field has been supported since Linux 2.6.36.

---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 io/Makefile           |  4 ----
 io/stat.c             |  2 --
 m4/package_libcdev.m4 | 14 --------------
 5 files changed, 22 deletions(-)
configure.ac +0 -1
index ce9a8a935..32efad760 100644
@@ -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
include/builddefs.in +0 -1
index b84369ea7..c359cde45 100644
@@ -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@
io/Makefile +0 -4
index 35b3ebd52..17d499de9 100644
@@ -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)
io/stat.c +0 -2
index b57f9eefe..7f9f633bb 100644
@@ -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
 		}
 	}
 
m4/package_libcdev.m4 +0 -14
index ff0e83752..320809a62 100644
@@ -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)
 #
Signature · 1 line
2.39.2
#25 lore raw

PATCH 23/27 configure: don't check for mallinfo

In reply to Christoph Hellwig

mallinfo has been supported since the beginning in glibc.

---
 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(-)
configure.ac +0 -1
index 32efad760..0fa900d95 100644
@@ -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
include/builddefs.in +0 -1
index c359cde45..0df78f933 100644
@@ -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@
m4/package_libcdev.m4 +0 -20
index 320809a62..f29bdd76f 100644
@@ -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
 #
scrub/Makefile +0 -4
index f3e22a9d6..846774619 100644
@@ -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
scrub/xfs_scrub.c +0 -6
index 752180d64..736af2711 100644
@@ -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. */
Signature · 1 line
2.39.2
#26 lore raw

Re: [PATCH 23/27] configure: don't check for mallinfo

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

#27 lore raw

Re: [PATCH 23/27] configure: don't check for mallinfo

Quoted 2 lines · Sam James

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.

#28 lore raw

PATCH 24/27 configure: don't check for openat

In reply to Christoph Hellwig

openat has been supported since Linux 2.6.16 and glibc 2.4.

Note that xfs_db already uses it without the ifdef.

---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 14 --------------
 scrub/Makefile        |  4 ++--
 4 files changed, 2 insertions(+), 18 deletions(-)
configure.ac +0 -1
index 0fa900d95..47531fce5 100644
@@ -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
include/builddefs.in +0 -1
index 0df78f933..c768d0411 100644
@@ -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@
m4/package_libcdev.m4 +0 -14
index f29bdd76f..f857bcd94 100644
@@ -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
 #
scrub/Makefile +2 -2
index 846774619..1d613b946 100644
@@ -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)
 
 [email protected]
 
-ifeq ($(SCRUB_PREREQS),yesyesyes)
+ifeq ($(SCRUB_PREREQS),yesyes)
 LTCOMMAND = xfs_scrub
 INSTALL_SCRUB = install-scrub
 XFS_SCRUB_ALL_PROG = xfs_scrub_all
Signature · 1 line
2.39.2
#29 lore raw

PATCH 25/27 configure: don't check for fstatat

In reply to Christoph Hellwig

fstatat has been supported since Linux 2.6.16 and glibc 2.4.

---
 configure.ac          |  1 -
 include/builddefs.in  |  1 -
 m4/package_libcdev.m4 | 14 --------------
 scrub/Makefile        |  4 ++--
 4 files changed, 2 insertions(+), 18 deletions(-)
configure.ac +0 -1
index 47531fce5..260772a6b 100644
@@ -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
include/builddefs.in +0 -1
index c768d0411..e02600f09 100644
@@ -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@
m4/package_libcdev.m4 +0 -14
index f857bcd94..0ff05a04b 100644
@@ -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
 #
scrub/Makefile +2 -2
index 1d613b946..4eac20a13 100644
@@ -6,11 +6,11 @@ TOPDIR = ..
 builddefs=$(TOPDIR)/include/builddefs
 include $(builddefs)
 
-SCRUB_PREREQS=$(HAVE_FSTATAT)$(HAVE_GETFSMAP)
+SCRUB_PREREQS=$(HAVE_GETFSMAP)
 
 [email protected]
 
-ifeq ($(SCRUB_PREREQS),yesyes)
+ifeq ($(SCRUB_PREREQS),yes)
 LTCOMMAND = xfs_scrub
 INSTALL_SCRUB = install-scrub
 XFS_SCRUB_ALL_PROG = xfs_scrub_all
Signature · 1 line
2.39.2
#30 lore raw

PATCH 26/27 configure: don't check for SG_IO

In reply to Christoph Hellwig

SG_IO has been around longer than XFS.

---
 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(-)
configure.ac +0 -1
index 260772a6b..db967055b 100644
@@ -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
include/builddefs.in +0 -1
index e02600f09..61981fc6a 100644
@@ -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@
m4/package_libcdev.m4 +0 -19
index 0ff05a04b..a85894a11 100644
@@ -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
 #
scrub/Makefile +0 -4
index 4eac20a13..f9dfb016f 100644
@@ -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
scrub/disk.c +8 -14
index addb964d7..0ec29d965 100644
@@ -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
Signature · 1 line
2.39.2
#31 lore raw

PATCH 27/27 configure: don't check for HDIO_GETGEO

In reply to Christoph Hellwig

HDIO_GETGEO has been around longer than XFS.

---
 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(-)
configure.ac +0 -1
index db967055b..d85a6e774 100644
@@ -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
include/builddefs.in +0 -1
index 61981fc6a..aa69859c0 100644
@@ -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@
m4/package_libcdev.m4 +0 -19
index a85894a11..13dcdec1b 100644
@@ -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"
scrub/Makefile +0 -4
index f9dfb016f..9bb485f91 100644
@@ -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)
scrub/disk.c +1 -7
index 0ec29d965..2cf84d918 100644
@@ -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;
Signature · 1 line
2.39.2
Reviewed-by
#32 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

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,

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

--D

Quoted 33 lines

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