brec.c (c2b3e1f76e5c90215bc7f740b376c0220eb8a8e3) brec.c (d614267329f2bee7a082ed8781c581c0f3aaa808)
1/*
2 * linux/fs/hfs/brec.c
3 *
4 * Copyright (C) 2001
5 * Brad Boyer (flar@allandria.com)
6 * (C) 2003 Ardis Technologies <roman@ardistech.com>
7 *
8 * Handle individual btree records

--- 33 unchanged lines hidden (view full) ---

42 retval = node->tree->max_key_len + 1;
43 } else {
44 recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2);
45 if (!recoff)
46 return 0;
47 if (node->tree->attributes & HFS_TREE_BIGKEYS) {
48 retval = hfs_bnode_read_u16(node, recoff) + 2;
49 if (retval > node->tree->max_key_len + 2) {
1/*
2 * linux/fs/hfs/brec.c
3 *
4 * Copyright (C) 2001
5 * Brad Boyer (flar@allandria.com)
6 * (C) 2003 Ardis Technologies <roman@ardistech.com>
7 *
8 * Handle individual btree records

--- 33 unchanged lines hidden (view full) ---

42 retval = node->tree->max_key_len + 1;
43 } else {
44 recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2);
45 if (!recoff)
46 return 0;
47 if (node->tree->attributes & HFS_TREE_BIGKEYS) {
48 retval = hfs_bnode_read_u16(node, recoff) + 2;
49 if (retval > node->tree->max_key_len + 2) {
50 printk(KERN_ERR "hfs: keylen %d too large\n",
51 retval);
50 pr_err("keylen %d too large\n", retval);
52 retval = 0;
53 }
54 } else {
55 retval = (hfs_bnode_read_u8(node, recoff) | 1) + 1;
56 if (retval > node->tree->max_key_len + 1) {
51 retval = 0;
52 }
53 } else {
54 retval = (hfs_bnode_read_u8(node, recoff) | 1) + 1;
55 if (retval > node->tree->max_key_len + 1) {
57 printk(KERN_ERR "hfs: keylen %d too large\n",
58 retval);
56 pr_err("keylen %d too large\n", retval);
59 retval = 0;
60 }
61 }
62 }
63 return retval;
64}
65
66int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len)

--- 316 unchanged lines hidden (view full) ---

383 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2;
384 diff = newkeylen - fd->keylength;
385 if (!diff)
386 goto skip;
387 if (diff > 0) {
388 end_off = hfs_bnode_read_u16(parent, end_rec_off);
389 if (end_rec_off - end_off < diff) {
390
57 retval = 0;
58 }
59 }
60 }
61 return retval;
62}
63
64int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len)

--- 316 unchanged lines hidden (view full) ---

381 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2;
382 diff = newkeylen - fd->keylength;
383 if (!diff)
384 goto skip;
385 if (diff > 0) {
386 end_off = hfs_bnode_read_u16(parent, end_rec_off);
387 if (end_rec_off - end_off < diff) {
388
391 printk(KERN_DEBUG "hfs: splitting index node...\n");
389 printk(KERN_DEBUG "splitting index node...\n");
392 fd->bnode = parent;
393 new_node = hfs_bnode_split(fd);
394 if (IS_ERR(new_node))
395 return PTR_ERR(new_node);
396 parent = fd->bnode;
397 rec = fd->record;
398 rec_off = tree->node_size - (rec + 2) * 2;
399 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2;

--- 123 unchanged lines hidden ---
390 fd->bnode = parent;
391 new_node = hfs_bnode_split(fd);
392 if (IS_ERR(new_node))
393 return PTR_ERR(new_node);
394 parent = fd->bnode;
395 rec = fd->record;
396 rec_off = tree->node_size - (rec + 2) * 2;
397 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2;

--- 123 unchanged lines hidden ---