aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/btree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs/btree.c')
-rw-r--r--fs/befs/btree.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 76e219799409..81b042ee24e6 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -30,7 +30,6 @@
30#include "befs.h" 30#include "befs.h"
31#include "btree.h" 31#include "btree.h"
32#include "datastream.h" 32#include "datastream.h"
33#include "endian.h"
34 33
35/* 34/*
36 * The btree functions in this file are built on top of the 35 * The btree functions in this file are built on top of the
@@ -80,7 +79,7 @@
80 * In memory structure of each btree node 79 * In memory structure of each btree node
81 */ 80 */
82typedef struct { 81typedef struct {
83 befs_btree_nodehead head; /* head of node converted to cpu byteorder */ 82 befs_host_btree_nodehead head; /* head of node converted to cpu byteorder */
84 struct buffer_head *bh; 83 struct buffer_head *bh;
85 befs_btree_nodehead *od_node; /* on disk node */ 84 befs_btree_nodehead *od_node; /* on disk node */
86} befs_btree_node; 85} befs_btree_node;
@@ -102,9 +101,9 @@ static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
102 101
103static int befs_leafnode(befs_btree_node * node); 102static int befs_leafnode(befs_btree_node * node);
104 103
105static u16 *befs_bt_keylen_index(befs_btree_node * node); 104static fs16 *befs_bt_keylen_index(befs_btree_node * node);
106 105
107static befs_off_t *befs_bt_valarray(befs_btree_node * node); 106static fs64 *befs_bt_valarray(befs_btree_node * node);
108 107
109static char *befs_bt_keydata(befs_btree_node * node); 108static char *befs_bt_keydata(befs_btree_node * node);
110 109
@@ -136,7 +135,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
136 befs_btree_super * sup) 135 befs_btree_super * sup)
137{ 136{
138 struct buffer_head *bh = NULL; 137 struct buffer_head *bh = NULL;
139 befs_btree_super *od_sup = NULL; 138 befs_disk_btree_super *od_sup = NULL;
140 139
141 befs_debug(sb, "---> befs_btree_read_super()"); 140 befs_debug(sb, "---> befs_btree_read_super()");
142 141
@@ -146,7 +145,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
146 befs_error(sb, "Couldn't read index header."); 145 befs_error(sb, "Couldn't read index header.");
147 goto error; 146 goto error;
148 } 147 }
149 od_sup = (befs_btree_super *) bh->b_data; 148 od_sup = (befs_disk_btree_super *) bh->b_data;
150 befs_dump_index_entry(sb, od_sup); 149 befs_dump_index_entry(sb, od_sup);
151 150
152 sup->magic = fs32_to_cpu(sb, od_sup->magic); 151 sup->magic = fs32_to_cpu(sb, od_sup->magic);
@@ -342,7 +341,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node,
342 u16 keylen; 341 u16 keylen;
343 int findkey_len; 342 int findkey_len;
344 char *thiskey; 343 char *thiskey;
345 befs_off_t *valarray; 344 fs64 *valarray;
346 345
347 befs_debug(sb, "---> befs_find_key() %s", findkey); 346 befs_debug(sb, "---> befs_find_key() %s", findkey);
348 347
@@ -422,7 +421,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
422 befs_btree_super bt_super; 421 befs_btree_super bt_super;
423 befs_off_t node_off = 0; 422 befs_off_t node_off = 0;
424 int cur_key; 423 int cur_key;
425 befs_off_t *valarray; 424 fs64 *valarray;
426 char *keystart; 425 char *keystart;
427 u16 keylen; 426 u16 keylen;
428 int res; 427 int res;
@@ -572,7 +571,7 @@ befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
572 this_node->head.overflow); 571 this_node->head.overflow);
573 *node_off = this_node->head.overflow; 572 *node_off = this_node->head.overflow;
574 } else { 573 } else {
575 befs_off_t *valarray = befs_bt_valarray(this_node); 574 fs64 *valarray = befs_bt_valarray(this_node);
576 *node_off = fs64_to_cpu(sb, valarray[0]); 575 *node_off = fs64_to_cpu(sb, valarray[0]);
577 } 576 }
578 if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { 577 if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) {
@@ -622,7 +621,7 @@ befs_leafnode(befs_btree_node * node)
622 * 621 *
623 * Except that rounding up to 8 works, and rounding up to 4 doesn't. 622 * Except that rounding up to 8 works, and rounding up to 4 doesn't.
624 */ 623 */
625static u16 * 624static fs16 *
626befs_bt_keylen_index(befs_btree_node * node) 625befs_bt_keylen_index(befs_btree_node * node)
627{ 626{
628 const int keylen_align = 8; 627 const int keylen_align = 8;
@@ -633,7 +632,7 @@ befs_bt_keylen_index(befs_btree_node * node)
633 if (tmp) 632 if (tmp)
634 off += keylen_align - tmp; 633 off += keylen_align - tmp;
635 634
636 return (u16 *) ((void *) node->od_node + off); 635 return (fs16 *) ((void *) node->od_node + off);
637} 636}
638 637
639/** 638/**
@@ -643,13 +642,13 @@ befs_bt_keylen_index(befs_btree_node * node)
643 * Returns a pointer to the start of the value array 642 * Returns a pointer to the start of the value array
644 * of the node pointed to by the node header 643 * of the node pointed to by the node header
645 */ 644 */
646static befs_off_t * 645static fs64 *
647befs_bt_valarray(befs_btree_node * node) 646befs_bt_valarray(befs_btree_node * node)
648{ 647{
649 void *keylen_index_start = (void *) befs_bt_keylen_index(node); 648 void *keylen_index_start = (void *) befs_bt_keylen_index(node);
650 size_t keylen_index_size = node->head.all_key_count * sizeof (u16); 649 size_t keylen_index_size = node->head.all_key_count * sizeof (fs16);
651 650
652 return (befs_off_t *) (keylen_index_start + keylen_index_size); 651 return (fs64 *) (keylen_index_start + keylen_index_size);
653} 652}
654 653
655/** 654/**
@@ -681,7 +680,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
681{ 680{
682 int prev_key_end; 681 int prev_key_end;
683 char *keystart; 682 char *keystart;
684 u16 *keylen_index; 683 fs16 *keylen_index;
685 684
686 if (index < 0 || index > node->head.all_key_count) { 685 if (index < 0 || index > node->head.all_key_count) {
687 *keylen = 0; 686 *keylen = 0;