2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* linux/include/linux/hfsplus_fs.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999
|
|
|
|
* Brad Boyer (flar@pants.nu)
|
|
|
|
* (C) 2003 Ardis Technologies <roman@ardistech.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_HFSPLUS_FS_H
|
|
|
|
#define _LINUX_HFSPLUS_FS_H
|
|
|
|
|
2013-04-30 22:27:55 +00:00
|
|
|
#ifdef pr_fmt
|
|
|
|
#undef pr_fmt
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/fs.h>
|
2008-07-25 08:46:36 +00:00
|
|
|
#include <linux/mutex.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/buffer_head.h>
|
2011-07-18 15:06:23 +00:00
|
|
|
#include <linux/blkdev.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include "hfsplus_raw.h"
|
|
|
|
|
|
|
|
#define DBG_BNODE_REFS 0x00000001
|
|
|
|
#define DBG_BNODE_MOD 0x00000002
|
|
|
|
#define DBG_CAT_MOD 0x00000004
|
|
|
|
#define DBG_INODE 0x00000008
|
|
|
|
#define DBG_SUPER 0x00000010
|
|
|
|
#define DBG_EXTENT 0x00000020
|
|
|
|
#define DBG_BITMAP 0x00000040
|
2013-02-28 01:03:04 +00:00
|
|
|
#define DBG_ATTR_MOD 0x00000080
|
2013-09-11 21:24:28 +00:00
|
|
|
#define DBG_ACL_MOD 0x00000100
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-12-16 16:08:39 +00:00
|
|
|
#if 0
|
|
|
|
#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD)
|
|
|
|
#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE)
|
|
|
|
#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT)
|
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
#define DBG_MASK (0)
|
|
|
|
|
2013-04-30 22:27:55 +00:00
|
|
|
#define hfs_dbg(flg, fmt, ...) \
|
|
|
|
do { \
|
|
|
|
if (DBG_##flg & DBG_MASK) \
|
|
|
|
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
|
2013-04-30 22:27:54 +00:00
|
|
|
} while (0)
|
|
|
|
|
2013-04-30 22:27:55 +00:00
|
|
|
#define hfs_dbg_cont(flg, fmt, ...) \
|
|
|
|
do { \
|
|
|
|
if (DBG_##flg & DBG_MASK) \
|
|
|
|
pr_cont(fmt, ##__VA_ARGS__); \
|
2013-04-30 22:27:54 +00:00
|
|
|
} while (0)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Runtime config options */
|
|
|
|
#define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */
|
|
|
|
|
|
|
|
#define HFSPLUS_TYPE_DATA 0x00
|
|
|
|
#define HFSPLUS_TYPE_RSRC 0xFF
|
|
|
|
|
2010-12-16 16:08:38 +00:00
|
|
|
typedef int (*btree_keycmp)(const hfsplus_btree_key *,
|
|
|
|
const hfsplus_btree_key *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define NODE_HASH_SIZE 256
|
|
|
|
|
2013-02-28 01:03:04 +00:00
|
|
|
/* B-tree mutex nested subclasses */
|
|
|
|
enum hfsplus_btree_mutex_classes {
|
|
|
|
CATALOG_BTREE_MUTEX,
|
|
|
|
EXTENTS_BTREE_MUTEX,
|
|
|
|
ATTR_BTREE_MUTEX,
|
|
|
|
};
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* An HFS+ BTree held in memory */
|
|
|
|
struct hfs_btree {
|
|
|
|
struct super_block *sb;
|
|
|
|
struct inode *inode;
|
|
|
|
btree_keycmp keycmp;
|
|
|
|
|
|
|
|
u32 cnid;
|
|
|
|
u32 root;
|
|
|
|
u32 leaf_count;
|
|
|
|
u32 leaf_head;
|
|
|
|
u32 leaf_tail;
|
|
|
|
u32 node_count;
|
|
|
|
u32 free_nodes;
|
|
|
|
u32 attributes;
|
|
|
|
|
|
|
|
unsigned int node_size;
|
|
|
|
unsigned int node_size_shift;
|
|
|
|
unsigned int max_key_len;
|
|
|
|
unsigned int depth;
|
|
|
|
|
2010-10-01 03:46:52 +00:00
|
|
|
struct mutex tree_lock;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
unsigned int pages_per_bnode;
|
|
|
|
spinlock_t hash_lock;
|
|
|
|
struct hfs_bnode *node_hash[NODE_HASH_SIZE];
|
|
|
|
int node_hash_cnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct page;
|
|
|
|
|
|
|
|
/* An HFS+ BTree node in memory */
|
|
|
|
struct hfs_bnode {
|
|
|
|
struct hfs_btree *tree;
|
|
|
|
|
|
|
|
u32 prev;
|
|
|
|
u32 this;
|
|
|
|
u32 next;
|
|
|
|
u32 parent;
|
|
|
|
|
|
|
|
u16 num_recs;
|
|
|
|
u8 type;
|
|
|
|
u8 height;
|
|
|
|
|
|
|
|
struct hfs_bnode *next_hash;
|
|
|
|
unsigned long flags;
|
|
|
|
wait_queue_head_t lock_wq;
|
|
|
|
atomic_t refcnt;
|
|
|
|
unsigned int page_offset;
|
|
|
|
struct page *page[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define HFS_BNODE_LOCK 0
|
|
|
|
#define HFS_BNODE_ERROR 1
|
|
|
|
#define HFS_BNODE_NEW 2
|
|
|
|
#define HFS_BNODE_DIRTY 3
|
|
|
|
#define HFS_BNODE_DELETED 4
|
|
|
|
|
2013-11-12 23:11:09 +00:00
|
|
|
/*
|
|
|
|
* Attributes file states
|
|
|
|
*/
|
|
|
|
#define HFSPLUS_EMPTY_ATTR_TREE 0
|
|
|
|
#define HFSPLUS_CREATING_ATTR_TREE 1
|
|
|
|
#define HFSPLUS_VALID_ATTR_TREE 2
|
|
|
|
#define HFSPLUS_FAILED_ATTR_TREE 3
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* HFS+ superblock info (built from Volume Header on disk)
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct hfsplus_vh;
|
|
|
|
struct hfs_btree;
|
|
|
|
|
|
|
|
struct hfsplus_sb_info {
|
2011-07-18 15:06:23 +00:00
|
|
|
void *s_vhdr_buf;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct hfsplus_vh *s_vhdr;
|
2011-07-18 15:06:23 +00:00
|
|
|
void *s_backup_vhdr_buf;
|
2010-11-23 13:37:47 +00:00
|
|
|
struct hfsplus_vh *s_backup_vhdr;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct hfs_btree *ext_tree;
|
|
|
|
struct hfs_btree *cat_tree;
|
|
|
|
struct hfs_btree *attr_tree;
|
2013-11-12 23:11:09 +00:00
|
|
|
atomic_t attr_tree_state;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct inode *alloc_file;
|
|
|
|
struct inode *hidden_dir;
|
|
|
|
struct nls_table *nls;
|
|
|
|
|
|
|
|
/* Runtime variables */
|
|
|
|
u32 blockoffset;
|
2010-11-23 13:37:47 +00:00
|
|
|
sector_t part_start;
|
|
|
|
sector_t sect_count;
|
2005-04-16 22:20:36 +00:00
|
|
|
int fs_shift;
|
|
|
|
|
2010-10-01 03:45:08 +00:00
|
|
|
/* immutable data from the volume header */
|
2005-04-16 22:20:36 +00:00
|
|
|
u32 alloc_blksz;
|
|
|
|
int alloc_blksz_shift;
|
|
|
|
u32 total_blocks;
|
2010-10-01 03:45:08 +00:00
|
|
|
u32 data_clump_blocks, rsrc_clump_blocks;
|
|
|
|
|
|
|
|
/* mutable data from the volume header, protected by alloc_mutex */
|
2005-04-16 22:20:36 +00:00
|
|
|
u32 free_blocks;
|
2010-10-01 03:45:08 +00:00
|
|
|
struct mutex alloc_mutex;
|
|
|
|
|
|
|
|
/* mutable data from the volume header, protected by vh_mutex */
|
2005-04-16 22:20:36 +00:00
|
|
|
u32 next_cnid;
|
|
|
|
u32 file_count;
|
|
|
|
u32 folder_count;
|
2010-10-01 03:45:08 +00:00
|
|
|
struct mutex vh_mutex;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Config options */
|
|
|
|
u32 creator;
|
|
|
|
u32 type;
|
|
|
|
|
|
|
|
umode_t umask;
|
2012-02-08 00:27:17 +00:00
|
|
|
kuid_t uid;
|
|
|
|
kgid_t gid;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
int part, session;
|
|
|
|
unsigned long flags;
|
2012-07-12 14:26:31 +00:00
|
|
|
|
|
|
|
int work_queued; /* non-zero delayed work is queued */
|
|
|
|
struct delayed_work sync_work; /* FS sync delayed work */
|
|
|
|
spinlock_t work_lock; /* protects sync_work and work_queued */
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2010-10-01 03:45:20 +00:00
|
|
|
#define HFSPLUS_SB_WRITEBACKUP 0
|
|
|
|
#define HFSPLUS_SB_NODECOMPOSE 1
|
|
|
|
#define HFSPLUS_SB_FORCE 2
|
|
|
|
#define HFSPLUS_SB_HFSX 3
|
|
|
|
#define HFSPLUS_SB_CASEFOLD 4
|
2010-11-23 13:38:21 +00:00
|
|
|
#define HFSPLUS_SB_NOBARRIER 5
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-23 13:38:15 +00:00
|
|
|
static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb)
|
|
|
|
{
|
|
|
|
return sb->s_fs_info;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct hfsplus_inode_info {
|
|
|
|
atomic_t opencnt;
|
|
|
|
|
2010-10-01 03:46:31 +00:00
|
|
|
/*
|
|
|
|
* Extent allocation information, protected by extents_lock.
|
|
|
|
*/
|
|
|
|
u32 first_blocks;
|
|
|
|
u32 clump_blocks;
|
|
|
|
u32 alloc_blocks;
|
|
|
|
u32 cached_start;
|
|
|
|
u32 cached_blocks;
|
|
|
|
hfsplus_extent_rec first_extents;
|
|
|
|
hfsplus_extent_rec cached_extents;
|
2010-11-23 13:38:13 +00:00
|
|
|
unsigned int extent_state;
|
2010-10-01 03:46:31 +00:00
|
|
|
struct mutex extents_lock;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-10-01 03:46:31 +00:00
|
|
|
/*
|
|
|
|
* Immutable data.
|
|
|
|
*/
|
|
|
|
struct inode *rsrc_inode;
|
2006-01-19 01:43:09 +00:00
|
|
|
__be32 create_date;
|
2010-10-14 13:54:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Protected by sbi->vh_mutex.
|
|
|
|
*/
|
|
|
|
u32 linkid;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-23 13:38:13 +00:00
|
|
|
/*
|
|
|
|
* Accessed using atomic bitops.
|
|
|
|
*/
|
|
|
|
unsigned long flags;
|
|
|
|
|
2010-10-01 03:46:31 +00:00
|
|
|
/*
|
|
|
|
* Protected by i_mutex.
|
|
|
|
*/
|
|
|
|
sector_t fs_blocks;
|
2010-10-14 13:54:33 +00:00
|
|
|
u8 userflags; /* BSD user file flags */
|
2014-03-10 22:49:51 +00:00
|
|
|
u32 subfolders; /* Subfolder count (HFSX only) */
|
2005-04-16 22:20:36 +00:00
|
|
|
struct list_head open_dir_list;
|
|
|
|
loff_t phys_size;
|
2010-10-01 03:46:31 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct inode vfs_inode;
|
|
|
|
};
|
|
|
|
|
2010-11-23 13:38:13 +00:00
|
|
|
#define HFSPLUS_EXT_DIRTY 0x0001
|
|
|
|
#define HFSPLUS_EXT_NEW 0x0002
|
|
|
|
|
|
|
|
#define HFSPLUS_I_RSRC 0 /* represents a resource fork */
|
2010-11-23 13:38:15 +00:00
|
|
|
#define HFSPLUS_I_CAT_DIRTY 1 /* has changes in the catalog tree */
|
|
|
|
#define HFSPLUS_I_EXT_DIRTY 2 /* has changes in the extent tree */
|
|
|
|
#define HFSPLUS_I_ALLOC_DIRTY 3 /* has changes in the allocation file */
|
2013-02-28 01:03:04 +00:00
|
|
|
#define HFSPLUS_I_ATTR_DIRTY 4 /* has changes in the attributes tree */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-23 13:38:13 +00:00
|
|
|
#define HFSPLUS_IS_RSRC(inode) \
|
|
|
|
test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-23 13:38:15 +00:00
|
|
|
static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode)
|
|
|
|
{
|
|
|
|
return list_entry(inode, struct hfsplus_inode_info, vfs_inode);
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-23 13:38:15 +00:00
|
|
|
/*
|
|
|
|
* Mark an inode dirty, and also mark the btree in which the
|
|
|
|
* specific type of metadata is stored.
|
|
|
|
* For data or metadata that gets written back by into the catalog btree
|
|
|
|
* by hfsplus_write_inode a plain mark_inode_dirty call is enough.
|
|
|
|
*/
|
|
|
|
static inline void hfsplus_mark_inode_dirty(struct inode *inode,
|
|
|
|
unsigned int flag)
|
|
|
|
{
|
|
|
|
set_bit(flag, &HFSPLUS_I(inode)->flags);
|
|
|
|
mark_inode_dirty(inode);
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
struct hfs_find_data {
|
|
|
|
/* filled by caller */
|
|
|
|
hfsplus_btree_key *search_key;
|
|
|
|
hfsplus_btree_key *key;
|
|
|
|
/* filled by find */
|
|
|
|
struct hfs_btree *tree;
|
|
|
|
struct hfs_bnode *bnode;
|
|
|
|
/* filled by findrec */
|
|
|
|
int record;
|
|
|
|
int keyoffset, keylength;
|
|
|
|
int entryoffset, entrylength;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hfsplus_readdir_data {
|
|
|
|
struct list_head list;
|
|
|
|
struct file *file;
|
|
|
|
struct hfsplus_cat_key key;
|
|
|
|
};
|
|
|
|
|
2011-07-18 15:06:23 +00:00
|
|
|
/*
|
|
|
|
* Find minimum acceptible I/O size for an hfsplus sb.
|
|
|
|
*/
|
|
|
|
static inline unsigned short hfsplus_min_io_size(struct super_block *sb)
|
|
|
|
{
|
|
|
|
return max_t(unsigned short, bdev_logical_block_size(sb->s_bdev),
|
|
|
|
HFSPLUS_SECTOR_SIZE);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#define hfs_btree_open hfsplus_btree_open
|
|
|
|
#define hfs_btree_close hfsplus_btree_close
|
|
|
|
#define hfs_btree_write hfsplus_btree_write
|
|
|
|
#define hfs_bmap_alloc hfsplus_bmap_alloc
|
|
|
|
#define hfs_bmap_free hfsplus_bmap_free
|
|
|
|
#define hfs_bnode_read hfsplus_bnode_read
|
|
|
|
#define hfs_bnode_read_u16 hfsplus_bnode_read_u16
|
|
|
|
#define hfs_bnode_read_u8 hfsplus_bnode_read_u8
|
|
|
|
#define hfs_bnode_read_key hfsplus_bnode_read_key
|
|
|
|
#define hfs_bnode_write hfsplus_bnode_write
|
|
|
|
#define hfs_bnode_write_u16 hfsplus_bnode_write_u16
|
|
|
|
#define hfs_bnode_clear hfsplus_bnode_clear
|
|
|
|
#define hfs_bnode_copy hfsplus_bnode_copy
|
|
|
|
#define hfs_bnode_move hfsplus_bnode_move
|
|
|
|
#define hfs_bnode_dump hfsplus_bnode_dump
|
|
|
|
#define hfs_bnode_unlink hfsplus_bnode_unlink
|
|
|
|
#define hfs_bnode_findhash hfsplus_bnode_findhash
|
|
|
|
#define hfs_bnode_find hfsplus_bnode_find
|
|
|
|
#define hfs_bnode_unhash hfsplus_bnode_unhash
|
|
|
|
#define hfs_bnode_free hfsplus_bnode_free
|
|
|
|
#define hfs_bnode_create hfsplus_bnode_create
|
|
|
|
#define hfs_bnode_get hfsplus_bnode_get
|
|
|
|
#define hfs_bnode_put hfsplus_bnode_put
|
|
|
|
#define hfs_brec_lenoff hfsplus_brec_lenoff
|
|
|
|
#define hfs_brec_keylen hfsplus_brec_keylen
|
|
|
|
#define hfs_brec_insert hfsplus_brec_insert
|
|
|
|
#define hfs_brec_remove hfsplus_brec_remove
|
|
|
|
#define hfs_find_init hfsplus_find_init
|
|
|
|
#define hfs_find_exit hfsplus_find_exit
|
2013-02-28 01:03:04 +00:00
|
|
|
#define __hfs_brec_find __hfsplus_brec_find
|
2005-04-16 22:20:36 +00:00
|
|
|
#define hfs_brec_find hfsplus_brec_find
|
|
|
|
#define hfs_brec_read hfsplus_brec_read
|
|
|
|
#define hfs_brec_goto hfsplus_brec_goto
|
|
|
|
#define hfs_part_find hfsplus_part_find
|
|
|
|
|
|
|
|
/*
|
|
|
|
* definitions for ext2 flag ioctls (linux really needs a generic
|
|
|
|
* interface for this).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support
|
|
|
|
* chattr/lsattr */
|
2006-08-29 18:06:16 +00:00
|
|
|
#define HFSPLUS_IOC_EXT2_GETFLAGS FS_IOC_GETFLAGS
|
|
|
|
#define HFSPLUS_IOC_EXT2_SETFLAGS FS_IOC_SETFLAGS
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
|
2012-02-06 20:14:40 +00:00
|
|
|
/*
|
|
|
|
* hfs+-specific ioctl for making the filesystem bootable
|
|
|
|
*/
|
|
|
|
#define HFSPLUS_IOC_BLESS _IO('h', 0x80)
|
|
|
|
|
2013-02-28 01:03:04 +00:00
|
|
|
typedef int (*search_strategy_t)(struct hfs_bnode *,
|
|
|
|
struct hfs_find_data *,
|
|
|
|
int *, int *, int *);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Functions in any *.c used in other files
|
|
|
|
*/
|
|
|
|
|
2013-02-28 01:03:04 +00:00
|
|
|
/* attributes.c */
|
2014-04-03 21:50:35 +00:00
|
|
|
int __init hfsplus_create_attr_tree_cache(void);
|
2013-02-28 01:03:04 +00:00
|
|
|
void hfsplus_destroy_attr_tree_cache(void);
|
|
|
|
hfsplus_attr_entry *hfsplus_alloc_attr_entry(void);
|
|
|
|
void hfsplus_destroy_attr_entry(hfsplus_attr_entry *entry_p);
|
|
|
|
int hfsplus_attr_bin_cmp_key(const hfsplus_btree_key *,
|
|
|
|
const hfsplus_btree_key *);
|
|
|
|
int hfsplus_attr_build_key(struct super_block *, hfsplus_btree_key *,
|
|
|
|
u32, const char *);
|
|
|
|
int hfsplus_find_attr(struct super_block *, u32,
|
|
|
|
const char *, struct hfs_find_data *);
|
|
|
|
int hfsplus_attr_exists(struct inode *inode, const char *name);
|
|
|
|
int hfsplus_create_attr(struct inode *, const char *, const void *, size_t);
|
|
|
|
int hfsplus_delete_attr(struct inode *, const char *);
|
|
|
|
int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* bitmap.c */
|
|
|
|
int hfsplus_block_allocate(struct super_block *, u32, u32, u32 *);
|
|
|
|
int hfsplus_block_free(struct super_block *, u32, u32);
|
|
|
|
|
|
|
|
/* btree.c */
|
2013-11-12 23:11:07 +00:00
|
|
|
u32 hfsplus_calc_btree_clump_size(u32, u32, u64, int);
|
2005-04-16 22:20:36 +00:00
|
|
|
struct hfs_btree *hfs_btree_open(struct super_block *, u32);
|
|
|
|
void hfs_btree_close(struct hfs_btree *);
|
2012-12-20 23:05:28 +00:00
|
|
|
int hfs_btree_write(struct hfs_btree *);
|
2005-04-16 22:20:36 +00:00
|
|
|
struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *);
|
|
|
|
void hfs_bmap_free(struct hfs_bnode *);
|
|
|
|
|
|
|
|
/* bnode.c */
|
|
|
|
void hfs_bnode_read(struct hfs_bnode *, void *, int, int);
|
|
|
|
u16 hfs_bnode_read_u16(struct hfs_bnode *, int);
|
|
|
|
u8 hfs_bnode_read_u8(struct hfs_bnode *, int);
|
|
|
|
void hfs_bnode_read_key(struct hfs_bnode *, void *, int);
|
|
|
|
void hfs_bnode_write(struct hfs_bnode *, void *, int, int);
|
|
|
|
void hfs_bnode_write_u16(struct hfs_bnode *, int, u16);
|
|
|
|
void hfs_bnode_clear(struct hfs_bnode *, int, int);
|
|
|
|
void hfs_bnode_copy(struct hfs_bnode *, int,
|
|
|
|
struct hfs_bnode *, int, int);
|
|
|
|
void hfs_bnode_move(struct hfs_bnode *, int, int, int);
|
|
|
|
void hfs_bnode_dump(struct hfs_bnode *);
|
|
|
|
void hfs_bnode_unlink(struct hfs_bnode *);
|
|
|
|
struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *, u32);
|
|
|
|
struct hfs_bnode *hfs_bnode_find(struct hfs_btree *, u32);
|
|
|
|
void hfs_bnode_unhash(struct hfs_bnode *);
|
|
|
|
void hfs_bnode_free(struct hfs_bnode *);
|
|
|
|
struct hfs_bnode *hfs_bnode_create(struct hfs_btree *, u32);
|
|
|
|
void hfs_bnode_get(struct hfs_bnode *);
|
|
|
|
void hfs_bnode_put(struct hfs_bnode *);
|
2014-06-06 21:36:28 +00:00
|
|
|
bool hfs_bnode_need_zeroout(struct hfs_btree *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* brec.c */
|
|
|
|
u16 hfs_brec_lenoff(struct hfs_bnode *, u16, u16 *);
|
|
|
|
u16 hfs_brec_keylen(struct hfs_bnode *, u16);
|
|
|
|
int hfs_brec_insert(struct hfs_find_data *, void *, int);
|
|
|
|
int hfs_brec_remove(struct hfs_find_data *);
|
|
|
|
|
|
|
|
/* bfind.c */
|
|
|
|
int hfs_find_init(struct hfs_btree *, struct hfs_find_data *);
|
|
|
|
void hfs_find_exit(struct hfs_find_data *);
|
2013-02-28 01:03:04 +00:00
|
|
|
int hfs_find_1st_rec_by_cnid(struct hfs_bnode *,
|
|
|
|
struct hfs_find_data *,
|
|
|
|
int *, int *, int *);
|
|
|
|
int hfs_find_rec_by_key(struct hfs_bnode *,
|
|
|
|
struct hfs_find_data *,
|
|
|
|
int *, int *, int *);
|
|
|
|
int __hfs_brec_find(struct hfs_bnode *, struct hfs_find_data *,
|
|
|
|
search_strategy_t);
|
|
|
|
int hfs_brec_find(struct hfs_find_data *, search_strategy_t);
|
2005-04-16 22:20:36 +00:00
|
|
|
int hfs_brec_read(struct hfs_find_data *, void *, int);
|
|
|
|
int hfs_brec_goto(struct hfs_find_data *, int);
|
|
|
|
|
|
|
|
/* catalog.c */
|
2010-12-16 16:08:38 +00:00
|
|
|
int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *,
|
|
|
|
const hfsplus_btree_key *);
|
|
|
|
int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *,
|
|
|
|
const hfsplus_btree_key *);
|
|
|
|
void hfsplus_cat_build_key(struct super_block *sb,
|
|
|
|
hfsplus_btree_key *, u32, struct qstr *);
|
2005-04-16 22:20:36 +00:00
|
|
|
int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *);
|
|
|
|
int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *);
|
|
|
|
int hfsplus_delete_cat(u32, struct inode *, struct qstr *);
|
|
|
|
int hfsplus_rename_cat(u32, struct inode *, struct qstr *,
|
|
|
|
struct inode *, struct qstr *);
|
2010-10-14 13:54:39 +00:00
|
|
|
void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-04-29 07:58:52 +00:00
|
|
|
/* dir.c */
|
|
|
|
extern const struct inode_operations hfsplus_dir_inode_operations;
|
|
|
|
extern const struct file_operations hfsplus_dir_operations;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* extents.c */
|
2006-01-19 01:43:08 +00:00
|
|
|
int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *);
|
2011-07-05 22:30:00 +00:00
|
|
|
int hfsplus_ext_write_extent(struct inode *);
|
2005-04-16 22:20:36 +00:00
|
|
|
int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int);
|
2010-12-16 16:08:38 +00:00
|
|
|
int hfsplus_free_fork(struct super_block *, u32,
|
|
|
|
struct hfsplus_fork_raw *, int);
|
2014-06-06 21:36:28 +00:00
|
|
|
int hfsplus_file_extend(struct inode *, bool zeroout);
|
2005-04-16 22:20:36 +00:00
|
|
|
void hfsplus_file_truncate(struct inode *);
|
|
|
|
|
|
|
|
/* inode.c */
|
2006-06-28 11:26:44 +00:00
|
|
|
extern const struct address_space_operations hfsplus_aops;
|
|
|
|
extern const struct address_space_operations hfsplus_btree_aops;
|
2009-02-20 05:55:13 +00:00
|
|
|
extern const struct dentry_operations hfsplus_dentry_operations;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
|
|
|
|
void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
|
|
|
|
int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *);
|
|
|
|
int hfsplus_cat_write_inode(struct inode *);
|
2011-07-26 07:26:51 +00:00
|
|
|
struct inode *hfsplus_new_inode(struct super_block *, umode_t);
|
2005-04-16 22:20:36 +00:00
|
|
|
void hfsplus_delete_inode(struct inode *);
|
2011-07-17 00:44:56 +00:00
|
|
|
int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
|
|
|
|
int datasync);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* ioctl.c */
|
2010-04-27 14:24:20 +00:00
|
|
|
long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* options.c */
|
2005-09-06 22:18:48 +00:00
|
|
|
int hfsplus_parse_options(char *, struct hfsplus_sb_info *);
|
2010-11-07 22:01:17 +00:00
|
|
|
int hfsplus_parse_options_remount(char *input, int *force);
|
2005-09-06 22:18:48 +00:00
|
|
|
void hfsplus_fill_defaults(struct hfsplus_sb_info *);
|
2011-12-09 02:32:45 +00:00
|
|
|
int hfsplus_show_options(struct seq_file *, struct dentry *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-02-07 08:15:40 +00:00
|
|
|
/* super.c */
|
|
|
|
struct inode *hfsplus_iget(struct super_block *, unsigned long);
|
2012-07-12 14:26:31 +00:00
|
|
|
void hfsplus_mark_mdb_dirty(struct super_block *sb);
|
2008-02-07 08:15:40 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* tables.c */
|
|
|
|
extern u16 hfsplus_case_fold_table[];
|
|
|
|
extern u16 hfsplus_decompose_table[];
|
|
|
|
extern u16 hfsplus_compose_table[];
|
|
|
|
|
|
|
|
/* unicode.c */
|
2010-12-16 16:08:38 +00:00
|
|
|
int hfsplus_strcasecmp(const struct hfsplus_unistr *,
|
|
|
|
const struct hfsplus_unistr *);
|
|
|
|
int hfsplus_strcmp(const struct hfsplus_unistr *,
|
|
|
|
const struct hfsplus_unistr *);
|
|
|
|
int hfsplus_uni2asc(struct super_block *,
|
|
|
|
const struct hfsplus_unistr *, char *, int *);
|
|
|
|
int hfsplus_asc2uni(struct super_block *,
|
2013-02-28 01:03:04 +00:00
|
|
|
struct hfsplus_unistr *, int, const char *, int);
|
2013-05-21 22:22:44 +00:00
|
|
|
int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str);
|
|
|
|
int hfsplus_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
|
2011-01-07 06:49:27 +00:00
|
|
|
unsigned int len, const char *str, const struct qstr *name);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* wrapper.c */
|
|
|
|
int hfsplus_read_wrapper(struct super_block *);
|
|
|
|
int hfs_part_find(struct super_block *, sector_t *, sector_t *);
|
2011-07-18 15:06:23 +00:00
|
|
|
int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
|
|
|
|
void *buf, void **data, int rw);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* time macros */
|
|
|
|
#define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U)
|
|
|
|
#define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U))
|
|
|
|
|
|
|
|
/* compatibility */
|
|
|
|
#define hfsp_mt2ut(t) (struct timespec){ .tv_sec = __hfsp_mt2ut(t) }
|
|
|
|
#define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec)
|
|
|
|
#define hfsp_now2mt() __hfsp_ut2mt(get_seconds())
|
|
|
|
|
|
|
|
#endif
|