]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/xfs/xfs_iops.c
xfs: report crtime and attribute flags to statx
[karo-tx-linux.git] / fs / xfs / xfs_iops.c
index 22c16155f1b42a1380f85935fa43706cd60e2b40..ebfc13350f9ae8b43b0229948588192560b51683 100644 (file)
@@ -489,11 +489,12 @@ xfs_vn_get_link_inline(
 
 STATIC int
 xfs_vn_getattr(
-       struct vfsmount         *mnt,
-       struct dentry           *dentry,
-       struct kstat            *stat)
+       const struct path       *path,
+       struct kstat            *stat,
+       u32                     request_mask,
+       unsigned int            query_flags)
 {
-       struct inode            *inode = d_inode(dentry);
+       struct inode            *inode = d_inode(path->dentry);
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
 
@@ -515,6 +516,20 @@ xfs_vn_getattr(
        stat->blocks =
                XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
 
+       if (ip->i_d.di_version == 3) {
+               if (request_mask & STATX_BTIME) {
+                       stat->result_mask |= STATX_BTIME;
+                       stat->btime.tv_sec = ip->i_d.di_crtime.t_sec;
+                       stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec;
+               }
+       }
+
+       if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
+               stat->attributes |= STATX_ATTR_IMMUTABLE;
+       if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
+               stat->attributes |= STATX_ATTR_APPEND;
+       if (ip->i_d.di_flags & XFS_DIFLAG_NODUMP)
+               stat->attributes |= STATX_ATTR_NODUMP;
 
        switch (inode->i_mode & S_IFMT) {
        case S_IFBLK: