blob: 21a5b7fc6db42310576ee3cb00bbff46f6d5a534 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/include/linux/hfsplus_fs.h
3 *
4 * Copyright (C) 1999
5 * Brad Boyer (flar@pants.nu)
6 * (C) 2003 Ardis Technologies <roman@ardistech.com>
7 *
8 */
9
10#ifndef _LINUX_HFSPLUS_FS_H
11#define _LINUX_HFSPLUS_FS_H
12
13#include <linux/fs.h>
Matthias Kaehlcke895c23f2008-07-25 01:46:36 -070014#include <linux/mutex.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/buffer_head.h>
Seth Forshee65965282011-07-18 08:06:23 -070016#include <linux/blkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include "hfsplus_raw.h"
18
19#define DBG_BNODE_REFS 0x00000001
20#define DBG_BNODE_MOD 0x00000002
21#define DBG_CAT_MOD 0x00000004
22#define DBG_INODE 0x00000008
23#define DBG_SUPER 0x00000010
24#define DBG_EXTENT 0x00000020
25#define DBG_BITMAP 0x00000040
26
Anton Salikhmetov21f22962010-12-16 18:08:39 +020027#if 0
28#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD)
29#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE)
30#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT)
31#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#define DBG_MASK (0)
33
34#define dprint(flg, fmt, args...) \
Anton Salikhmetovb2837fc2010-12-16 18:08:41 +020035 if (flg & DBG_MASK) \
36 printk(fmt , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38/* Runtime config options */
39#define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */
40
41#define HFSPLUS_TYPE_DATA 0x00
42#define HFSPLUS_TYPE_RSRC 0xFF
43
Anton Salikhmetov2753cc22010-12-16 18:08:38 +020044typedef int (*btree_keycmp)(const hfsplus_btree_key *,
45 const hfsplus_btree_key *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47#define NODE_HASH_SIZE 256
48
49/* An HFS+ BTree held in memory */
50struct hfs_btree {
51 struct super_block *sb;
52 struct inode *inode;
53 btree_keycmp keycmp;
54
55 u32 cnid;
56 u32 root;
57 u32 leaf_count;
58 u32 leaf_head;
59 u32 leaf_tail;
60 u32 node_count;
61 u32 free_nodes;
62 u32 attributes;
63
64 unsigned int node_size;
65 unsigned int node_size_shift;
66 unsigned int max_key_len;
67 unsigned int depth;
68
Thomas Gleixner467c3d92010-10-01 05:46:52 +020069 struct mutex tree_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
71 unsigned int pages_per_bnode;
72 spinlock_t hash_lock;
73 struct hfs_bnode *node_hash[NODE_HASH_SIZE];
74 int node_hash_cnt;
75};
76
77struct page;
78
79/* An HFS+ BTree node in memory */
80struct hfs_bnode {
81 struct hfs_btree *tree;
82
83 u32 prev;
84 u32 this;
85 u32 next;
86 u32 parent;
87
88 u16 num_recs;
89 u8 type;
90 u8 height;
91
92 struct hfs_bnode *next_hash;
93 unsigned long flags;
94 wait_queue_head_t lock_wq;
95 atomic_t refcnt;
96 unsigned int page_offset;
97 struct page *page[0];
98};
99
100#define HFS_BNODE_LOCK 0
101#define HFS_BNODE_ERROR 1
102#define HFS_BNODE_NEW 2
103#define HFS_BNODE_DIRTY 3
104#define HFS_BNODE_DELETED 4
105
106/*
107 * HFS+ superblock info (built from Volume Header on disk)
108 */
109
110struct hfsplus_vh;
111struct hfs_btree;
112
113struct hfsplus_sb_info {
Seth Forshee65965282011-07-18 08:06:23 -0700114 void *s_vhdr_buf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 struct hfsplus_vh *s_vhdr;
Seth Forshee65965282011-07-18 08:06:23 -0700116 void *s_backup_vhdr_buf;
Christoph Hellwig52399b12010-11-23 14:37:47 +0100117 struct hfsplus_vh *s_backup_vhdr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 struct hfs_btree *ext_tree;
119 struct hfs_btree *cat_tree;
120 struct hfs_btree *attr_tree;
121 struct inode *alloc_file;
122 struct inode *hidden_dir;
123 struct nls_table *nls;
124
125 /* Runtime variables */
126 u32 blockoffset;
Christoph Hellwig52399b12010-11-23 14:37:47 +0100127 sector_t part_start;
128 sector_t sect_count;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 int fs_shift;
130
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200131 /* immutable data from the volume header */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 u32 alloc_blksz;
133 int alloc_blksz_shift;
134 u32 total_blocks;
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200135 u32 data_clump_blocks, rsrc_clump_blocks;
136
137 /* mutable data from the volume header, protected by alloc_mutex */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 u32 free_blocks;
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200139 struct mutex alloc_mutex;
140
141 /* mutable data from the volume header, protected by vh_mutex */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 u32 next_cnid;
143 u32 file_count;
144 u32 folder_count;
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200145 struct mutex vh_mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
147 /* Config options */
148 u32 creator;
149 u32 type;
150
151 umode_t umask;
152 uid_t uid;
153 gid_t gid;
154
155 int part, session;
156
157 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158};
159
Christoph Hellwig84adede2010-10-01 05:45:20 +0200160#define HFSPLUS_SB_WRITEBACKUP 0
161#define HFSPLUS_SB_NODECOMPOSE 1
162#define HFSPLUS_SB_FORCE 2
163#define HFSPLUS_SB_HFSX 3
164#define HFSPLUS_SB_CASEFOLD 4
Christoph Hellwig34a2d312010-11-23 14:38:21 +0100165#define HFSPLUS_SB_NOBARRIER 5
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
Christoph Hellwige3494702010-11-23 14:38:15 +0100167static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb)
168{
169 return sb->s_fs_info;
170}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
172
173struct hfsplus_inode_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 atomic_t opencnt;
175
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200176 /*
177 * Extent allocation information, protected by extents_lock.
178 */
179 u32 first_blocks;
180 u32 clump_blocks;
181 u32 alloc_blocks;
182 u32 cached_start;
183 u32 cached_blocks;
184 hfsplus_extent_rec first_extents;
185 hfsplus_extent_rec cached_extents;
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100186 unsigned int extent_state;
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200187 struct mutex extents_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200189 /*
190 * Immutable data.
191 */
192 struct inode *rsrc_inode;
Roman Zippel9a4cad92006-01-18 17:43:09 -0800193 __be32 create_date;
Christoph Hellwigf6089ff2010-10-14 09:54:28 -0400194
195 /*
196 * Protected by sbi->vh_mutex.
197 */
198 u32 linkid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200200 /*
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100201 * Accessed using atomic bitops.
202 */
203 unsigned long flags;
204
205 /*
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200206 * Protected by i_mutex.
207 */
208 sector_t fs_blocks;
Christoph Hellwig722c55d2010-10-14 09:54:33 -0400209 u8 userflags; /* BSD user file flags */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 struct list_head open_dir_list;
211 loff_t phys_size;
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200212
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 struct inode vfs_inode;
214};
215
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100216#define HFSPLUS_EXT_DIRTY 0x0001
217#define HFSPLUS_EXT_NEW 0x0002
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100219#define HFSPLUS_I_RSRC 0 /* represents a resource fork */
Christoph Hellwige3494702010-11-23 14:38:15 +0100220#define HFSPLUS_I_CAT_DIRTY 1 /* has changes in the catalog tree */
221#define HFSPLUS_I_EXT_DIRTY 2 /* has changes in the extent tree */
222#define HFSPLUS_I_ALLOC_DIRTY 3 /* has changes in the allocation file */
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100223
224#define HFSPLUS_IS_RSRC(inode) \
225 test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
Christoph Hellwige3494702010-11-23 14:38:15 +0100227static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode)
228{
229 return list_entry(inode, struct hfsplus_inode_info, vfs_inode);
230}
231
232/*
233 * Mark an inode dirty, and also mark the btree in which the
234 * specific type of metadata is stored.
235 * For data or metadata that gets written back by into the catalog btree
236 * by hfsplus_write_inode a plain mark_inode_dirty call is enough.
237 */
238static inline void hfsplus_mark_inode_dirty(struct inode *inode,
239 unsigned int flag)
240{
241 set_bit(flag, &HFSPLUS_I(inode)->flags);
242 mark_inode_dirty(inode);
243}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245struct hfs_find_data {
246 /* filled by caller */
247 hfsplus_btree_key *search_key;
248 hfsplus_btree_key *key;
249 /* filled by find */
250 struct hfs_btree *tree;
251 struct hfs_bnode *bnode;
252 /* filled by findrec */
253 int record;
254 int keyoffset, keylength;
255 int entryoffset, entrylength;
256};
257
258struct hfsplus_readdir_data {
259 struct list_head list;
260 struct file *file;
261 struct hfsplus_cat_key key;
262};
263
Seth Forshee65965282011-07-18 08:06:23 -0700264/*
265 * Find minimum acceptible I/O size for an hfsplus sb.
266 */
267static inline unsigned short hfsplus_min_io_size(struct super_block *sb)
268{
269 return max_t(unsigned short, bdev_logical_block_size(sb->s_bdev),
270 HFSPLUS_SECTOR_SIZE);
271}
272
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273#define hfs_btree_open hfsplus_btree_open
274#define hfs_btree_close hfsplus_btree_close
275#define hfs_btree_write hfsplus_btree_write
276#define hfs_bmap_alloc hfsplus_bmap_alloc
277#define hfs_bmap_free hfsplus_bmap_free
278#define hfs_bnode_read hfsplus_bnode_read
279#define hfs_bnode_read_u16 hfsplus_bnode_read_u16
280#define hfs_bnode_read_u8 hfsplus_bnode_read_u8
281#define hfs_bnode_read_key hfsplus_bnode_read_key
282#define hfs_bnode_write hfsplus_bnode_write
283#define hfs_bnode_write_u16 hfsplus_bnode_write_u16
284#define hfs_bnode_clear hfsplus_bnode_clear
285#define hfs_bnode_copy hfsplus_bnode_copy
286#define hfs_bnode_move hfsplus_bnode_move
287#define hfs_bnode_dump hfsplus_bnode_dump
288#define hfs_bnode_unlink hfsplus_bnode_unlink
289#define hfs_bnode_findhash hfsplus_bnode_findhash
290#define hfs_bnode_find hfsplus_bnode_find
291#define hfs_bnode_unhash hfsplus_bnode_unhash
292#define hfs_bnode_free hfsplus_bnode_free
293#define hfs_bnode_create hfsplus_bnode_create
294#define hfs_bnode_get hfsplus_bnode_get
295#define hfs_bnode_put hfsplus_bnode_put
296#define hfs_brec_lenoff hfsplus_brec_lenoff
297#define hfs_brec_keylen hfsplus_brec_keylen
298#define hfs_brec_insert hfsplus_brec_insert
299#define hfs_brec_remove hfsplus_brec_remove
300#define hfs_find_init hfsplus_find_init
301#define hfs_find_exit hfsplus_find_exit
302#define __hfs_brec_find __hplusfs_brec_find
303#define hfs_brec_find hfsplus_brec_find
304#define hfs_brec_read hfsplus_brec_read
305#define hfs_brec_goto hfsplus_brec_goto
306#define hfs_part_find hfsplus_part_find
307
308/*
309 * definitions for ext2 flag ioctls (linux really needs a generic
310 * interface for this).
311 */
312
313/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support
314 * chattr/lsattr */
David Howells36695672006-08-29 19:06:16 +0100315#define HFSPLUS_IOC_EXT2_GETFLAGS FS_IOC_GETFLAGS
316#define HFSPLUS_IOC_EXT2_SETFLAGS FS_IOC_SETFLAGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317
318
319/*
320 * Functions in any *.c used in other files
321 */
322
323/* bitmap.c */
324int hfsplus_block_allocate(struct super_block *, u32, u32, u32 *);
325int hfsplus_block_free(struct super_block *, u32, u32);
326
327/* btree.c */
328struct hfs_btree *hfs_btree_open(struct super_block *, u32);
329void hfs_btree_close(struct hfs_btree *);
330void hfs_btree_write(struct hfs_btree *);
331struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *);
332void hfs_bmap_free(struct hfs_bnode *);
333
334/* bnode.c */
335void hfs_bnode_read(struct hfs_bnode *, void *, int, int);
336u16 hfs_bnode_read_u16(struct hfs_bnode *, int);
337u8 hfs_bnode_read_u8(struct hfs_bnode *, int);
338void hfs_bnode_read_key(struct hfs_bnode *, void *, int);
339void hfs_bnode_write(struct hfs_bnode *, void *, int, int);
340void hfs_bnode_write_u16(struct hfs_bnode *, int, u16);
341void hfs_bnode_clear(struct hfs_bnode *, int, int);
342void hfs_bnode_copy(struct hfs_bnode *, int,
343 struct hfs_bnode *, int, int);
344void hfs_bnode_move(struct hfs_bnode *, int, int, int);
345void hfs_bnode_dump(struct hfs_bnode *);
346void hfs_bnode_unlink(struct hfs_bnode *);
347struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *, u32);
348struct hfs_bnode *hfs_bnode_find(struct hfs_btree *, u32);
349void hfs_bnode_unhash(struct hfs_bnode *);
350void hfs_bnode_free(struct hfs_bnode *);
351struct hfs_bnode *hfs_bnode_create(struct hfs_btree *, u32);
352void hfs_bnode_get(struct hfs_bnode *);
353void hfs_bnode_put(struct hfs_bnode *);
354
355/* brec.c */
356u16 hfs_brec_lenoff(struct hfs_bnode *, u16, u16 *);
357u16 hfs_brec_keylen(struct hfs_bnode *, u16);
358int hfs_brec_insert(struct hfs_find_data *, void *, int);
359int hfs_brec_remove(struct hfs_find_data *);
360
361/* bfind.c */
362int hfs_find_init(struct hfs_btree *, struct hfs_find_data *);
363void hfs_find_exit(struct hfs_find_data *);
364int __hfs_brec_find(struct hfs_bnode *, struct hfs_find_data *);
365int hfs_brec_find(struct hfs_find_data *);
366int hfs_brec_read(struct hfs_find_data *, void *, int);
367int hfs_brec_goto(struct hfs_find_data *, int);
368
369/* catalog.c */
Anton Salikhmetov2753cc22010-12-16 18:08:38 +0200370int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *,
371 const hfsplus_btree_key *);
372int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *,
373 const hfsplus_btree_key *);
374void hfsplus_cat_build_key(struct super_block *sb,
375 hfsplus_btree_key *, u32, struct qstr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *);
377int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *);
378int hfsplus_delete_cat(u32, struct inode *, struct qstr *);
379int hfsplus_rename_cat(u32, struct inode *, struct qstr *,
380 struct inode *, struct qstr *);
Christoph Hellwig90e61692010-10-14 09:54:39 -0400381void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382
Adrian Bunk4b0a8da2008-04-29 00:58:52 -0700383/* dir.c */
384extern const struct inode_operations hfsplus_dir_inode_operations;
385extern const struct file_operations hfsplus_dir_operations;
386
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387/* extents.c */
David Elliott2179d372006-01-18 17:43:08 -0800388int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *);
Alexey Khoroshilovdd7f3d52011-07-06 02:30:00 +0400389int hfsplus_ext_write_extent(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int);
Anton Salikhmetov2753cc22010-12-16 18:08:38 +0200391int hfsplus_free_fork(struct super_block *, u32,
392 struct hfsplus_fork_raw *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393int hfsplus_file_extend(struct inode *);
394void hfsplus_file_truncate(struct inode *);
395
396/* inode.c */
Christoph Hellwigf5e54d62006-06-28 04:26:44 -0700397extern const struct address_space_operations hfsplus_aops;
398extern const struct address_space_operations hfsplus_btree_aops;
Al Viroe16404e2009-02-20 05:55:13 +0000399extern const struct dentry_operations hfsplus_dentry_operations;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400
401void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
402void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
403int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *);
404int hfsplus_cat_write_inode(struct inode *);
Al Viroc47da792011-07-26 03:26:51 -0400405struct inode *hfsplus_new_inode(struct super_block *, umode_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406void hfsplus_delete_inode(struct inode *);
Josef Bacik02c24a82011-07-16 20:44:56 -0400407int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
408 int datasync);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409
410/* ioctl.c */
Arnd Bergmann7cc4bcc2010-04-27 16:24:20 +0200411long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412int hfsplus_setxattr(struct dentry *dentry, const char *name,
413 const void *value, size_t size, int flags);
414ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
415 void *value, size_t size);
416ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size);
417
418/* options.c */
Roman Zippel717dd802005-09-06 15:18:48 -0700419int hfsplus_parse_options(char *, struct hfsplus_sb_info *);
Christoph Hellwig6f80dfe2010-11-07 23:01:17 +0100420int hfsplus_parse_options_remount(char *input, int *force);
Roman Zippel717dd802005-09-06 15:18:48 -0700421void hfsplus_fill_defaults(struct hfsplus_sb_info *);
Al Viro34c80b12011-12-08 21:32:45 -0500422int hfsplus_show_options(struct seq_file *, struct dentry *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423
David Howells63525392008-02-07 00:15:40 -0800424/* super.c */
425struct inode *hfsplus_iget(struct super_block *, unsigned long);
Al Virob5fc5102010-07-04 12:24:09 +0400426int hfsplus_sync_fs(struct super_block *sb, int wait);
David Howells63525392008-02-07 00:15:40 -0800427
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428/* tables.c */
429extern u16 hfsplus_case_fold_table[];
430extern u16 hfsplus_decompose_table[];
431extern u16 hfsplus_compose_table[];
432
433/* unicode.c */
Anton Salikhmetov2753cc22010-12-16 18:08:38 +0200434int hfsplus_strcasecmp(const struct hfsplus_unistr *,
435 const struct hfsplus_unistr *);
436int hfsplus_strcmp(const struct hfsplus_unistr *,
437 const struct hfsplus_unistr *);
438int hfsplus_uni2asc(struct super_block *,
439 const struct hfsplus_unistr *, char *, int *);
440int hfsplus_asc2uni(struct super_block *,
441 struct hfsplus_unistr *, const char *, int);
Linus Torvalds0c21e3a2011-01-07 17:16:27 -0800442int hfsplus_hash_dentry(const struct dentry *dentry,
443 const struct inode *inode, struct qstr *str);
Nick Piggin621e1552011-01-07 17:49:27 +1100444int hfsplus_compare_dentry(const struct dentry *parent,
445 const struct inode *pinode,
446 const struct dentry *dentry, const struct inode *inode,
447 unsigned int len, const char *str, const struct qstr *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448
449/* wrapper.c */
450int hfsplus_read_wrapper(struct super_block *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451int hfs_part_find(struct super_block *, sector_t *, sector_t *);
Seth Forshee65965282011-07-18 08:06:23 -0700452int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
453 void *buf, void **data, int rw);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454
455/* time macros */
456#define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U)
457#define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U))
458
459/* compatibility */
460#define hfsp_mt2ut(t) (struct timespec){ .tv_sec = __hfsp_mt2ut(t) }
461#define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec)
462#define hfsp_now2mt() __hfsp_ut2mt(get_seconds())
463
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464#endif