From 2179d372d9f8b5fc5c189c89bc6a565a42151b23 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Wed, 18 Jan 2006 17:43:08 -0800 Subject: [PATCH] hfs: add HFSX support Add support for HFSX, which allows for case-sensitive filenames. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/hfsplus/btree.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'fs/hfsplus/btree.c') diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index 671290663838..a67edfa34e9e 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c @@ -31,17 +31,8 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) init_MUTEX(&tree->tree_lock); spin_lock_init(&tree->hash_lock); - /* Set the correct compare function */ tree->sb = sb; tree->cnid = id; - if (id == HFSPLUS_EXT_CNID) { - tree->keycmp = hfsplus_ext_cmp_key; - } else if (id == HFSPLUS_CAT_CNID) { - tree->keycmp = hfsplus_cat_cmp_key; - } else { - printk(KERN_ERR "hfs: unknown B*Tree requested\n"); - goto free_tree; - } tree->inode = iget(sb, id); if (!tree->inode) goto free_tree; @@ -64,6 +55,20 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) tree->max_key_len = be16_to_cpu(head->max_key_len); tree->depth = be16_to_cpu(head->depth); + /* Set the correct compare function */ + if (id == HFSPLUS_EXT_CNID) { + tree->keycmp = hfsplus_ext_cmp_key; + } else if (id == HFSPLUS_CAT_CNID) { + if ((HFSPLUS_SB(sb).flags & HFSPLUS_SB_HFSX) && + (head->key_type == HFSPLUS_KEY_BINARY)) + tree->keycmp = hfsplus_cat_bin_cmp_key; + else + tree->keycmp = hfsplus_cat_case_cmp_key; + } else { + printk(KERN_ERR "hfs: unknown B*Tree requested\n"); + goto fail_page; + } + size = tree->node_size; if (!size || size & (size - 1)) goto fail_page; -- cgit v1.2.3