summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>2019-01-03 18:27:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-04 16:13:47 -0500
commitf93ca1ed9ba09fa54d372ab17649d781384e34f7 (patch)
tree6919f0f8e4f77102e4a0249095fb24b4d946b7e4
parentf5162216b7dab0c07e070b8b7f98891a85047f59 (diff)
hfsplus: return file attributes on statx
The immutable, append-only and no-dump attributes can only be retrieved with an ioctl; implement the ->getattr() method to return them on statx. Do not return the inode birthtime yet, because the issue of how best to handle the post-2038 timestamps is still under discussion. This patch is needed to pass xfstests generic/424. Link: http://lkml.kernel.org/r/20181014163558.sxorxlzjqccq2lpw@eaf Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com> Cc: Viacheslav Dubeyko <slava@dubeyko.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/hfsplus/dir.c1
-rw-r--r--fs/hfsplus/hfsplus_fs.h2
-rw-r--r--fs/hfsplus/inode.c21
3 files changed, 24 insertions, 0 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index f37662675c3a..29a9dcfbe81f 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -565,6 +565,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
565 .symlink = hfsplus_symlink, 565 .symlink = hfsplus_symlink,
566 .mknod = hfsplus_mknod, 566 .mknod = hfsplus_mknod,
567 .rename = hfsplus_rename, 567 .rename = hfsplus_rename,
568 .getattr = hfsplus_getattr,
568 .listxattr = hfsplus_listxattr, 569 .listxattr = hfsplus_listxattr,
569}; 570};
570 571
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index dd7ad9f13e3a..b8471bf05def 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -488,6 +488,8 @@ void hfsplus_inode_write_fork(struct inode *inode,
488 struct hfsplus_fork_raw *fork); 488 struct hfsplus_fork_raw *fork);
489int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); 489int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd);
490int hfsplus_cat_write_inode(struct inode *inode); 490int hfsplus_cat_write_inode(struct inode *inode);
491int hfsplus_getattr(const struct path *path, struct kstat *stat,
492 u32 request_mask, unsigned int query_flags);
491int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, 493int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
492 int datasync); 494 int datasync);
493 495
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index d7ab9d8c4b67..d131c8ea7eb6 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -270,6 +270,26 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
270 return 0; 270 return 0;
271} 271}
272 272
273int hfsplus_getattr(const struct path *path, struct kstat *stat,
274 u32 request_mask, unsigned int query_flags)
275{
276 struct inode *inode = d_inode(path->dentry);
277 struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
278
279 if (inode->i_flags & S_APPEND)
280 stat->attributes |= STATX_ATTR_APPEND;
281 if (inode->i_flags & S_IMMUTABLE)
282 stat->attributes |= STATX_ATTR_IMMUTABLE;
283 if (hip->userflags & HFSPLUS_FLG_NODUMP)
284 stat->attributes |= STATX_ATTR_NODUMP;
285
286 stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE |
287 STATX_ATTR_NODUMP;
288
289 generic_fillattr(inode, stat);
290 return 0;
291}
292
273int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, 293int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
274 int datasync) 294 int datasync)
275{ 295{
@@ -329,6 +349,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
329 349
330static const struct inode_operations hfsplus_file_inode_operations = { 350static const struct inode_operations hfsplus_file_inode_operations = {
331 .setattr = hfsplus_setattr, 351 .setattr = hfsplus_setattr,
352 .getattr = hfsplus_getattr,
332 .listxattr = hfsplus_listxattr, 353 .listxattr = hfsplus_listxattr,
333}; 354};
334 355