Skip to contentSkip to conversation

hfsplus: report create_date to kstat.btime

PATCH Applied Chung-Chiang Cheng 2 participants 3 messages Apr 16, 2021 – Jun 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hfsplus: report create_date to kstat.btime

The create_date field of inode in hfsplus is corresponding to kstat.btime and could be reported in statx.

---
 fs/hfsplus/inode.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/hfsplus/inode.c +5 -0
index 078c5c8a5156..aab3388a0fd7 100644
@@ -278,6 +278,11 @@ int hfsplus_getattr(struct user_namespace *mnt_userns, const struct path *path,
 	struct inode *inode = d_inode(path->dentry);
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 
+	if (request_mask & STATX_BTIME) {
+		stat->result_mask |= STATX_BTIME;
+		stat->btime = hfsp_mt2ut(hip->create_date);
+	}
+
 	if (inode->i_flags & S_APPEND)
 		stat->attributes |= STATX_ATTR_APPEND;
 	if (inode->i_flags & S_IMMUTABLE)
Signature · 1 line
2.25.1
#1 lore raw

From: Chung-Chiang Cheng <[email protected]>

There's no HFSPLUS maintainer now. Could anyone help to review this patch or give feedback?

Quoted 28 lines · Chung-Chiang Cheng

The create_date field of inode in hfsplus is corresponding to kstat.btime and could be reported in statx.

---
 fs/hfsplus/inode.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/hfsplus/inode.c +5 -1
index 078c5c8a5156..aab3388a0fd7 100644
@@ -278,6 +278,11 @@ int hfsplus_getattr(struct user_namespace *mnt_userns, const struct path *path,
        struct inode *inode = d_inode(path->dentry);
        struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 
+       if (request_mask & STATX_BTIME) {
+               stat->result_mask |= STATX_BTIME;
+               stat->btime = hfsp_mt2ut(hip->create_date);
+       }
+
        if (inode->i_flags & S_APPEND)
                stat->attributes |= STATX_ATTR_APPEND;
        if (inode->i_flags & S_IMMUTABLE)
--

2.25.1

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Chung-Chiang Cheng
Quoted 31 lines · Chung-Chiang Cheng

The create_date field of inode in hfsplus is corresponding to kstat.btime and could be reported in statx.

---
fs/hfsplus/inode.c | 5 +++++

1 file changed, 5 insertions(+)
fs/hfsplus/inode.c +5 -0
index 078c5c8a5156..aab3388a0fd7 100644
@@ -278,6 +278,11 @@ int hfsplus_getattr(struct user_namespace *mnt_userns, const struct path *path,
 	struct inode *inode = d_inode(path->dentry);
 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
 
+	if (request_mask & STATX_BTIME) {
+		stat->result_mask |= STATX_BTIME;
+		stat->btime = hfsp_mt2ut(hip->create_date);
+	}
+
 	if (inode->i_flags & S_APPEND)
 		stat->attributes |= STATX_ATTR_APPEND;
 	if (inode->i_flags & S_IMMUTABLE)
Signature · 1 line
2.25.1

Looks good for me.

Thanks,
Slava.