hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/hfsplus/hfsplus_fs.h
....@@ -117,7 +117,7 @@
117117 wait_queue_head_t lock_wq;
118118 atomic_t refcnt;
119119 unsigned int page_offset;
120
- struct page *page[0];
120
+ struct page *page[];
121121 };
122122
123123 #define HFS_BNODE_LOCK 0
....@@ -198,6 +198,8 @@
198198 #define HFSPLUS_SB_HFSX 3
199199 #define HFSPLUS_SB_CASEFOLD 4
200200 #define HFSPLUS_SB_NOBARRIER 5
201
+#define HFSPLUS_SB_UID 6
202
+#define HFSPLUS_SB_GID 7
201203
202204 static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb)
203205 {
....@@ -488,6 +490,8 @@
488490 struct hfsplus_fork_raw *fork);
489491 int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd);
490492 int hfsplus_cat_write_inode(struct inode *inode);
493
+int hfsplus_getattr(const struct path *path, struct kstat *stat,
494
+ u32 request_mask, unsigned int query_flags);
491495 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
492496 int datasync);
493497
....@@ -531,13 +535,31 @@
531535 void **data, int op, int op_flags);
532536 int hfsplus_read_wrapper(struct super_block *sb);
533537
534
-/* time macros */
535
-#define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U)
536
-#define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U))
538
+/*
539
+ * time helpers: convert between 1904-base and 1970-base timestamps
540
+ *
541
+ * HFS+ implementations are highly inconsistent, this one matches the
542
+ * traditional behavior of 64-bit Linux, giving the most useful
543
+ * time range between 1970 and 2106, by treating any on-disk timestamp
544
+ * under HFSPLUS_UTC_OFFSET (Jan 1 1970) as a time between 2040 and 2106.
545
+ */
546
+#define HFSPLUS_UTC_OFFSET 2082844800U
547
+
548
+static inline time64_t __hfsp_mt2ut(__be32 mt)
549
+{
550
+ time64_t ut = (u32)(be32_to_cpu(mt) - HFSPLUS_UTC_OFFSET);
551
+
552
+ return ut;
553
+}
554
+
555
+static inline __be32 __hfsp_ut2mt(time64_t ut)
556
+{
557
+ return cpu_to_be32(lower_32_bits(ut) + HFSPLUS_UTC_OFFSET);
558
+}
537559
538560 /* compatibility */
539
-#define hfsp_mt2ut(t) (struct timespec){ .tv_sec = __hfsp_mt2ut(t) }
561
+#define hfsp_mt2ut(t) (struct timespec64){ .tv_sec = __hfsp_mt2ut(t) }
540562 #define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec)
541
-#define hfsp_now2mt() __hfsp_ut2mt(get_seconds())
563
+#define hfsp_now2mt() __hfsp_ut2mt(ktime_get_real_seconds())
542564
543565 #endif