]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ubifs: Wire-up statx() support
authorRichard Weinberger <richard@nod.at>
Sat, 20 May 2017 22:16:26 +0000 (00:16 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 14 Jul 2017 20:49:07 +0000 (22:49 +0200)
statx() can report what flags a file has, expose flags that UBIFS
supports. Especially STATX_ATTR_COMPRESSED and STATX_ATTR_ENCRYPTED
can be interesting for userspace.

Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/dir.c

index 90a3f01c55d1dbcff3b9be6518a2ff88e98dcc1a..417fe0b29f23e9068d623a4e5fc582835373199c 100644 (file)
@@ -1644,6 +1644,21 @@ int ubifs_getattr(const struct path *path, struct kstat *stat,
        struct ubifs_inode *ui = ubifs_inode(inode);
 
        mutex_lock(&ui->ui_mutex);
+
+       if (ui->flags & UBIFS_APPEND_FL)
+               stat->attributes |= STATX_ATTR_APPEND;
+       if (ui->flags & UBIFS_COMPR_FL)
+               stat->attributes |= STATX_ATTR_COMPRESSED;
+       if (ui->flags & UBIFS_CRYPT_FL)
+               stat->attributes |= STATX_ATTR_ENCRYPTED;
+       if (ui->flags & UBIFS_IMMUTABLE_FL)
+               stat->attributes |= STATX_ATTR_IMMUTABLE;
+
+       stat->attributes_mask |= (STATX_ATTR_APPEND |
+                               STATX_ATTR_COMPRESSED |
+                               STATX_ATTR_ENCRYPTED |
+                               STATX_ATTR_IMMUTABLE);
+
        generic_fillattr(inode, stat);
        stat->blksize = UBIFS_BLOCK_SIZE;
        stat->size = ui->ui_size;