Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d45bce8f authored by Duane Griffin's avatar Duane Griffin Committed by Linus Torvalds
Browse files

HFS+: add custom dentry hash and comparison operations



Add custom dentry hash and comparison operations for HFS+ filesystems that are
case-insensitive and/or do automatic unicode decomposition.  The new
operations reuse the existing HFS+ ASCII to unicode conversion, unicode
decomposition and case folding functionality.

Signed-off-by: default avatarDuane Griffin <duaneg@dghda.com>
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>

Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1e96b7ca
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -62,8 +62,10 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
		if ((HFSPLUS_SB(sb).flags & HFSPLUS_SB_HFSX) &&
		    (head->key_type == HFSPLUS_KEY_BINARY))
			tree->keycmp = hfsplus_cat_bin_cmp_key;
		else
		else {
			tree->keycmp = hfsplus_cat_case_cmp_key;
			HFSPLUS_SB(sb).flags |= HFSPLUS_SB_CASEFOLD;
		}
	} else {
		printk(KERN_ERR "hfs: unknown B*Tree requested\n");
		goto fail_page;
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
	u16 type;

	sb = dir->i_sb;

	dentry->d_op = &hfsplus_dentry_operations;
	dentry->d_fsdata = NULL;
	hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd);
	hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name);
+4 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ struct hfsplus_sb_info {
#define HFSPLUS_SB_NODECOMPOSE	0x0002
#define HFSPLUS_SB_FORCE	0x0004
#define HFSPLUS_SB_HFSX		0x0008
#define HFSPLUS_SB_CASEFOLD	0x0010


struct hfsplus_inode_info {
@@ -321,6 +322,7 @@ void hfsplus_file_truncate(struct inode *);
/* inode.c */
extern const struct address_space_operations hfsplus_aops;
extern const struct address_space_operations hfsplus_btree_aops;
extern struct dentry_operations hfsplus_dentry_operations;

void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
@@ -353,6 +355,8 @@ int hfsplus_strcasecmp(const struct hfsplus_unistr *, const struct hfsplus_unist
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 *, struct hfsplus_unistr *, const char *, int);
int hfsplus_hash_dentry(struct dentry *dentry, struct qstr *str);
int hfsplus_compare_dentry(struct dentry *dentry, struct qstr *s1, struct qstr *s2);

/* wrapper.c */
int hfsplus_read_wrapper(struct super_block *);
+5 −0
Original line number Diff line number Diff line
@@ -131,6 +131,11 @@ const struct address_space_operations hfsplus_aops = {
	.writepages	= hfsplus_writepages,
};

struct dentry_operations hfsplus_dentry_operations = {
	.d_hash       = hfsplus_hash_dentry,
	.d_compare    = hfsplus_compare_dentry,
};

static struct dentry *hfsplus_file_lookup(struct inode *dir, struct dentry *dentry,
					  struct nameidata *nd)
{
+1 −0
Original line number Diff line number Diff line
@@ -380,6 +380,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
		iput(root);
		goto cleanup;
	}
	sb->s_root->d_op = &hfsplus_dentry_operations;

	str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1;
	str.name = HFSP_HIDDENDIR_NAME;
Loading