Skip to content

Commit

Permalink
ubifs: Wire-up statx() support
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
richardweinberger committed Jul 14, 2017
1 parent d2eb852 commit a02a6eb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fs/ubifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a02a6eb

Please sign in to comment.