]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fstrim: fix fs.h and mount.h collision
authorKarel Zak <kzak@redhat.com>
Tue, 20 Mar 2018 10:42:34 +0000 (11:42 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Mar 2018 10:42:34 +0000 (11:42 +0100)
Unfortunately, old version of the file linux/fs.h defines MS_*
macros, so the file cannot be included together with sys/mount.h.

We include sys/mount.h from libmount.h now.

Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
sys-utils/fstrim.c

index f828ae59b8a3cb49869a7977a59e4bdc8a2ba80a..0dbabf5d180586dedd757b19e50772f6c6839eab 100644 (file)
@@ -280,6 +280,16 @@ AC_CHECK_HEADERS([ \
        utmpx.h \
 ])
 
+# There is a collision in old kernel-headers. The both files mount.h and fs.h
+# define MS_* macros. Fixed by kernel commit e462ec50cb5fad19f6003a3d8087f4a0945dd2b1.
+#
+AC_CHECK_HEADERS([linux/fs.h ], [], [],
+ [#ifdef HAVE_SYS_MOUNT_H
+   # include <linux/fs.h>
+   # include <sys/mount.h>
+  #endif
+])
+
 AC_CHECK_HEADERS([linux/gsmmux.h ], [], [],
  [#ifdef LINUX_GSMMUX_H
    # include <linux/gsmmux.h>
@@ -306,7 +316,6 @@ AC_CHECK_HEADERS([langinfo.h],
                [AM_CONDITIONAL([HAVE_LANGINFO], [true])],
                [AM_CONDITIONAL([HAVE_LANGINFO], [false])])
 
-
 AC_MSG_CHECKING([whether langinfo.h defines ALTMON_x constants])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        #include <langinfo.h>
index 98708d533e8ea982c686e2dee66db4af5a90a5bc..ca8cf256ded459b8265de861039ddd7722b1cb10 100644 (file)
 
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-#include <linux/fs.h>
+
+#ifdef HAVE_SYS_FS_H
+# include <linux/fs.h>
+#endif
 
 #include "nls.h"
 #include "strutils.h"