hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/fs/hfsplus/inode.c
....@@ -270,6 +270,26 @@
270270 return 0;
271271 }
272272
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
+
273293 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
274294 int datasync)
275295 {
....@@ -320,7 +340,7 @@
320340 }
321341
322342 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
323
- blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
343
+ blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL);
324344
325345 inode_unlock(inode);
326346
....@@ -329,6 +349,7 @@
329349
330350 static const struct inode_operations hfsplus_file_inode_operations = {
331351 .setattr = hfsplus_setattr,
352
+ .getattr = hfsplus_getattr,
332353 .listxattr = hfsplus_listxattr,
333354 };
334355
....@@ -483,9 +504,9 @@
483504 hfsplus_get_perms(inode, &folder->permissions, 1);
484505 set_nlink(inode, 1);
485506 inode->i_size = 2 + be32_to_cpu(folder->valence);
486
- inode->i_atime = timespec_to_timespec64(hfsp_mt2ut(folder->access_date));
487
- inode->i_mtime = timespec_to_timespec64(hfsp_mt2ut(folder->content_mod_date));
488
- inode->i_ctime = timespec_to_timespec64(hfsp_mt2ut(folder->attribute_mod_date));
507
+ inode->i_atime = hfsp_mt2ut(folder->access_date);
508
+ inode->i_mtime = hfsp_mt2ut(folder->content_mod_date);
509
+ inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date);
489510 HFSPLUS_I(inode)->create_date = folder->create_date;
490511 HFSPLUS_I(inode)->fs_blocks = 0;
491512 if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
....@@ -521,9 +542,9 @@
521542 init_special_inode(inode, inode->i_mode,
522543 be32_to_cpu(file->permissions.dev));
523544 }
524
- inode->i_atime = timespec_to_timespec64(hfsp_mt2ut(file->access_date));
525
- inode->i_mtime = timespec_to_timespec64(hfsp_mt2ut(file->content_mod_date));
526
- inode->i_ctime = timespec_to_timespec64(hfsp_mt2ut(file->attribute_mod_date));
545
+ inode->i_atime = hfsp_mt2ut(file->access_date);
546
+ inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
547
+ inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date);
527548 HFSPLUS_I(inode)->create_date = file->create_date;
528549 } else {
529550 pr_err("bad catalog entry used to create inode\n");