1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * linux/include/linux/hfsplus_fs.h 4 * 5 * Copyright (C) 1999 6 * Brad Boyer (flar@pants.nu) 7 * (C) 2003 Ardis Technologies <roman@ardistech.com> 8 * 9 */ 10 11 #ifndef _LINUX_HFSPLUS_FS_H 12 #define _LINUX_HFSPLUS_FS_H 13 14 #ifdef pr_fmt 15 #undef pr_fmt 16 #endif 17 18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 19 20 #include <linux/fs.h> 21 #include <linux/mutex.h> 22 #include <linux/buffer_head.h> 23 #include <linux/blkdev.h> 24 #include <linux/fs_context.h> 25 #include "hfsplus_raw.h" 26 27 #define DBG_BNODE_REFS 0x00000001 28 #define DBG_BNODE_MOD 0x00000002 29 #define DBG_CAT_MOD 0x00000004 30 #define DBG_INODE 0x00000008 31 #define DBG_SUPER 0x00000010 32 #define DBG_EXTENT 0x00000020 33 #define DBG_BITMAP 0x00000040 34 #define DBG_ATTR_MOD 0x00000080 35 36 #if 0 37 #define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD) 38 #define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) 39 #define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) 40 #endif 41 #define DBG_MASK (0) 42 43 #define hfs_dbg(flg, fmt, ...) \ 44 do { \ 45 if (DBG_##flg & DBG_MASK) \ 46 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ 47 } while (0) 48 49 #define hfs_dbg_cont(flg, fmt, ...) \ 50 do { \ 51 if (DBG_##flg & DBG_MASK) \ 52 pr_cont(fmt, ##__VA_ARGS__); \ 53 } while (0) 54 55 /* Runtime config options */ 56 #define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */ 57 58 #define HFSPLUS_TYPE_DATA 0x00 59 #define HFSPLUS_TYPE_RSRC 0xFF 60 61 typedef int (*btree_keycmp)(const hfsplus_btree_key *, 62 const hfsplus_btree_key *); 63 64 #define NODE_HASH_SIZE 256 65 66 /* B-tree mutex nested subclasses */ 67 enum hfsplus_btree_mutex_classes { 68 CATALOG_BTREE_MUTEX, 69 EXTENTS_BTREE_MUTEX, 70 ATTR_BTREE_MUTEX, 71 }; 72 73 /* An HFS+ BTree held in memory */ 74 struct hfs_btree { 75 struct super_block *sb; 76 struct inode *inode; 77 btree_keycmp keycmp; 78 79 u32 cnid; 80 u32 root; 81 u32 leaf_count; 82 u32 leaf_head; 83 u32 leaf_tail; 84 u32 node_count; 85 u32 free_nodes; 86 u32 attributes; 87 88 unsigned int node_size; 89 unsigned int node_size_shift; 90 unsigned int max_key_len; 91 unsigned int depth; 92 93 struct mutex tree_lock; 94 95 unsigned int pages_per_bnode; 96 spinlock_t hash_lock; 97 struct hfs_bnode *node_hash[NODE_HASH_SIZE]; 98 int node_hash_cnt; 99 }; 100 101 struct page; 102 103 /* An HFS+ BTree node in memory */ 104 struct hfs_bnode { 105 struct hfs_btree *tree; 106 107 u32 prev; 108 u32 this; 109 u32 next; 110 u32 parent; 111 112 u16 num_recs; 113 u8 type; 114 u8 height; 115 116 struct hfs_bnode *next_hash; 117 unsigned long flags; 118 wait_queue_head_t lock_wq; 119 atomic_t refcnt; 120 unsigned int page_offset; 121 struct page *page[]; 122 }; 123 124 #define HFS_BNODE_LOCK 0 125 #define HFS_BNODE_ERROR 1 126 #define HFS_BNODE_NEW 2 127 #define HFS_BNODE_DIRTY 3 128 #define HFS_BNODE_DELETED 4 129 130 /* 131 * Attributes file states 132 */ 133 #define HFSPLUS_EMPTY_ATTR_TREE 0 134 #define HFSPLUS_CREATING_ATTR_TREE 1 135 #define HFSPLUS_VALID_ATTR_TREE 2 136 #define HFSPLUS_FAILED_ATTR_TREE 3 137 138 /* 139 * HFS+ superblock info (built from Volume Header on disk) 140 */ 141 142 struct hfsplus_vh; 143 struct hfs_btree; 144 145 struct hfsplus_sb_info { 146 void *s_vhdr_buf; 147 struct hfsplus_vh *s_vhdr; 148 void *s_backup_vhdr_buf; 149 struct hfsplus_vh *s_backup_vhdr; 150 struct hfs_btree *ext_tree; 151 struct hfs_btree *cat_tree; 152 struct hfs_btree *attr_tree; 153 atomic_t attr_tree_state; 154 struct inode *alloc_file; 155 struct inode *hidden_dir; 156 struct nls_table *nls; 157 158 /* Runtime variables */ 159 u32 blockoffset; 160 u32 min_io_size; 161 sector_t part_start; 162 sector_t sect_count; 163 int fs_shift; 164 165 /* immutable data from the volume header */ 166 u32 alloc_blksz; 167 int alloc_blksz_shift; 168 u32 total_blocks; 169 u32 data_clump_blocks, rsrc_clump_blocks; 170 171 /* mutable data from the volume header, protected by alloc_mutex */ 172 u32 free_blocks; 173 struct mutex alloc_mutex; 174 175 /* mutable data from the volume header, protected by vh_mutex */ 176 u32 next_cnid; 177 u32 file_count; 178 u32 folder_count; 179 struct mutex vh_mutex; 180 181 /* Config options */ 182 u32 creator; 183 u32 type; 184 185 umode_t umask; 186 kuid_t uid; 187 kgid_t gid; 188 189 int part, session; 190 unsigned long flags; 191 192 int work_queued; /* non-zero delayed work is queued */ 193 struct delayed_work sync_work; /* FS sync delayed work */ 194 spinlock_t work_lock; /* protects sync_work and work_queued */ 195 struct rcu_head rcu; 196 }; 197 198 #define HFSPLUS_SB_WRITEBACKUP 0 199 #define HFSPLUS_SB_NODECOMPOSE 1 200 #define HFSPLUS_SB_FORCE 2 201 #define HFSPLUS_SB_HFSX 3 202 #define HFSPLUS_SB_CASEFOLD 4 203 #define HFSPLUS_SB_NOBARRIER 5 204 #define HFSPLUS_SB_UID 6 205 #define HFSPLUS_SB_GID 7 206 207 static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) 208 { 209 return sb->s_fs_info; 210 } 211 212 213 struct hfsplus_inode_info { 214 atomic_t opencnt; 215 216 /* 217 * Extent allocation information, protected by extents_lock. 218 */ 219 u32 first_blocks; 220 u32 clump_blocks; 221 u32 alloc_blocks; 222 u32 cached_start; 223 u32 cached_blocks; 224 hfsplus_extent_rec first_extents; 225 hfsplus_extent_rec cached_extents; 226 unsigned int extent_state; 227 struct mutex extents_lock; 228 229 /* 230 * Immutable data. 231 */ 232 struct inode *rsrc_inode; 233 __be32 create_date; 234 235 /* 236 * Protected by sbi->vh_mutex. 237 */ 238 u32 linkid; 239 240 /* 241 * Accessed using atomic bitops. 242 */ 243 unsigned long flags; 244 245 /* 246 * Protected by i_mutex. 247 */ 248 sector_t fs_blocks; 249 u8 userflags; /* BSD user file flags */ 250 u32 subfolders; /* Subfolder count (HFSX only) */ 251 struct list_head open_dir_list; 252 spinlock_t open_dir_lock; 253 loff_t phys_size; 254 255 struct inode vfs_inode; 256 }; 257 258 #define HFSPLUS_EXT_DIRTY 0x0001 259 #define HFSPLUS_EXT_NEW 0x0002 260 261 #define HFSPLUS_I_RSRC 0 /* represents a resource fork */ 262 #define HFSPLUS_I_CAT_DIRTY 1 /* has changes in the catalog tree */ 263 #define HFSPLUS_I_EXT_DIRTY 2 /* has changes in the extent tree */ 264 #define HFSPLUS_I_ALLOC_DIRTY 3 /* has changes in the allocation file */ 265 #define HFSPLUS_I_ATTR_DIRTY 4 /* has changes in the attributes tree */ 266 267 #define HFSPLUS_IS_RSRC(inode) \ 268 test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags) 269 270 static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) 271 { 272 return container_of(inode, struct hfsplus_inode_info, vfs_inode); 273 } 274 275 /* 276 * Mark an inode dirty, and also mark the btree in which the 277 * specific type of metadata is stored. 278 * For data or metadata that gets written back by into the catalog btree 279 * by hfsplus_write_inode a plain mark_inode_dirty call is enough. 280 */ 281 static inline void hfsplus_mark_inode_dirty(struct inode *inode, 282 unsigned int flag) 283 { 284 set_bit(flag, &HFSPLUS_I(inode)->flags); 285 mark_inode_dirty(inode); 286 } 287 288 struct hfs_find_data { 289 /* filled by caller */ 290 hfsplus_btree_key *search_key; 291 hfsplus_btree_key *key; 292 /* filled by find */ 293 struct hfs_btree *tree; 294 struct hfs_bnode *bnode; 295 /* filled by findrec */ 296 int record; 297 int keyoffset, keylength; 298 int entryoffset, entrylength; 299 }; 300 301 struct hfsplus_readdir_data { 302 struct list_head list; 303 struct file *file; 304 struct hfsplus_cat_key key; 305 }; 306 307 /* 308 * Find minimum acceptible I/O size for an hfsplus sb. 309 */ 310 static inline unsigned short hfsplus_min_io_size(struct super_block *sb) 311 { 312 return max_t(unsigned short, HFSPLUS_SB(sb)->min_io_size, 313 HFSPLUS_SECTOR_SIZE); 314 } 315 316 #define hfs_btree_open hfsplus_btree_open 317 #define hfs_btree_close hfsplus_btree_close 318 #define hfs_btree_write hfsplus_btree_write 319 #define hfs_bmap_reserve hfsplus_bmap_reserve 320 #define hfs_bmap_alloc hfsplus_bmap_alloc 321 #define hfs_bmap_free hfsplus_bmap_free 322 #define hfs_bnode_read hfsplus_bnode_read 323 #define hfs_bnode_read_u16 hfsplus_bnode_read_u16 324 #define hfs_bnode_read_u8 hfsplus_bnode_read_u8 325 #define hfs_bnode_read_key hfsplus_bnode_read_key 326 #define hfs_bnode_write hfsplus_bnode_write 327 #define hfs_bnode_write_u16 hfsplus_bnode_write_u16 328 #define hfs_bnode_clear hfsplus_bnode_clear 329 #define hfs_bnode_copy hfsplus_bnode_copy 330 #define hfs_bnode_move hfsplus_bnode_move 331 #define hfs_bnode_dump hfsplus_bnode_dump 332 #define hfs_bnode_unlink hfsplus_bnode_unlink 333 #define hfs_bnode_findhash hfsplus_bnode_findhash 334 #define hfs_bnode_find hfsplus_bnode_find 335 #define hfs_bnode_unhash hfsplus_bnode_unhash 336 #define hfs_bnode_free hfsplus_bnode_free 337 #define hfs_bnode_create hfsplus_bnode_create 338 #define hfs_bnode_get hfsplus_bnode_get 339 #define hfs_bnode_put hfsplus_bnode_put 340 #define hfs_brec_lenoff hfsplus_brec_lenoff 341 #define hfs_brec_keylen hfsplus_brec_keylen 342 #define hfs_brec_insert hfsplus_brec_insert 343 #define hfs_brec_remove hfsplus_brec_remove 344 #define hfs_find_init hfsplus_find_init 345 #define hfs_find_exit hfsplus_find_exit 346 #define __hfs_brec_find __hfsplus_brec_find 347 #define hfs_brec_find hfsplus_brec_find 348 #define hfs_brec_read hfsplus_brec_read 349 #define hfs_brec_goto hfsplus_brec_goto 350 #define hfs_part_find hfsplus_part_find 351 352 /* 353 * hfs+-specific ioctl for making the filesystem bootable 354 */ 355 #define HFSPLUS_IOC_BLESS _IO('h', 0x80) 356 357 typedef int (*search_strategy_t)(struct hfs_bnode *, 358 struct hfs_find_data *, 359 int *, int *, int *); 360 361 /* 362 * Functions in any *.c used in other files 363 */ 364 365 /* attributes.c */ 366 int __init hfsplus_create_attr_tree_cache(void); 367 void hfsplus_destroy_attr_tree_cache(void); 368 int hfsplus_attr_bin_cmp_key(const hfsplus_btree_key *k1, 369 const hfsplus_btree_key *k2); 370 int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key, 371 u32 cnid, const char *name); 372 hfsplus_attr_entry *hfsplus_alloc_attr_entry(void); 373 void hfsplus_destroy_attr_entry(hfsplus_attr_entry *entry); 374 int hfsplus_find_attr(struct super_block *sb, u32 cnid, const char *name, 375 struct hfs_find_data *fd); 376 int hfsplus_attr_exists(struct inode *inode, const char *name); 377 int hfsplus_create_attr(struct inode *inode, const char *name, 378 const void *value, size_t size); 379 int hfsplus_delete_attr(struct inode *inode, const char *name); 380 int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid); 381 382 /* bitmap.c */ 383 int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, 384 u32 *max); 385 int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count); 386 387 /* btree.c */ 388 u32 hfsplus_calc_btree_clump_size(u32 block_size, u32 node_size, u64 sectors, 389 int file_id); 390 struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id); 391 void hfs_btree_close(struct hfs_btree *tree); 392 int hfs_btree_write(struct hfs_btree *tree); 393 int hfs_bmap_reserve(struct hfs_btree *tree, int rsvd_nodes); 394 struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree); 395 void hfs_bmap_free(struct hfs_bnode *node); 396 397 /* bnode.c */ 398 void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len); 399 u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off); 400 u8 hfs_bnode_read_u8(struct hfs_bnode *node, int off); 401 void hfs_bnode_read_key(struct hfs_bnode *node, void *key, int off); 402 void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len); 403 void hfs_bnode_write_u16(struct hfs_bnode *node, int off, u16 data); 404 void hfs_bnode_clear(struct hfs_bnode *node, int off, int len); 405 void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, 406 struct hfs_bnode *src_node, int src, int len); 407 void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len); 408 void hfs_bnode_dump(struct hfs_bnode *node); 409 void hfs_bnode_unlink(struct hfs_bnode *node); 410 struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid); 411 void hfs_bnode_unhash(struct hfs_bnode *node); 412 struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num); 413 void hfs_bnode_free(struct hfs_bnode *node); 414 struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num); 415 void hfs_bnode_get(struct hfs_bnode *node); 416 void hfs_bnode_put(struct hfs_bnode *node); 417 bool hfs_bnode_need_zeroout(struct hfs_btree *tree); 418 419 /* brec.c */ 420 u16 hfs_brec_lenoff(struct hfs_bnode *node, u16 rec, u16 *off); 421 u16 hfs_brec_keylen(struct hfs_bnode *node, u16 rec); 422 int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len); 423 int hfs_brec_remove(struct hfs_find_data *fd); 424 425 /* bfind.c */ 426 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd); 427 void hfs_find_exit(struct hfs_find_data *fd); 428 int hfs_find_1st_rec_by_cnid(struct hfs_bnode *bnode, struct hfs_find_data *fd, 429 int *begin, int *end, int *cur_rec); 430 int hfs_find_rec_by_key(struct hfs_bnode *bnode, struct hfs_find_data *fd, 431 int *begin, int *end, int *cur_rec); 432 int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd, 433 search_strategy_t rec_found); 434 int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare); 435 int hfs_brec_read(struct hfs_find_data *fd, void *rec, int rec_len); 436 int hfs_brec_goto(struct hfs_find_data *fd, int cnt); 437 438 /* catalog.c */ 439 int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *k1, 440 const hfsplus_btree_key *k2); 441 int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *k1, 442 const hfsplus_btree_key *k2); 443 int hfsplus_cat_build_key(struct super_block *sb, hfsplus_btree_key *key, 444 u32 parent, const struct qstr *str); 445 void hfsplus_cat_build_key_with_cnid(struct super_block *sb, 446 hfsplus_btree_key *key, u32 parent); 447 void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms); 448 int hfsplus_find_cat(struct super_block *sb, u32 cnid, 449 struct hfs_find_data *fd); 450 int hfsplus_create_cat(u32 cnid, struct inode *dir, const struct qstr *str, 451 struct inode *inode); 452 int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str); 453 int hfsplus_rename_cat(u32 cnid, struct inode *src_dir, const struct qstr *src_name, 454 struct inode *dst_dir, const struct qstr *dst_name); 455 456 /* dir.c */ 457 extern const struct inode_operations hfsplus_dir_inode_operations; 458 extern const struct file_operations hfsplus_dir_operations; 459 460 /* extents.c */ 461 int hfsplus_ext_cmp_key(const hfsplus_btree_key *k1, 462 const hfsplus_btree_key *k2); 463 int hfsplus_ext_write_extent(struct inode *inode); 464 int hfsplus_get_block(struct inode *inode, sector_t iblock, 465 struct buffer_head *bh_result, int create); 466 int hfsplus_free_fork(struct super_block *sb, u32 cnid, 467 struct hfsplus_fork_raw *fork, int type); 468 int hfsplus_file_extend(struct inode *inode, bool zeroout); 469 void hfsplus_file_truncate(struct inode *inode); 470 471 /* inode.c */ 472 extern const struct address_space_operations hfsplus_aops; 473 extern const struct address_space_operations hfsplus_btree_aops; 474 extern const struct dentry_operations hfsplus_dentry_operations; 475 476 int hfsplus_write_begin(struct file *file, struct address_space *mapping, 477 loff_t pos, unsigned len, struct folio **foliop, void **fsdata); 478 struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir, 479 umode_t mode); 480 void hfsplus_delete_inode(struct inode *inode); 481 void hfsplus_inode_read_fork(struct inode *inode, 482 struct hfsplus_fork_raw *fork); 483 void hfsplus_inode_write_fork(struct inode *inode, 484 struct hfsplus_fork_raw *fork); 485 int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); 486 int hfsplus_cat_write_inode(struct inode *inode); 487 int hfsplus_getattr(struct mnt_idmap *idmap, const struct path *path, 488 struct kstat *stat, u32 request_mask, 489 unsigned int query_flags); 490 int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, 491 int datasync); 492 int hfsplus_fileattr_get(struct dentry *dentry, struct fileattr *fa); 493 int hfsplus_fileattr_set(struct mnt_idmap *idmap, 494 struct dentry *dentry, struct fileattr *fa); 495 496 /* ioctl.c */ 497 long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); 498 499 /* options.c */ 500 void hfsplus_fill_defaults(struct hfsplus_sb_info *opts); 501 int hfsplus_parse_param(struct fs_context *fc, struct fs_parameter *param); 502 int hfsplus_show_options(struct seq_file *seq, struct dentry *root); 503 504 /* part_tbl.c */ 505 int hfs_part_find(struct super_block *sb, sector_t *part_start, 506 sector_t *part_size); 507 508 /* super.c */ 509 struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino); 510 void hfsplus_mark_mdb_dirty(struct super_block *sb); 511 512 /* tables.c */ 513 extern u16 hfsplus_case_fold_table[]; 514 extern u16 hfsplus_decompose_table[]; 515 extern u16 hfsplus_compose_table[]; 516 517 /* unicode.c */ 518 int hfsplus_strcasecmp(const struct hfsplus_unistr *s1, 519 const struct hfsplus_unistr *s2); 520 int hfsplus_strcmp(const struct hfsplus_unistr *s1, 521 const struct hfsplus_unistr *s2); 522 int hfsplus_uni2asc(struct super_block *sb, const struct hfsplus_unistr *ustr, 523 char *astr, int *len_p); 524 int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr, 525 int max_unistr_len, const char *astr, int len); 526 int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str); 527 int hfsplus_compare_dentry(const struct dentry *dentry, unsigned int len, 528 const char *str, const struct qstr *name); 529 530 /* wrapper.c */ 531 int hfsplus_submit_bio(struct super_block *sb, sector_t sector, void *buf, 532 void **data, blk_opf_t opf); 533 int hfsplus_read_wrapper(struct super_block *sb); 534 535 /* 536 * time helpers: convert between 1904-base and 1970-base timestamps 537 * 538 * HFS+ implementations are highly inconsistent, this one matches the 539 * traditional behavior of 64-bit Linux, giving the most useful 540 * time range between 1970 and 2106, by treating any on-disk timestamp 541 * under HFSPLUS_UTC_OFFSET (Jan 1 1970) as a time between 2040 and 2106. 542 */ 543 #define HFSPLUS_UTC_OFFSET 2082844800U 544 545 static inline time64_t __hfsp_mt2ut(__be32 mt) 546 { 547 time64_t ut = (u32)(be32_to_cpu(mt) - HFSPLUS_UTC_OFFSET); 548 549 return ut; 550 } 551 552 static inline __be32 __hfsp_ut2mt(time64_t ut) 553 { 554 return cpu_to_be32(lower_32_bits(ut) + HFSPLUS_UTC_OFFSET); 555 } 556 557 static inline enum hfsplus_btree_mutex_classes 558 hfsplus_btree_lock_class(struct hfs_btree *tree) 559 { 560 enum hfsplus_btree_mutex_classes class; 561 562 switch (tree->cnid) { 563 case HFSPLUS_CAT_CNID: 564 class = CATALOG_BTREE_MUTEX; 565 break; 566 case HFSPLUS_EXT_CNID: 567 class = EXTENTS_BTREE_MUTEX; 568 break; 569 case HFSPLUS_ATTR_CNID: 570 class = ATTR_BTREE_MUTEX; 571 break; 572 default: 573 BUG(); 574 } 575 return class; 576 } 577 578 /* compatibility */ 579 #define hfsp_mt2ut(t) (struct timespec64){ .tv_sec = __hfsp_mt2ut(t) } 580 #define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec) 581 #define hfsp_now2mt() __hfsp_ut2mt(ktime_get_real_seconds()) 582 583 #endif 584