blob: 60b0a3388b262bcdfd2a02d449505e81b40e1d6b [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
Joe Perchesd6142672013-04-30 15:27:55 -070013#ifdef pr_fmt
14#undef pr_fmt
15#endif
16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/fs.h>
Matthias Kaehlcke895c23f2008-07-25 01:46:36 -070020#include <linux/mutex.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/buffer_head.h>
Seth Forshee65965282011-07-18 08:06:23 -070022#include <linux/blkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include "hfsplus_raw.h"
24
25#define DBG_BNODE_REFS 0x00000001
26#define DBG_BNODE_MOD 0x00000002
27#define DBG_CAT_MOD 0x00000004
28#define DBG_INODE 0x00000008
29#define DBG_SUPER 0x00000010
30#define DBG_EXTENT 0x00000020
31#define DBG_BITMAP 0x00000040
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -080032#define DBG_ATTR_MOD 0x00000080
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Anton Salikhmetov21f22962010-12-16 18:08:39 +020034#if 0
35#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD)
36#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE)
37#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT)
38#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#define DBG_MASK (0)
40
Joe Perchesd6142672013-04-30 15:27:55 -070041#define hfs_dbg(flg, fmt, ...) \
42do { \
43 if (DBG_##flg & DBG_MASK) \
44 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
Joe Perchesc2b3e1f2013-04-30 15:27:54 -070045} while (0)
46
Joe Perchesd6142672013-04-30 15:27:55 -070047#define hfs_dbg_cont(flg, fmt, ...) \
48do { \
49 if (DBG_##flg & DBG_MASK) \
50 pr_cont(fmt, ##__VA_ARGS__); \
Joe Perchesc2b3e1f2013-04-30 15:27:54 -070051} while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53/* Runtime config options */
54#define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */
55
56#define HFSPLUS_TYPE_DATA 0x00
57#define HFSPLUS_TYPE_RSRC 0xFF
58
Anton Salikhmetov2753cc22010-12-16 18:08:38 +020059typedef int (*btree_keycmp)(const hfsplus_btree_key *,
60 const hfsplus_btree_key *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
62#define NODE_HASH_SIZE 256
63
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -080064/* B-tree mutex nested subclasses */
65enum hfsplus_btree_mutex_classes {
66 CATALOG_BTREE_MUTEX,
67 EXTENTS_BTREE_MUTEX,
68 ATTR_BTREE_MUTEX,
69};
70
Linus Torvalds1da177e2005-04-16 15:20:36 -070071/* An HFS+ BTree held in memory */
72struct hfs_btree {
73 struct super_block *sb;
74 struct inode *inode;
75 btree_keycmp keycmp;
76
77 u32 cnid;
78 u32 root;
79 u32 leaf_count;
80 u32 leaf_head;
81 u32 leaf_tail;
82 u32 node_count;
83 u32 free_nodes;
84 u32 attributes;
85
86 unsigned int node_size;
87 unsigned int node_size_shift;
88 unsigned int max_key_len;
89 unsigned int depth;
90
Thomas Gleixner467c3d92010-10-01 05:46:52 +020091 struct mutex tree_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
93 unsigned int pages_per_bnode;
94 spinlock_t hash_lock;
95 struct hfs_bnode *node_hash[NODE_HASH_SIZE];
96 int node_hash_cnt;
97};
98
99struct page;
100
101/* An HFS+ BTree node in memory */
102struct hfs_bnode {
103 struct hfs_btree *tree;
104
105 u32 prev;
106 u32 this;
107 u32 next;
108 u32 parent;
109
110 u16 num_recs;
111 u8 type;
112 u8 height;
113
114 struct hfs_bnode *next_hash;
115 unsigned long flags;
116 wait_queue_head_t lock_wq;
117 atomic_t refcnt;
118 unsigned int page_offset;
119 struct page *page[0];
120};
121
122#define HFS_BNODE_LOCK 0
123#define HFS_BNODE_ERROR 1
124#define HFS_BNODE_NEW 2
125#define HFS_BNODE_DIRTY 3
126#define HFS_BNODE_DELETED 4
127
128/*
129 * HFS+ superblock info (built from Volume Header on disk)
130 */
131
132struct hfsplus_vh;
133struct hfs_btree;
134
135struct hfsplus_sb_info {
Seth Forshee65965282011-07-18 08:06:23 -0700136 void *s_vhdr_buf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 struct hfsplus_vh *s_vhdr;
Seth Forshee65965282011-07-18 08:06:23 -0700138 void *s_backup_vhdr_buf;
Christoph Hellwig52399b12010-11-23 14:37:47 +0100139 struct hfsplus_vh *s_backup_vhdr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 struct hfs_btree *ext_tree;
141 struct hfs_btree *cat_tree;
142 struct hfs_btree *attr_tree;
143 struct inode *alloc_file;
144 struct inode *hidden_dir;
145 struct nls_table *nls;
146
147 /* Runtime variables */
148 u32 blockoffset;
Christoph Hellwig52399b12010-11-23 14:37:47 +0100149 sector_t part_start;
150 sector_t sect_count;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 int fs_shift;
152
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200153 /* immutable data from the volume header */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 u32 alloc_blksz;
155 int alloc_blksz_shift;
156 u32 total_blocks;
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200157 u32 data_clump_blocks, rsrc_clump_blocks;
158
159 /* mutable data from the volume header, protected by alloc_mutex */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 u32 free_blocks;
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200161 struct mutex alloc_mutex;
162
163 /* mutable data from the volume header, protected by vh_mutex */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 u32 next_cnid;
165 u32 file_count;
166 u32 folder_count;
Christoph Hellwig7ac9fb92010-10-01 05:45:08 +0200167 struct mutex vh_mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
169 /* Config options */
170 u32 creator;
171 u32 type;
172
173 umode_t umask;
Eric W. Biederman16525e32012-02-07 16:27:17 -0800174 kuid_t uid;
175 kgid_t gid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
177 int part, session;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 unsigned long flags;
Artem Bityutskiy9e6c5822012-07-12 17:26:31 +0300179
180 int work_queued; /* non-zero delayed work is queued */
181 struct delayed_work sync_work; /* FS sync delayed work */
182 spinlock_t work_lock; /* protects sync_work and work_queued */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183};
184
Christoph Hellwig84adede2010-10-01 05:45:20 +0200185#define HFSPLUS_SB_WRITEBACKUP 0
186#define HFSPLUS_SB_NODECOMPOSE 1
187#define HFSPLUS_SB_FORCE 2
188#define HFSPLUS_SB_HFSX 3
189#define HFSPLUS_SB_CASEFOLD 4
Christoph Hellwig34a2d312010-11-23 14:38:21 +0100190#define HFSPLUS_SB_NOBARRIER 5
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
Christoph Hellwige3494702010-11-23 14:38:15 +0100192static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb)
193{
194 return sb->s_fs_info;
195}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
197
198struct hfsplus_inode_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 atomic_t opencnt;
200
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200201 /*
202 * Extent allocation information, protected by extents_lock.
203 */
204 u32 first_blocks;
205 u32 clump_blocks;
206 u32 alloc_blocks;
207 u32 cached_start;
208 u32 cached_blocks;
209 hfsplus_extent_rec first_extents;
210 hfsplus_extent_rec cached_extents;
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100211 unsigned int extent_state;
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200212 struct mutex extents_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200214 /*
215 * Immutable data.
216 */
217 struct inode *rsrc_inode;
Roman Zippel9a4cad92006-01-18 17:43:09 -0800218 __be32 create_date;
Christoph Hellwigf6089ff2010-10-14 09:54:28 -0400219
220 /*
221 * Protected by sbi->vh_mutex.
222 */
223 u32 linkid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200225 /*
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100226 * Accessed using atomic bitops.
227 */
228 unsigned long flags;
229
230 /*
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200231 * Protected by i_mutex.
232 */
233 sector_t fs_blocks;
Christoph Hellwig722c55d2010-10-14 09:54:33 -0400234 u8 userflags; /* BSD user file flags */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 struct list_head open_dir_list;
236 loff_t phys_size;
Christoph Hellwig7fcc99f2010-10-01 05:46:31 +0200237
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 struct inode vfs_inode;
239};
240
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100241#define HFSPLUS_EXT_DIRTY 0x0001
242#define HFSPLUS_EXT_NEW 0x0002
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100244#define HFSPLUS_I_RSRC 0 /* represents a resource fork */
Christoph Hellwige3494702010-11-23 14:38:15 +0100245#define HFSPLUS_I_CAT_DIRTY 1 /* has changes in the catalog tree */
246#define HFSPLUS_I_EXT_DIRTY 2 /* has changes in the extent tree */
247#define HFSPLUS_I_ALLOC_DIRTY 3 /* has changes in the allocation file */
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -0800248#define HFSPLUS_I_ATTR_DIRTY 4 /* has changes in the attributes tree */
Christoph Hellwigb33b7922010-11-23 14:38:13 +0100249
250#define HFSPLUS_IS_RSRC(inode) \
251 test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252
Christoph Hellwige3494702010-11-23 14:38:15 +0100253static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode)
254{
255 return list_entry(inode, struct hfsplus_inode_info, vfs_inode);
256}
257
258/*
259 * Mark an inode dirty, and also mark the btree in which the
260 * specific type of metadata is stored.
261 * For data or metadata that gets written back by into the catalog btree
262 * by hfsplus_write_inode a plain mark_inode_dirty call is enough.
263 */
264static inline void hfsplus_mark_inode_dirty(struct inode *inode,
265 unsigned int flag)
266{
267 set_bit(flag, &HFSPLUS_I(inode)->flags);
268 mark_inode_dirty(inode);
269}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270
271struct hfs_find_data {
272 /* filled by caller */
273 hfsplus_btree_key *search_key;
274 hfsplus_btree_key *key;
275 /* filled by find */
276 struct hfs_btree *tree;
277 struct hfs_bnode *bnode;
278 /* filled by findrec */
279 int record;
280 int keyoffset, keylength;
281 int entryoffset, entrylength;
282};
283
284struct hfsplus_readdir_data {
285 struct list_head list;
286 struct file *file;
287 struct hfsplus_cat_key key;
288};
289
Seth Forshee65965282011-07-18 08:06:23 -0700290/*
291 * Find minimum acceptible I/O size for an hfsplus sb.
292 */
293static inline unsigned short hfsplus_min_io_size(struct super_block *sb)
294{
295 return max_t(unsigned short, bdev_logical_block_size(sb->s_bdev),
296 HFSPLUS_SECTOR_SIZE);
297}
298
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299#define hfs_btree_open hfsplus_btree_open
300#define hfs_btree_close hfsplus_btree_close
301#define hfs_btree_write hfsplus_btree_write
302#define hfs_bmap_alloc hfsplus_bmap_alloc
303#define hfs_bmap_free hfsplus_bmap_free
304#define hfs_bnode_read hfsplus_bnode_read
305#define hfs_bnode_read_u16 hfsplus_bnode_read_u16
306#define hfs_bnode_read_u8 hfsplus_bnode_read_u8
307#define hfs_bnode_read_key hfsplus_bnode_read_key
308#define hfs_bnode_write hfsplus_bnode_write
309#define hfs_bnode_write_u16 hfsplus_bnode_write_u16
310#define hfs_bnode_clear hfsplus_bnode_clear
311#define hfs_bnode_copy hfsplus_bnode_copy
312#define hfs_bnode_move hfsplus_bnode_move
313#define hfs_bnode_dump hfsplus_bnode_dump
314#define hfs_bnode_unlink hfsplus_bnode_unlink
315#define hfs_bnode_findhash hfsplus_bnode_findhash
316#define hfs_bnode_find hfsplus_bnode_find
317#define hfs_bnode_unhash hfsplus_bnode_unhash
318#define hfs_bnode_free hfsplus_bnode_free
319#define hfs_bnode_create hfsplus_bnode_create
320#define hfs_bnode_get hfsplus_bnode_get
321#define hfs_bnode_put hfsplus_bnode_put
322#define hfs_brec_lenoff hfsplus_brec_lenoff
323#define hfs_brec_keylen hfsplus_brec_keylen
324#define hfs_brec_insert hfsplus_brec_insert
325#define hfs_brec_remove hfsplus_brec_remove
326#define hfs_find_init hfsplus_find_init
327#define hfs_find_exit hfsplus_find_exit
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -0800328#define __hfs_brec_find __hfsplus_brec_find
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329#define hfs_brec_find hfsplus_brec_find
330#define hfs_brec_read hfsplus_brec_read
331#define hfs_brec_goto hfsplus_brec_goto
332#define hfs_part_find hfsplus_part_find
333
334/*
335 * definitions for ext2 flag ioctls (linux really needs a generic
336 * interface for this).
337 */
338
339/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support
340 * chattr/lsattr */
David Howells36695672006-08-29 19:06:16 +0100341#define HFSPLUS_IOC_EXT2_GETFLAGS FS_IOC_GETFLAGS
342#define HFSPLUS_IOC_EXT2_SETFLAGS FS_IOC_SETFLAGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343
344
345/*
Matthew Garretta051f712012-02-06 15:14:40 -0500346 * hfs+-specific ioctl for making the filesystem bootable
347 */
348#define HFSPLUS_IOC_BLESS _IO('h', 0x80)
349
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -0800350typedef int (*search_strategy_t)(struct hfs_bnode *,
351 struct hfs_find_data *,
352 int *, int *, int *);
353
Matthew Garretta051f712012-02-06 15:14:40 -0500354/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355 * Functions in any *.c used in other files
356 */
357
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -0800358/* attributes.c */
359int hfsplus_create_attr_tree_cache(void);
360void hfsplus_destroy_attr_tree_cache(void);
361hfsplus_attr_entry *hfsplus_alloc_attr_entry(void);
362void hfsplus_destroy_attr_entry(hfsplus_attr_entry *entry_p);
363int hfsplus_attr_bin_cmp_key(const hfsplus_btree_key *,
364 const hfsplus_btree_key *);
365int hfsplus_attr_build_key(struct super_block *, hfsplus_btree_key *,
366 u32, const char *);
367void hfsplus_attr_build_key_uni(hfsplus_btree_key *key,
368 u32 cnid,
369 struct hfsplus_attr_unistr *name);
370int hfsplus_find_attr(struct super_block *, u32,
371 const char *, struct hfs_find_data *);
372int hfsplus_attr_exists(struct inode *inode, const char *name);
373int hfsplus_create_attr(struct inode *, const char *, const void *, size_t);
374int hfsplus_delete_attr(struct inode *, const char *);
375int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid);
376
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377/* bitmap.c */
378int hfsplus_block_allocate(struct super_block *, u32, u32, u32 *);
379int hfsplus_block_free(struct super_block *, u32, u32);
380
381/* btree.c */
382struct hfs_btree *hfs_btree_open(struct super_block *, u32);
383void hfs_btree_close(struct hfs_btree *);
Vyacheslav Dubeyko81cc7fa2012-12-20 15:05:28 -0800384int hfs_btree_write(struct hfs_btree *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *);
386void hfs_bmap_free(struct hfs_bnode *);
387
388/* bnode.c */
389void hfs_bnode_read(struct hfs_bnode *, void *, int, int);
390u16 hfs_bnode_read_u16(struct hfs_bnode *, int);
391u8 hfs_bnode_read_u8(struct hfs_bnode *, int);
392void hfs_bnode_read_key(struct hfs_bnode *, void *, int);
393void hfs_bnode_write(struct hfs_bnode *, void *, int, int);
394void hfs_bnode_write_u16(struct hfs_bnode *, int, u16);
395void hfs_bnode_clear(struct hfs_bnode *, int, int);
396void hfs_bnode_copy(struct hfs_bnode *, int,
397 struct hfs_bnode *, int, int);
398void hfs_bnode_move(struct hfs_bnode *, int, int, int);
399void hfs_bnode_dump(struct hfs_bnode *);
400void hfs_bnode_unlink(struct hfs_bnode *);
401struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *, u32);
402struct hfs_bnode *hfs_bnode_find(struct hfs_btree *, u32);
403void hfs_bnode_unhash(struct hfs_bnode *);
404void hfs_bnode_free(struct hfs_bnode *);
405struct hfs_bnode *hfs_bnode_create(struct hfs_btree *, u32);
406void hfs_bnode_get(struct hfs_bnode *);
407void hfs_bnode_put(struct hfs_bnode *);
408
409/* brec.c */
410u16 hfs_brec_lenoff(struct hfs_bnode *, u16, u16 *);
411u16 hfs_brec_keylen(struct hfs_bnode *, u16);
412int hfs_brec_insert(struct hfs_find_data *, void *, int);
413int hfs_brec_remove(struct hfs_find_data *);
414
415/* bfind.c */
416int hfs_find_init(struct hfs_btree *, struct hfs_find_data *);
417void hfs_find_exit(struct hfs_find_data *);
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -0800418int hfs_find_1st_rec_by_cnid(struct hfs_bnode *,
419 struct hfs_find_data *,
420 int *, int *, int *);
421int hfs_find_rec_by_key(struct hfs_bnode *,
422 struct hfs_find_data *,
423 int *, int *, int *);
424int __hfs_brec_find(struct hfs_bnode *, struct hfs_find_data *,
425 search_strategy_t);
426int hfs_brec_find(struct hfs_find_data *, search_strategy_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427int hfs_brec_read(struct hfs_find_data *, void *, int);
428int hfs_brec_goto(struct hfs_find_data *, int);
429
430/* catalog.c */
Anton Salikhmetov2753cc22010-12-16 18:08:38 +0200431int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *,
432 const hfsplus_btree_key *);
433int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *,
434 const hfsplus_btree_key *);
435void hfsplus_cat_build_key(struct super_block *sb,
436 hfsplus_btree_key *, u32, struct qstr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *);
438int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *);
439int hfsplus_delete_cat(u32, struct inode *, struct qstr *);
440int hfsplus_rename_cat(u32, struct inode *, struct qstr *,
441 struct inode *, struct qstr *);
Christoph Hellwig90e61692010-10-14 09:54:39 -0400442void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443
Adrian Bunk4b0a8da2008-04-29 00:58:52 -0700444/* dir.c */
445extern const struct inode_operations hfsplus_dir_inode_operations;
446extern const struct file_operations hfsplus_dir_operations;
447
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448/* extents.c */
David Elliott2179d372006-01-18 17:43:08 -0800449int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *);
Alexey Khoroshilovdd7f3d52011-07-06 02:30:00 +0400450int hfsplus_ext_write_extent(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int);
Anton Salikhmetov2753cc22010-12-16 18:08:38 +0200452int hfsplus_free_fork(struct super_block *, u32,
453 struct hfsplus_fork_raw *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454int hfsplus_file_extend(struct inode *);
455void hfsplus_file_truncate(struct inode *);
456
457/* inode.c */
Christoph Hellwigf5e54d62006-06-28 04:26:44 -0700458extern const struct address_space_operations hfsplus_aops;
459extern const struct address_space_operations hfsplus_btree_aops;
Al Viroe16404e2009-02-20 05:55:13 +0000460extern const struct dentry_operations hfsplus_dentry_operations;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461
462void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
463void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
464int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *);
465int hfsplus_cat_write_inode(struct inode *);
Al Viroc47da792011-07-26 03:26:51 -0400466struct inode *hfsplus_new_inode(struct super_block *, umode_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467void hfsplus_delete_inode(struct inode *);
Josef Bacik02c24a82011-07-16 20:44:56 -0400468int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
469 int datasync);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470
471/* ioctl.c */
Arnd Bergmann7cc4bcc2010-04-27 16:24:20 +0200472long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473
474/* options.c */
Roman Zippel717dd80e2005-09-06 15:18:48 -0700475int hfsplus_parse_options(char *, struct hfsplus_sb_info *);
Christoph Hellwig6f80dfe2010-11-07 23:01:17 +0100476int hfsplus_parse_options_remount(char *input, int *force);
Roman Zippel717dd80e2005-09-06 15:18:48 -0700477void hfsplus_fill_defaults(struct hfsplus_sb_info *);
Al Viro34c80b12011-12-08 21:32:45 -0500478int hfsplus_show_options(struct seq_file *, struct dentry *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479
David Howells63525392008-02-07 00:15:40 -0800480/* super.c */
481struct inode *hfsplus_iget(struct super_block *, unsigned long);
Artem Bityutskiy9e6c5822012-07-12 17:26:31 +0300482void hfsplus_mark_mdb_dirty(struct super_block *sb);
David Howells63525392008-02-07 00:15:40 -0800483
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484/* tables.c */
485extern u16 hfsplus_case_fold_table[];
486extern u16 hfsplus_decompose_table[];
487extern u16 hfsplus_compose_table[];
488
489/* unicode.c */
Anton Salikhmetov2753cc22010-12-16 18:08:38 +0200490int hfsplus_strcasecmp(const struct hfsplus_unistr *,
491 const struct hfsplus_unistr *);
492int hfsplus_strcmp(const struct hfsplus_unistr *,
493 const struct hfsplus_unistr *);
494int hfsplus_uni2asc(struct super_block *,
495 const struct hfsplus_unistr *, char *, int *);
496int hfsplus_asc2uni(struct super_block *,
Vyacheslav Dubeyko324ef392013-02-27 17:03:04 -0800497 struct hfsplus_unistr *, int, const char *, int);
Linus Torvalds0c21e3a2011-01-07 17:16:27 -0800498int hfsplus_hash_dentry(const struct dentry *dentry,
499 const struct inode *inode, struct qstr *str);
Nick Piggin621e1552011-01-07 17:49:27 +1100500int hfsplus_compare_dentry(const struct dentry *parent,
501 const struct inode *pinode,
502 const struct dentry *dentry, const struct inode *inode,
503 unsigned int len, const char *str, const struct qstr *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504
505/* wrapper.c */
506int hfsplus_read_wrapper(struct super_block *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507int hfs_part_find(struct super_block *, sector_t *, sector_t *);
Seth Forshee65965282011-07-18 08:06:23 -0700508int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
509 void *buf, void **data, int rw);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510
511/* time macros */
512#define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U)
513#define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U))
514
515/* compatibility */
516#define hfsp_mt2ut(t) (struct timespec){ .tv_sec = __hfsp_mt2ut(t) }
517#define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec)
518#define hfsp_now2mt() __hfsp_ut2mt(get_seconds())
519
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520#endif