summaryrefslogtreecommitdiffstats
path: root/samples/statx
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-03-31 18:32:17 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2017-04-03 01:06:00 -0400
commit3209f68b3ca4667069923a325c88b21131bfdf9f (patch)
tree28807921a600cc5fd1ede24fcac669f0f0b2e994 /samples/statx
parent47071aee6a1956524b9929b3b821f6d2f8cae23c (diff)
downloadlinux-stable-3209f68b3ca4667069923a325c88b21131bfdf9f.tar.gz
linux-stable-3209f68b3ca4667069923a325c88b21131bfdf9f.tar.bz2
linux-stable-3209f68b3ca4667069923a325c88b21131bfdf9f.zip
statx: Include a mask for stx_attributes in struct statx
Include a mask in struct stat to indicate which bits of stx_attributes the filesystem actually supports. This would also be useful if we add another system call that allows you to do a 'bulk attribute set' and pass in a statx struct with the masks appropriately set to say what you want to set. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'samples/statx')
-rw-r--r--samples/statx/test-statx.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/samples/statx/test-statx.c b/samples/statx/test-statx.c
index 8571d766331d..d4d77b09412c 100644
--- a/samples/statx/test-statx.c
+++ b/samples/statx/test-statx.c
@@ -141,8 +141,8 @@ static void dump_statx(struct statx *stx)
if (stx->stx_mask & STATX_BTIME)
print_time(" Birth: ", &stx->stx_btime);
- if (stx->stx_attributes) {
- unsigned char bits;
+ if (stx->stx_attributes_mask) {
+ unsigned char bits, mbits;
int loop, byte;
static char attr_representation[64 + 1] =
@@ -160,14 +160,18 @@ static void dump_statx(struct statx *stx)
printf("Attributes: %016llx (", stx->stx_attributes);
for (byte = 64 - 8; byte >= 0; byte -= 8) {
bits = stx->stx_attributes >> byte;
+ mbits = stx->stx_attributes_mask >> byte;
for (loop = 7; loop >= 0; loop--) {
int bit = byte + loop;
- if (bits & 0x80)
+ if (!(mbits & 0x80))
+ putchar('.'); /* Not supported */
+ else if (bits & 0x80)
putchar(attr_representation[63 - bit]);
else
- putchar('-');
+ putchar('-'); /* Not set */
bits <<= 1;
+ mbits <<= 1;
}
if (byte)
putchar(' ');