summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu2017-05-03 17:59:12 +0200
committerJaegeuk Kim2017-05-24 06:05:34 +0200
commit1c6d8ee4b8aaadc3645497658007ca007312351d (patch)
tree247588682c45f504e0460a237ffb081ebd504142 /fs/f2fs
parentf2fs: load inode's flag from disk (diff)
downloadkernel-qcow2-linux-1c6d8ee4b8aaadc3645497658007ca007312351d.tar.gz
kernel-qcow2-linux-1c6d8ee4b8aaadc3645497658007ca007312351d.tar.xz
kernel-qcow2-linux-1c6d8ee4b8aaadc3645497658007ca007312351d.zip
f2fs: support statx
Last kernel has already support new syscall statx() in commit a528d35e8bfc ("statx: Add a system call to make enhanced file info available"), with this interface we can show more file info including file creation and some attribute flags to user. This patch tries to support this functionality. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/file.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9b3e7635222c..8ccbfe53c03c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -633,9 +633,30 @@ int f2fs_truncate(struct inode *inode)
}
int f2fs_getattr(const struct path *path, struct kstat *stat,
- u32 request_mask, unsigned int flags)
+ u32 request_mask, unsigned int query_flags)
{
struct inode *inode = d_inode(path->dentry);
+ struct f2fs_inode_info *fi = F2FS_I(inode);
+ unsigned int flags;
+
+ flags = fi->i_flags & FS_FL_USER_VISIBLE;
+ if (flags & FS_APPEND_FL)
+ stat->attributes |= STATX_ATTR_APPEND;
+ if (flags & FS_COMPR_FL)
+ stat->attributes |= STATX_ATTR_COMPRESSED;
+ if (f2fs_encrypted_inode(inode))
+ stat->attributes |= STATX_ATTR_ENCRYPTED;
+ if (flags & FS_IMMUTABLE_FL)
+ stat->attributes |= STATX_ATTR_IMMUTABLE;
+ if (flags & FS_NODUMP_FL)
+ stat->attributes |= STATX_ATTR_NODUMP;
+
+ stat->attributes_mask |= (STATX_ATTR_APPEND |
+ STATX_ATTR_COMPRESSED |
+ STATX_ATTR_ENCRYPTED |
+ STATX_ATTR_IMMUTABLE |
+ STATX_ATTR_NODUMP);
+
generic_fillattr(inode, stat);
stat->blocks <<= 3;
return 0;