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