statfs: print f_flags field only when ST_VALID flag is set

* 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.
This commit is contained in:
Дмитрий Левин 2016-04-25 10:15:14 +00:00
parent 13c1d0899d
commit f3ac12990d
3 changed files with 14 additions and 8 deletions

View File

@ -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("}");
}

View 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

View 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