We have the data in the kernel, so we might just as well provide it to
user space.

Signed-off-by: Arnd Bergmann <[email protected]>
---
 fs/hfsplus/dir.c        |  1 +
 fs/hfsplus/hfsplus_fs.h |  2 ++
 fs/hfsplus/inode.c      | 14 ++++++++++++++
 3 files changed, 17 insertions(+)

diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index b5254378f011..df14b6dd5b5a 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -566,6 +566,7 @@ const struct inode_operations hfsplus_dir_inode_operations 
= {
        .symlink                = hfsplus_symlink,
        .mknod                  = hfsplus_mknod,
        .rename                 = hfsplus_rename,
+       .getattr                = hfsplus_getattr,
        .listxattr              = hfsplus_listxattr,
 #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
        .get_acl                = hfsplus_get_posix_acl,
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 646c207be38d..1a6b469f8d22 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -489,6 +489,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct 
hfs_find_data *fd);
 int hfsplus_cat_write_inode(struct inode *inode);
 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
                       int datasync);
+int hfsplus_getattr(const struct path *path, struct kstat *stat,
+                   u32 request_mask, unsigned int query_flags);
 
 /* ioctl.c */
 long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index c0c8d433864f..f9bb568f9479 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -276,6 +276,19 @@ static int hfsplus_setattr(struct dentry *dentry, struct 
iattr *attr)
        return 0;
 }
 
+int hfsplus_getattr(const struct path *path, struct kstat *stat,
+                    u32 request_mask, unsigned int query_flags)
+{
+       struct inode *inode = d_backing_inode(path->dentry);
+
+       generic_fillattr(inode, stat);
+
+       stat->btime = hfsp_mt2ut(HFSPLUS_I(inode)->create_date);
+       stat->result_mask |= STATX_BTIME;
+
+       return 0;
+}
+
 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
                       int datasync)
 {
@@ -335,6 +348,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, 
loff_t end,
 
 static const struct inode_operations hfsplus_file_inode_operations = {
        .setattr        = hfsplus_setattr,
+       .getattr        = hfsplus_getattr,
        .listxattr      = hfsplus_listxattr,
 #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
        .get_acl        = hfsplus_get_posix_acl,
-- 
2.9.0

_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038

Reply via email to