]> granicus.if.org Git - strace/commitdiff
statfs: print f_flags field only when ST_VALID flag is set
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 25 Apr 2016 10:15:14 +0000 (10:15 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 25 Apr 2016 10:30:03 +0000 (10:30 +0000)
* statfs.c (print_statfs_flags): New function.
(printstatfs, printstatfs64, printcompat_statfs64): Use it.
* xlat/statfs_flags.in (ST_VALID): Move to the head of the list.
* tests/statfs.expected: Update.

statfs.c
tests/statfs.expected
xlat/statfs_flags.in

index 706e0990af9e1e16f3a69dbc38933ea5c054c0e6..73892b6c2ac8ced77e8c016d8bb2199e350054f4 100644 (file)
--- a/statfs.c
+++ b/statfs.c
@@ -51,6 +51,15 @@ sprintfstype(const unsigned int magic)
        return buf;
 }
 
+static void
+print_statfs_flags(const char *const prefix, const unsigned int flags)
+{
+       if (flags & ST_VALID) {
+               tprints(prefix);
+               printflags(statfs_flags, flags, "ST_???");
+       }
+}
+
 static void
 printstatfs(struct tcb *tcp, const long addr)
 {
@@ -73,8 +82,7 @@ printstatfs(struct tcb *tcp, const long addr)
        tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
 #endif
 #ifdef _STATFS_F_FLAGS
-       tprints(", f_flags=");
-       printflags(statfs_flags, statbuf.f_flags, "ST_???");
+       print_statfs_flags(", f_flags=", statbuf.f_flags);
 #endif
        tprints("}");
 }
@@ -124,8 +132,7 @@ printstatfs64(struct tcb *tcp, long addr)
        tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
 #endif
 #ifdef _STATFS_F_FLAGS
-       tprints(", f_flags=");
-       printflags(statfs_flags, statbuf.f_flags, "ST_???");
+       print_statfs_flags(", f_flags=", statbuf.f_flags);
 #endif
        tprints("}");
 }
@@ -172,8 +179,7 @@ printcompat_statfs64(struct tcb *tcp, const long addr)
                statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
        tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
        tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
-       tprints(", f_flags=");
-       printflags(statfs_flags, statbuf.f_flags, "ST_???");
+       print_statfs_flags(", f_flags=", statbuf.f_flags);
        tprints("}");
 }
 
index 9decc1ab24d205458e8c241794a28aa3316b271d..0fa45109d1b194ffe9ac4df845d773f76bb293b1 100644 (file)
@@ -1 +1 @@
-statfs(64)?\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type=PROC_SUPER_MAGIC, f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=(0|ST_[A-Z]+(\|ST_[A-Z]+)*))?\}\) += 0
+statfs(64)?\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type=PROC_SUPER_MAGIC, f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=ST_VALID(\|ST_[A-Z]+)*)?\}\) += 0
index 2b427c3dc5d62ad049e385b137667225574dac98..f791a60e5f1768e516b57a658db52e29c1f644fe 100644 (file)
@@ -1,9 +1,9 @@
+ST_VALID       0x0020
 ST_RDONLY      0x0001
 ST_NOSUID      0x0002
 ST_NODEV       0x0004
 ST_NOEXEC      0x0008
 ST_SYNCHRONOUS 0x0010
-ST_VALID       0x0020
 ST_MANDLOCK    0x0040
 ST_NOATIME     0x0400
 ST_NODIRATIME  0x0800