Skip to contentSkip to conversation

xfs_io: stat: fix typo in statfs->f_flags

PATCH In review [email protected] 2 participants 6 messages Nov 17, 2017 – Nov 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xfs_io: stat: fix typo in statfs->f_flags

From: Jeff Mahoney <[email protected]>

The field name is f_flags.

---
 io/stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/stat.c +1 -1
index 060ff833..6ab10abf 100644
@@ -199,7 +199,7 @@ 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);
-		printf(_("statfs.f_fflags = 0x%llx\n"), (long long) st.f_flags);
+		printf(_("statfs.f_flags = 0x%llx\n"), (long long) st.f_flags);
 	}
 	if (file->flags & IO_FOREIGN)
 		return 0;
Signature · 1 line
2.14.2
#1 lore raw

PATCH 2/2 xfs_io: stat: treat statfs.f_flags as optional

From: Jeff Mahoney <[email protected]>

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.

---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 io/stat.c             |  2 ++
 m4/package_libcdev.m4 | 14 ++++++++++++++
 4 files changed, 18 insertions(+)
configure.ac +1 -0
index 4161c3b4..939d802b 100644
@@ -143,6 +143,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
include/builddefs.in +1 -0
index ec630bd9..13756d79 100644
@@ -113,6 +113,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
io/stat.c +2 -0
index 6ab10abf..1ca5b0d6 100644
@@ -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;
m4/package_libcdev.m4 +14 -0
index fa5b6397..bc395acd 100644
@@ -297,3 +297,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)
+  ])
Signature · 1 line
2.14.2
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] xfs_io: stat: treat statfs.f_flags as optional

Quoted 5 lines · On 11/17/17 1:54 PM, [email protected] wrote:

From: Jeff Mahoney <[email protected]>

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.

You all are brave ;)

#3 lore raw

Re: [PATCH 2/2] xfs_io: stat: treat statfs.f_flags as optional

Quoted 5 lines · Eric Sandeen
Quoted 2 lines · On 11/17/17 1:54 PM, [email protected] wrote:

From: Jeff Mahoney <[email protected]>

Quoted 7 lines
Quoted 3 lines

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.

You all are brave ;)

Oops, but not tested-by! This also needs:

io/Makefile +4 -0
index 050d6bd..6725936 100644
@@ -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)

but I can add it on the way in.

-Eric

#4 lore raw

Re: [PATCH 2/2] xfs_io: stat: treat statfs.f_flags as optional

Quoted 35 lines · Eric Sandeen
Quoted 5 lines · Eric Sandeen
Quoted 2 lines · On 11/17/17 1:54 PM, [email protected] wrote:

From: Jeff Mahoney <[email protected]>

Quoted 7 lines
Quoted 3 lines

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.

You all are brave ;)

Oops, but not tested-by! This also needs:

io/Makefile +4 -0
index 050d6bd..6725936 100644
@@ -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)
Quoted 1 line

but I can add it on the way in.

Ah, right. My build tests all succeeded because it was just skipping f_flags.

Thanks,

-Jeff

Signature · 2 lines
Jeff Mahoney
SUSE Labs
Reviewed-by on v1 1/2
#5 lore raw
In reply to [email protected]
Quoted 5 lines · On 11/17/17 1:54 PM, [email protected] wrote:

From: Jeff Mahoney <[email protected]>

The field name is f_flags.

Quoted 18 lines
---
 io/stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/stat.c +1 -1
index 060ff833..6ab10abf 100644
@@ -199,7 +199,7 @@ 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);
-		printf(_("statfs.f_fflags = 0x%llx\n"), (long long) st.f_flags);
+		printf(_("statfs.f_flags = 0x%llx\n"), (long long) st.f_flags);
 	}
 	if (file->flags & IO_FOREIGN)
 		return 0;