forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
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
....@@ -488,6 +488,8 @@
488488 struct hfsplus_fork_raw *fork);
489489 int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd);
490490 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);
491493 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
492494 int datasync);
493495
....@@ -531,13 +533,31 @@
531533 void **data, int op, int op_flags);
532534 int hfsplus_read_wrapper(struct super_block *sb);
533535
534
-/* time macros */
535
-#define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U)
536
-#define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U))
536
+/*
537
+ * time helpers: convert between 1904-base and 1970-base timestamps
538
+ *
539
+ * HFS+ implementations are highly inconsistent, this one matches the
540
+ * traditional behavior of 64-bit Linux, giving the most useful
541
+ * time range between 1970 and 2106, by treating any on-disk timestamp
542
+ * under HFSPLUS_UTC_OFFSET (Jan 1 1970) as a time between 2040 and 2106.
543
+ */
544
+#define HFSPLUS_UTC_OFFSET 2082844800U
545
+
546
+static inline time64_t __hfsp_mt2ut(__be32 mt)
547
+{
548
+ time64_t ut = (u32)(be32_to_cpu(mt) - HFSPLUS_UTC_OFFSET);
549
+
550
+ return ut;
551
+}
552
+
553
+static inline __be32 __hfsp_ut2mt(time64_t ut)
554
+{
555
+ return cpu_to_be32(lower_32_bits(ut) + HFSPLUS_UTC_OFFSET);
556
+}
537557
538558 /* compatibility */
539
-#define hfsp_mt2ut(t) (struct timespec){ .tv_sec = __hfsp_mt2ut(t) }
559
+#define hfsp_mt2ut(t) (struct timespec64){ .tv_sec = __hfsp_mt2ut(t) }
540560 #define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec)
541
-#define hfsp_now2mt() __hfsp_ut2mt(get_seconds())
561
+#define hfsp_now2mt() __hfsp_ut2mt(ktime_get_real_seconds())
542562
543563 #endif