summary refs log tree commit diff
path: root/fs/hfsplus/btree.c
diff options
context:
space:
mode:
authorDavid Elliott <elliott@stcnet.com>2006-01-18 17:43:08 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-18 19:20:23 -0800
commit2179d372d9f8b5fc5c189c89bc6a565a42151b23 (patch)
tree2b09f55702890e7edbae9b9e396bfe958f53608a /fs/hfsplus/btree.c
parent7cf3cc3036cb7b1147350bf7c3f1ab98c160eb7b (diff)
downloadlinux-2179d372d9f8b5fc5c189c89bc6a565a42151b23.tar.gz
[PATCH] hfs: add HFSX support
Add support for HFSX, which allows for case-sensitive filenames.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/hfsplus/btree.c')
-rw-r--r--fs/hfsplus/btree.c23
1 files changed, 14 insertions, 9 deletions
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;