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