| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 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 Kaehlcke | 895c23f | 2008-07-25 01:46:36 -0700 | [diff] [blame] | 14 | #include <linux/mutex.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/buffer_head.h> | 
| Seth Forshee | 6596528 | 2011-07-18 08:06:23 -0700 | [diff] [blame] | 16 | #include <linux/blkdev.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #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 Salikhmetov | 21f2296 | 2010-12-16 18:08:39 +0200 | [diff] [blame] | 27 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #define DBG_MASK	(0) | 
|  | 33 |  | 
|  | 34 | #define dprint(flg, fmt, args...) \ | 
| Anton Salikhmetov | b2837fc | 2010-12-16 18:08:41 +0200 | [diff] [blame] | 35 | if (flg & DBG_MASK) \ | 
|  | 36 | printk(fmt , ## args) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 |  | 
|  | 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 Salikhmetov | 2753cc2 | 2010-12-16 18:08:38 +0200 | [diff] [blame] | 44 | typedef int (*btree_keycmp)(const hfsplus_btree_key *, | 
|  | 45 | const hfsplus_btree_key *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 |  | 
|  | 47 | #define NODE_HASH_SIZE	256 | 
|  | 48 |  | 
|  | 49 | /* An HFS+ BTree held in memory */ | 
|  | 50 | struct 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 Gleixner | 467c3d9 | 2010-10-01 05:46:52 +0200 | [diff] [blame] | 69 | struct mutex tree_lock; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 |  | 
|  | 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 |  | 
|  | 77 | struct page; | 
|  | 78 |  | 
|  | 79 | /* An HFS+ BTree node in memory */ | 
|  | 80 | struct 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 |  | 
|  | 110 | struct hfsplus_vh; | 
|  | 111 | struct hfs_btree; | 
|  | 112 |  | 
|  | 113 | struct hfsplus_sb_info { | 
| Seth Forshee | 6596528 | 2011-07-18 08:06:23 -0700 | [diff] [blame] | 114 | void *s_vhdr_buf; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | struct hfsplus_vh *s_vhdr; | 
| Seth Forshee | 6596528 | 2011-07-18 08:06:23 -0700 | [diff] [blame] | 116 | void *s_backup_vhdr_buf; | 
| Christoph Hellwig | 52399b1 | 2010-11-23 14:37:47 +0100 | [diff] [blame] | 117 | struct hfsplus_vh *s_backup_vhdr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | 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 Hellwig | 52399b1 | 2010-11-23 14:37:47 +0100 | [diff] [blame] | 127 | sector_t part_start; | 
|  | 128 | sector_t sect_count; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | int fs_shift; | 
|  | 130 |  | 
| Christoph Hellwig | 7ac9fb9 | 2010-10-01 05:45:08 +0200 | [diff] [blame] | 131 | /* immutable data from the volume header */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | u32 alloc_blksz; | 
|  | 133 | int alloc_blksz_shift; | 
|  | 134 | u32 total_blocks; | 
| Christoph Hellwig | 7ac9fb9 | 2010-10-01 05:45:08 +0200 | [diff] [blame] | 135 | u32 data_clump_blocks, rsrc_clump_blocks; | 
|  | 136 |  | 
|  | 137 | /* mutable data from the volume header, protected by alloc_mutex */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | u32 free_blocks; | 
| Christoph Hellwig | 7ac9fb9 | 2010-10-01 05:45:08 +0200 | [diff] [blame] | 139 | struct mutex alloc_mutex; | 
|  | 140 |  | 
|  | 141 | /* mutable data from the volume header, protected by vh_mutex */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | u32 next_cnid; | 
|  | 143 | u32 file_count; | 
|  | 144 | u32 folder_count; | 
| Christoph Hellwig | 7ac9fb9 | 2010-10-01 05:45:08 +0200 | [diff] [blame] | 145 | struct mutex vh_mutex; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 |  | 
|  | 147 | /* Config options */ | 
|  | 148 | u32 creator; | 
|  | 149 | u32 type; | 
|  | 150 |  | 
|  | 151 | umode_t umask; | 
| Eric W. Biederman | 16525e3 | 2012-02-07 16:27:17 -0800 | [diff] [blame] | 152 | kuid_t uid; | 
|  | 153 | kgid_t gid; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 |  | 
|  | 155 | int part, session; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | unsigned long flags; | 
| Artem Bityutskiy | 9e6c582 | 2012-07-12 17:26:31 +0300 | [diff] [blame] | 157 |  | 
|  | 158 | int work_queued;               /* non-zero delayed work is queued */ | 
|  | 159 | struct delayed_work sync_work; /* FS sync delayed work */ | 
|  | 160 | spinlock_t work_lock;          /* protects sync_work and work_queued */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | }; | 
|  | 162 |  | 
| Christoph Hellwig | 84adede | 2010-10-01 05:45:20 +0200 | [diff] [blame] | 163 | #define HFSPLUS_SB_WRITEBACKUP	0 | 
|  | 164 | #define HFSPLUS_SB_NODECOMPOSE	1 | 
|  | 165 | #define HFSPLUS_SB_FORCE	2 | 
|  | 166 | #define HFSPLUS_SB_HFSX		3 | 
|  | 167 | #define HFSPLUS_SB_CASEFOLD	4 | 
| Christoph Hellwig | 34a2d31 | 2010-11-23 14:38:21 +0100 | [diff] [blame] | 168 | #define HFSPLUS_SB_NOBARRIER	5 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 |  | 
| Christoph Hellwig | e349470 | 2010-11-23 14:38:15 +0100 | [diff] [blame] | 170 | static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) | 
|  | 171 | { | 
|  | 172 | return sb->s_fs_info; | 
|  | 173 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 |  | 
|  | 175 |  | 
|  | 176 | struct hfsplus_inode_info { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | atomic_t opencnt; | 
|  | 178 |  | 
| Christoph Hellwig | 7fcc99f | 2010-10-01 05:46:31 +0200 | [diff] [blame] | 179 | /* | 
|  | 180 | * Extent allocation information, protected by extents_lock. | 
|  | 181 | */ | 
|  | 182 | u32 first_blocks; | 
|  | 183 | u32 clump_blocks; | 
|  | 184 | u32 alloc_blocks; | 
|  | 185 | u32 cached_start; | 
|  | 186 | u32 cached_blocks; | 
|  | 187 | hfsplus_extent_rec first_extents; | 
|  | 188 | hfsplus_extent_rec cached_extents; | 
| Christoph Hellwig | b33b792 | 2010-11-23 14:38:13 +0100 | [diff] [blame] | 189 | unsigned int extent_state; | 
| Christoph Hellwig | 7fcc99f | 2010-10-01 05:46:31 +0200 | [diff] [blame] | 190 | struct mutex extents_lock; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 |  | 
| Christoph Hellwig | 7fcc99f | 2010-10-01 05:46:31 +0200 | [diff] [blame] | 192 | /* | 
|  | 193 | * Immutable data. | 
|  | 194 | */ | 
|  | 195 | struct inode *rsrc_inode; | 
| Roman Zippel | 9a4cad9 | 2006-01-18 17:43:09 -0800 | [diff] [blame] | 196 | __be32 create_date; | 
| Christoph Hellwig | f6089ff | 2010-10-14 09:54:28 -0400 | [diff] [blame] | 197 |  | 
|  | 198 | /* | 
|  | 199 | * Protected by sbi->vh_mutex. | 
|  | 200 | */ | 
|  | 201 | u32 linkid; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 |  | 
| Christoph Hellwig | 7fcc99f | 2010-10-01 05:46:31 +0200 | [diff] [blame] | 203 | /* | 
| Christoph Hellwig | b33b792 | 2010-11-23 14:38:13 +0100 | [diff] [blame] | 204 | * Accessed using atomic bitops. | 
|  | 205 | */ | 
|  | 206 | unsigned long flags; | 
|  | 207 |  | 
|  | 208 | /* | 
| Christoph Hellwig | 7fcc99f | 2010-10-01 05:46:31 +0200 | [diff] [blame] | 209 | * Protected by i_mutex. | 
|  | 210 | */ | 
|  | 211 | sector_t fs_blocks; | 
| Christoph Hellwig | 722c55d | 2010-10-14 09:54:33 -0400 | [diff] [blame] | 212 | u8 userflags;		/* BSD user file flags */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | struct list_head open_dir_list; | 
|  | 214 | loff_t phys_size; | 
| Christoph Hellwig | 7fcc99f | 2010-10-01 05:46:31 +0200 | [diff] [blame] | 215 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | struct inode vfs_inode; | 
|  | 217 | }; | 
|  | 218 |  | 
| Christoph Hellwig | b33b792 | 2010-11-23 14:38:13 +0100 | [diff] [blame] | 219 | #define HFSPLUS_EXT_DIRTY	0x0001 | 
|  | 220 | #define HFSPLUS_EXT_NEW		0x0002 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 |  | 
| Christoph Hellwig | b33b792 | 2010-11-23 14:38:13 +0100 | [diff] [blame] | 222 | #define HFSPLUS_I_RSRC		0	/* represents a resource fork */ | 
| Christoph Hellwig | e349470 | 2010-11-23 14:38:15 +0100 | [diff] [blame] | 223 | #define HFSPLUS_I_CAT_DIRTY	1	/* has changes in the catalog tree */ | 
|  | 224 | #define HFSPLUS_I_EXT_DIRTY	2	/* has changes in the extent tree */ | 
|  | 225 | #define HFSPLUS_I_ALLOC_DIRTY	3	/* has changes in the allocation file */ | 
| Christoph Hellwig | b33b792 | 2010-11-23 14:38:13 +0100 | [diff] [blame] | 226 |  | 
|  | 227 | #define HFSPLUS_IS_RSRC(inode) \ | 
|  | 228 | test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 |  | 
| Christoph Hellwig | e349470 | 2010-11-23 14:38:15 +0100 | [diff] [blame] | 230 | static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) | 
|  | 231 | { | 
|  | 232 | return list_entry(inode, struct hfsplus_inode_info, vfs_inode); | 
|  | 233 | } | 
|  | 234 |  | 
|  | 235 | /* | 
|  | 236 | * Mark an inode dirty, and also mark the btree in which the | 
|  | 237 | * specific type of metadata is stored. | 
|  | 238 | * For data or metadata that gets written back by into the catalog btree | 
|  | 239 | * by hfsplus_write_inode a plain mark_inode_dirty call is enough. | 
|  | 240 | */ | 
|  | 241 | static inline void hfsplus_mark_inode_dirty(struct inode *inode, | 
|  | 242 | unsigned int flag) | 
|  | 243 | { | 
|  | 244 | set_bit(flag, &HFSPLUS_I(inode)->flags); | 
|  | 245 | mark_inode_dirty(inode); | 
|  | 246 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 |  | 
|  | 248 | struct hfs_find_data { | 
|  | 249 | /* filled by caller */ | 
|  | 250 | hfsplus_btree_key *search_key; | 
|  | 251 | hfsplus_btree_key *key; | 
|  | 252 | /* filled by find */ | 
|  | 253 | struct hfs_btree *tree; | 
|  | 254 | struct hfs_bnode *bnode; | 
|  | 255 | /* filled by findrec */ | 
|  | 256 | int record; | 
|  | 257 | int keyoffset, keylength; | 
|  | 258 | int entryoffset, entrylength; | 
|  | 259 | }; | 
|  | 260 |  | 
|  | 261 | struct hfsplus_readdir_data { | 
|  | 262 | struct list_head list; | 
|  | 263 | struct file *file; | 
|  | 264 | struct hfsplus_cat_key key; | 
|  | 265 | }; | 
|  | 266 |  | 
| Seth Forshee | 6596528 | 2011-07-18 08:06:23 -0700 | [diff] [blame] | 267 | /* | 
|  | 268 | * Find minimum acceptible I/O size for an hfsplus sb. | 
|  | 269 | */ | 
|  | 270 | static inline unsigned short hfsplus_min_io_size(struct super_block *sb) | 
|  | 271 | { | 
|  | 272 | return max_t(unsigned short, bdev_logical_block_size(sb->s_bdev), | 
|  | 273 | HFSPLUS_SECTOR_SIZE); | 
|  | 274 | } | 
|  | 275 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | #define hfs_btree_open hfsplus_btree_open | 
|  | 277 | #define hfs_btree_close hfsplus_btree_close | 
|  | 278 | #define hfs_btree_write hfsplus_btree_write | 
|  | 279 | #define hfs_bmap_alloc hfsplus_bmap_alloc | 
|  | 280 | #define hfs_bmap_free hfsplus_bmap_free | 
|  | 281 | #define hfs_bnode_read hfsplus_bnode_read | 
|  | 282 | #define hfs_bnode_read_u16 hfsplus_bnode_read_u16 | 
|  | 283 | #define hfs_bnode_read_u8 hfsplus_bnode_read_u8 | 
|  | 284 | #define hfs_bnode_read_key hfsplus_bnode_read_key | 
|  | 285 | #define hfs_bnode_write hfsplus_bnode_write | 
|  | 286 | #define hfs_bnode_write_u16 hfsplus_bnode_write_u16 | 
|  | 287 | #define hfs_bnode_clear hfsplus_bnode_clear | 
|  | 288 | #define hfs_bnode_copy hfsplus_bnode_copy | 
|  | 289 | #define hfs_bnode_move hfsplus_bnode_move | 
|  | 290 | #define hfs_bnode_dump hfsplus_bnode_dump | 
|  | 291 | #define hfs_bnode_unlink hfsplus_bnode_unlink | 
|  | 292 | #define hfs_bnode_findhash hfsplus_bnode_findhash | 
|  | 293 | #define hfs_bnode_find hfsplus_bnode_find | 
|  | 294 | #define hfs_bnode_unhash hfsplus_bnode_unhash | 
|  | 295 | #define hfs_bnode_free hfsplus_bnode_free | 
|  | 296 | #define hfs_bnode_create hfsplus_bnode_create | 
|  | 297 | #define hfs_bnode_get hfsplus_bnode_get | 
|  | 298 | #define hfs_bnode_put hfsplus_bnode_put | 
|  | 299 | #define hfs_brec_lenoff hfsplus_brec_lenoff | 
|  | 300 | #define hfs_brec_keylen hfsplus_brec_keylen | 
|  | 301 | #define hfs_brec_insert hfsplus_brec_insert | 
|  | 302 | #define hfs_brec_remove hfsplus_brec_remove | 
|  | 303 | #define hfs_find_init hfsplus_find_init | 
|  | 304 | #define hfs_find_exit hfsplus_find_exit | 
|  | 305 | #define __hfs_brec_find __hplusfs_brec_find | 
|  | 306 | #define hfs_brec_find hfsplus_brec_find | 
|  | 307 | #define hfs_brec_read hfsplus_brec_read | 
|  | 308 | #define hfs_brec_goto hfsplus_brec_goto | 
|  | 309 | #define hfs_part_find hfsplus_part_find | 
|  | 310 |  | 
|  | 311 | /* | 
|  | 312 | * definitions for ext2 flag ioctls (linux really needs a generic | 
|  | 313 | * interface for this). | 
|  | 314 | */ | 
|  | 315 |  | 
|  | 316 | /* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support | 
|  | 317 | * chattr/lsattr */ | 
| David Howells | 3669567 | 2006-08-29 19:06:16 +0100 | [diff] [blame] | 318 | #define HFSPLUS_IOC_EXT2_GETFLAGS	FS_IOC_GETFLAGS | 
|  | 319 | #define HFSPLUS_IOC_EXT2_SETFLAGS	FS_IOC_SETFLAGS | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 |  | 
|  | 321 |  | 
|  | 322 | /* | 
| Matthew Garrett | a051f71 | 2012-02-06 15:14:40 -0500 | [diff] [blame] | 323 | * hfs+-specific ioctl for making the filesystem bootable | 
|  | 324 | */ | 
|  | 325 | #define HFSPLUS_IOC_BLESS _IO('h', 0x80) | 
|  | 326 |  | 
|  | 327 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | * Functions in any *.c used in other files | 
|  | 329 | */ | 
|  | 330 |  | 
|  | 331 | /* bitmap.c */ | 
|  | 332 | int hfsplus_block_allocate(struct super_block *, u32, u32, u32 *); | 
|  | 333 | int hfsplus_block_free(struct super_block *, u32, u32); | 
|  | 334 |  | 
|  | 335 | /* btree.c */ | 
|  | 336 | struct hfs_btree *hfs_btree_open(struct super_block *, u32); | 
|  | 337 | void hfs_btree_close(struct hfs_btree *); | 
|  | 338 | void hfs_btree_write(struct hfs_btree *); | 
|  | 339 | struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *); | 
|  | 340 | void hfs_bmap_free(struct hfs_bnode *); | 
|  | 341 |  | 
|  | 342 | /* bnode.c */ | 
|  | 343 | void hfs_bnode_read(struct hfs_bnode *, void *, int, int); | 
|  | 344 | u16 hfs_bnode_read_u16(struct hfs_bnode *, int); | 
|  | 345 | u8 hfs_bnode_read_u8(struct hfs_bnode *, int); | 
|  | 346 | void hfs_bnode_read_key(struct hfs_bnode *, void *, int); | 
|  | 347 | void hfs_bnode_write(struct hfs_bnode *, void *, int, int); | 
|  | 348 | void hfs_bnode_write_u16(struct hfs_bnode *, int, u16); | 
|  | 349 | void hfs_bnode_clear(struct hfs_bnode *, int, int); | 
|  | 350 | void hfs_bnode_copy(struct hfs_bnode *, int, | 
|  | 351 | struct hfs_bnode *, int, int); | 
|  | 352 | void hfs_bnode_move(struct hfs_bnode *, int, int, int); | 
|  | 353 | void hfs_bnode_dump(struct hfs_bnode *); | 
|  | 354 | void hfs_bnode_unlink(struct hfs_bnode *); | 
|  | 355 | struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *, u32); | 
|  | 356 | struct hfs_bnode *hfs_bnode_find(struct hfs_btree *, u32); | 
|  | 357 | void hfs_bnode_unhash(struct hfs_bnode *); | 
|  | 358 | void hfs_bnode_free(struct hfs_bnode *); | 
|  | 359 | struct hfs_bnode *hfs_bnode_create(struct hfs_btree *, u32); | 
|  | 360 | void hfs_bnode_get(struct hfs_bnode *); | 
|  | 361 | void hfs_bnode_put(struct hfs_bnode *); | 
|  | 362 |  | 
|  | 363 | /* brec.c */ | 
|  | 364 | u16 hfs_brec_lenoff(struct hfs_bnode *, u16, u16 *); | 
|  | 365 | u16 hfs_brec_keylen(struct hfs_bnode *, u16); | 
|  | 366 | int hfs_brec_insert(struct hfs_find_data *, void *, int); | 
|  | 367 | int hfs_brec_remove(struct hfs_find_data *); | 
|  | 368 |  | 
|  | 369 | /* bfind.c */ | 
|  | 370 | int hfs_find_init(struct hfs_btree *, struct hfs_find_data *); | 
|  | 371 | void hfs_find_exit(struct hfs_find_data *); | 
|  | 372 | int __hfs_brec_find(struct hfs_bnode *, struct hfs_find_data *); | 
|  | 373 | int hfs_brec_find(struct hfs_find_data *); | 
|  | 374 | int hfs_brec_read(struct hfs_find_data *, void *, int); | 
|  | 375 | int hfs_brec_goto(struct hfs_find_data *, int); | 
|  | 376 |  | 
|  | 377 | /* catalog.c */ | 
| Anton Salikhmetov | 2753cc2 | 2010-12-16 18:08:38 +0200 | [diff] [blame] | 378 | int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *, | 
|  | 379 | const hfsplus_btree_key *); | 
|  | 380 | int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *, | 
|  | 381 | const hfsplus_btree_key *); | 
|  | 382 | void hfsplus_cat_build_key(struct super_block *sb, | 
|  | 383 | hfsplus_btree_key *, u32, struct qstr *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *); | 
|  | 385 | int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *); | 
|  | 386 | int hfsplus_delete_cat(u32, struct inode *, struct qstr *); | 
|  | 387 | int hfsplus_rename_cat(u32, struct inode *, struct qstr *, | 
|  | 388 | struct inode *, struct qstr *); | 
| Christoph Hellwig | 90e6169 | 2010-10-14 09:54:39 -0400 | [diff] [blame] | 389 | void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 |  | 
| Adrian Bunk | 4b0a8da | 2008-04-29 00:58:52 -0700 | [diff] [blame] | 391 | /* dir.c */ | 
|  | 392 | extern const struct inode_operations hfsplus_dir_inode_operations; | 
|  | 393 | extern const struct file_operations hfsplus_dir_operations; | 
|  | 394 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | /* extents.c */ | 
| David Elliott | 2179d37 | 2006-01-18 17:43:08 -0800 | [diff] [blame] | 396 | int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); | 
| Alexey Khoroshilov | dd7f3d5 | 2011-07-06 02:30:00 +0400 | [diff] [blame] | 397 | int hfsplus_ext_write_extent(struct inode *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int); | 
| Anton Salikhmetov | 2753cc2 | 2010-12-16 18:08:38 +0200 | [diff] [blame] | 399 | int hfsplus_free_fork(struct super_block *, u32, | 
|  | 400 | struct hfsplus_fork_raw *, int); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | int hfsplus_file_extend(struct inode *); | 
|  | 402 | void hfsplus_file_truncate(struct inode *); | 
|  | 403 |  | 
|  | 404 | /* inode.c */ | 
| Christoph Hellwig | f5e54d6 | 2006-06-28 04:26:44 -0700 | [diff] [blame] | 405 | extern const struct address_space_operations hfsplus_aops; | 
|  | 406 | extern const struct address_space_operations hfsplus_btree_aops; | 
| Al Viro | e16404e | 2009-02-20 05:55:13 +0000 | [diff] [blame] | 407 | extern const struct dentry_operations hfsplus_dentry_operations; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 |  | 
|  | 409 | void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); | 
|  | 410 | void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); | 
|  | 411 | int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); | 
|  | 412 | int hfsplus_cat_write_inode(struct inode *); | 
| Al Viro | c47da79 | 2011-07-26 03:26:51 -0400 | [diff] [blame] | 413 | struct inode *hfsplus_new_inode(struct super_block *, umode_t); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | void hfsplus_delete_inode(struct inode *); | 
| Josef Bacik | 02c24a8 | 2011-07-16 20:44:56 -0400 | [diff] [blame] | 415 | int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | 
|  | 416 | int datasync); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 |  | 
|  | 418 | /* ioctl.c */ | 
| Arnd Bergmann | 7cc4bcc | 2010-04-27 16:24:20 +0200 | [diff] [blame] | 419 | long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | int hfsplus_setxattr(struct dentry *dentry, const char *name, | 
|  | 421 | const void *value, size_t size, int flags); | 
|  | 422 | ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, | 
|  | 423 | void *value, size_t size); | 
|  | 424 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); | 
|  | 425 |  | 
|  | 426 | /* options.c */ | 
| Roman Zippel | 717dd80 | 2005-09-06 15:18:48 -0700 | [diff] [blame] | 427 | int hfsplus_parse_options(char *, struct hfsplus_sb_info *); | 
| Christoph Hellwig | 6f80dfe | 2010-11-07 23:01:17 +0100 | [diff] [blame] | 428 | int hfsplus_parse_options_remount(char *input, int *force); | 
| Roman Zippel | 717dd80 | 2005-09-06 15:18:48 -0700 | [diff] [blame] | 429 | void hfsplus_fill_defaults(struct hfsplus_sb_info *); | 
| Al Viro | 34c80b1 | 2011-12-08 21:32:45 -0500 | [diff] [blame] | 430 | int hfsplus_show_options(struct seq_file *, struct dentry *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 |  | 
| David Howells | 6352539 | 2008-02-07 00:15:40 -0800 | [diff] [blame] | 432 | /* super.c */ | 
|  | 433 | struct inode *hfsplus_iget(struct super_block *, unsigned long); | 
| Artem Bityutskiy | 9e6c582 | 2012-07-12 17:26:31 +0300 | [diff] [blame] | 434 | void hfsplus_mark_mdb_dirty(struct super_block *sb); | 
| David Howells | 6352539 | 2008-02-07 00:15:40 -0800 | [diff] [blame] | 435 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | /* tables.c */ | 
|  | 437 | extern u16 hfsplus_case_fold_table[]; | 
|  | 438 | extern u16 hfsplus_decompose_table[]; | 
|  | 439 | extern u16 hfsplus_compose_table[]; | 
|  | 440 |  | 
|  | 441 | /* unicode.c */ | 
| Anton Salikhmetov | 2753cc2 | 2010-12-16 18:08:38 +0200 | [diff] [blame] | 442 | int hfsplus_strcasecmp(const struct hfsplus_unistr *, | 
|  | 443 | const struct hfsplus_unistr *); | 
|  | 444 | int hfsplus_strcmp(const struct hfsplus_unistr *, | 
|  | 445 | const struct hfsplus_unistr *); | 
|  | 446 | int hfsplus_uni2asc(struct super_block *, | 
|  | 447 | const struct hfsplus_unistr *, char *, int *); | 
|  | 448 | int hfsplus_asc2uni(struct super_block *, | 
|  | 449 | struct hfsplus_unistr *, const char *, int); | 
| Linus Torvalds | 0c21e3a | 2011-01-07 17:16:27 -0800 | [diff] [blame] | 450 | int hfsplus_hash_dentry(const struct dentry *dentry, | 
|  | 451 | const struct inode *inode, struct qstr *str); | 
| Nick Piggin | 621e155 | 2011-01-07 17:49:27 +1100 | [diff] [blame] | 452 | int hfsplus_compare_dentry(const struct dentry *parent, | 
|  | 453 | const struct inode *pinode, | 
|  | 454 | const struct dentry *dentry, const struct inode *inode, | 
|  | 455 | unsigned int len, const char *str, const struct qstr *name); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 |  | 
|  | 457 | /* wrapper.c */ | 
|  | 458 | int hfsplus_read_wrapper(struct super_block *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | int hfs_part_find(struct super_block *, sector_t *, sector_t *); | 
| Seth Forshee | 6596528 | 2011-07-18 08:06:23 -0700 | [diff] [blame] | 460 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | 
|  | 461 | void *buf, void **data, int rw); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 |  | 
|  | 463 | /* time macros */ | 
|  | 464 | #define __hfsp_mt2ut(t)		(be32_to_cpu(t) - 2082844800U) | 
|  | 465 | #define __hfsp_ut2mt(t)		(cpu_to_be32(t + 2082844800U)) | 
|  | 466 |  | 
|  | 467 | /* compatibility */ | 
|  | 468 | #define hfsp_mt2ut(t)		(struct timespec){ .tv_sec = __hfsp_mt2ut(t) } | 
|  | 469 | #define hfsp_ut2mt(t)		__hfsp_ut2mt((t).tv_sec) | 
|  | 470 | #define hfsp_now2mt()		__hfsp_ut2mt(get_seconds()) | 
|  | 471 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | #endif |