]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: stat: treat statfs.f_flags as optional
authorJeff Mahoney <jeffm@suse.com>
Mon, 20 Nov 2017 19:54:02 +0000 (13:54 -0600)
committerEric Sandeen <sandeen@redhat.com>
Mon, 20 Nov 2017 19:54:02 +0000 (13:54 -0600)
Kernels prior to 2.6.36 didn't contain statfs.f_flags.  Distros with
initial releases with kernels prior to this may not have updated
headers with this member.  Only attempt to print it if we have the
header with the member defined.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
[sandeen: define HAVE_STATFS_FLAGS in io/Makefile]
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
configure.ac
include/builddefs.in
io/Makefile
io/stat.c
m4/package_libcdev.m4

index 6678207a1fff012841cc3d5f0ccaf1a5fa2730e5..bf3011770286beaad658568ce89901eb4154289d 100644 (file)
@@ -162,6 +162,7 @@ AC_HAVE_FSETXATTR
 AC_HAVE_MREMAP
 AC_NEED_INTERNAL_FSXATTR
 AC_HAVE_GETFSMAP
+AC_HAVE_STATFS_FLAGS
 
 if test "$enable_blkid" = yes; then
 AC_HAVE_BLKID_TOPO
index 1d454b6ebff20337143ecf8aae39d8ff7e9a452e..fd274ddc66d80bd70180632753087117128d73fd 100644 (file)
@@ -114,6 +114,7 @@ HAVE_FSETXATTR = @have_fsetxattr@
 HAVE_MREMAP = @have_mremap@
 NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
 HAVE_GETFSMAP = @have_getfsmap@
+HAVE_STATFS_FLAGS = @have_statfs_flags@
 
 GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
 #         -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
index 050d6bd0124e93606e91f1e76a56aae42d15d7a4..6725936d82cd2a325a062ce73177fc1ae3aa4caa 100644 (file)
@@ -110,6 +110,10 @@ ifeq ($(PKG_PLATFORM),linux)
 CFILES += fsmap.c
 endif
 
+ifeq ($(HAVE_STATFS_FLAGS),yes)
+LCFLAGS += -DHAVE_STATFS_FLAGS
+endif
+
 default: depend $(LTCOMMAND)
 
 include $(BUILDRULES)
index ffe285c45da56b2b316a32bf0292c6445d013d8b..41d421525791ce3ef6560481ed7d24465f44329f 100644 (file)
--- a/io/stat.c
+++ b/io/stat.c
@@ -199,7 +199,9 @@ statfs_f(
                printf(_("statfs.f_bavail = %lld\n"), (long long) st.f_bavail);
                printf(_("statfs.f_files = %lld\n"), (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
        }
        if (file->flags & IO_FOREIGN)
                return 0;
index fdf9d69c245ac873ede0fa3046b8baae1773ccdb..7b4dfc85531d2cbca35a2f6a82919628f3b8989c 100644 (file)
@@ -314,3 +314,17 @@ AC_DEFUN([AC_HAVE_GETFSMAP],
        AC_MSG_RESULT(no))
     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)
+  ])