Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ernesto A. Fernández and committed by
Linus Torvalds
f93ca1ed f5162216

+24
+1
fs/hfsplus/dir.c
··· 565 565 .symlink = hfsplus_symlink, 566 566 .mknod = hfsplus_mknod, 567 567 .rename = hfsplus_rename, 568 + .getattr = hfsplus_getattr, 568 569 .listxattr = hfsplus_listxattr, 569 570 }; 570 571
+2
fs/hfsplus/hfsplus_fs.h
··· 488 488 struct hfsplus_fork_raw *fork); 489 489 int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); 490 490 int hfsplus_cat_write_inode(struct inode *inode); 491 + int hfsplus_getattr(const struct path *path, struct kstat *stat, 492 + u32 request_mask, unsigned int query_flags); 491 493 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, 492 494 int datasync); 493 495
+21
fs/hfsplus/inode.c
··· 270 270 return 0; 271 271 } 272 272 273 + int 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 + 273 293 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, 274 294 int datasync) 275 295 { ··· 349 329 350 330 static const struct inode_operations hfsplus_file_inode_operations = { 351 331 .setattr = hfsplus_setattr, 332 + .getattr = hfsplus_getattr, 352 333 .listxattr = hfsplus_listxattr, 353 334 }; 354 335