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