aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/btree.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2005-12-24 14:28:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-10 19:15:33 -0400
commita9721f3152bc2be6702807705902e06abdd6e3bb (patch)
tree4f01e2f3426697787330371ab822e7e60bc2238e /fs/befs/btree.c
parente5201c58cd81066ecd0210bcc6c02e71200040a3 (diff)
[PATCH] befs: endianness annotations
split the data structures that exist in host- and disk-endian variants, annotate the fields of disk-endian ones, propagate changes. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/befs/btree.c')
-rw-r--r--fs/befs/btree.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 12e0fd60033e..81b042ee24e6 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -79,7 +79,7 @@
79 * In memory structure of each btree node 79 * In memory structure of each btree node
80 */ 80 */
81typedef struct { 81typedef struct {
82 befs_btree_nodehead head; /* head of node converted to cpu byteorder */ 82 befs_host_btree_nodehead head; /* head of node converted to cpu byteorder */
83 struct buffer_head *bh; 83 struct buffer_head *bh;
84 befs_btree_nodehead *od_node; /* on disk node */ 84 befs_btree_nodehead *od_node; /* on disk node */
85} befs_btree_node; 85} befs_btree_node;
@@ -101,9 +101,9 @@ static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
101 101
102static int befs_leafnode(befs_btree_node * node); 102static int befs_leafnode(befs_btree_node * node);
103 103
104static u16 *befs_bt_keylen_index(befs_btree_node * node); 104static fs16 *befs_bt_keylen_index(befs_btree_node * node);
105 105
106static befs_off_t *befs_bt_valarray(befs_btree_node * node); 106static fs64 *befs_bt_valarray(befs_btree_node * node);
107 107
108static char *befs_bt_keydata(befs_btree_node * node); 108static char *befs_bt_keydata(befs_btree_node * node);
109 109
@@ -135,7 +135,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
135 befs_btree_super * sup) 135 befs_btree_super * sup)
136{ 136{
137 struct buffer_head *bh = NULL; 137 struct buffer_head *bh = NULL;
138 befs_btree_super *od_sup = NULL; 138 befs_disk_btree_super *od_sup = NULL;
139 139
140 befs_debug(sb, "---> befs_btree_read_super()"); 140 befs_debug(sb, "---> befs_btree_read_super()");
141 141
@@ -145,7 +145,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
145 befs_error(sb, "Couldn't read index header."); 145 befs_error(sb, "Couldn't read index header.");
146 goto error; 146 goto error;
147 } 147 }
148 od_sup = (befs_btree_super *) bh->b_data; 148 od_sup = (befs_disk_btree_super *) bh->b_data;
149 befs_dump_index_entry(sb, od_sup); 149 befs_dump_index_entry(sb, od_sup);
150 150
151 sup->magic = fs32_to_cpu(sb, od_sup->magic); 151 sup->magic = fs32_to_cpu(sb, od_sup->magic);
@@ -341,7 +341,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node,
341 u16 keylen; 341 u16 keylen;
342 int findkey_len; 342 int findkey_len;
343 char *thiskey; 343 char *thiskey;
344 befs_off_t *valarray; 344 fs64 *valarray;
345 345
346 befs_debug(sb, "---> befs_find_key() %s", findkey); 346 befs_debug(sb, "---> befs_find_key() %s", findkey);
347 347
@@ -421,7 +421,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
421 befs_btree_super bt_super; 421 befs_btree_super bt_super;
422 befs_off_t node_off = 0; 422 befs_off_t node_off = 0;
423 int cur_key; 423 int cur_key;
424 befs_off_t *valarray; 424 fs64 *valarray;
425 char *keystart; 425 char *keystart;
426 u16 keylen; 426 u16 keylen;
427 int res; 427 int res;
@@ -571,7 +571,7 @@ befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
571 this_node->head.overflow); 571 this_node->head.overflow);
572 *node_off = this_node->head.overflow; 572 *node_off = this_node->head.overflow;
573 } else { 573 } else {
574 befs_off_t *valarray = befs_bt_valarray(this_node); 574 fs64 *valarray = befs_bt_valarray(this_node);
575 *node_off = fs64_to_cpu(sb, valarray[0]); 575 *node_off = fs64_to_cpu(sb, valarray[0]);
576 } 576 }
577 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) {
@@ -621,7 +621,7 @@ befs_leafnode(befs_btree_node * node)
621 * 621 *
622 * 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.
623 */ 623 */
624static u16 * 624static fs16 *
625befs_bt_keylen_index(befs_btree_node * node) 625befs_bt_keylen_index(befs_btree_node * node)
626{ 626{
627 const int keylen_align = 8; 627 const int keylen_align = 8;
@@ -632,7 +632,7 @@ befs_bt_keylen_index(befs_btree_node * node)
632 if (tmp) 632 if (tmp)
633 off += keylen_align - tmp; 633 off += keylen_align - tmp;
634 634
635 return (u16 *) ((void *) node->od_node + off); 635 return (fs16 *) ((void *) node->od_node + off);
636} 636}
637 637
638/** 638/**
@@ -642,13 +642,13 @@ befs_bt_keylen_index(befs_btree_node * node)
642 * Returns a pointer to the start of the value array 642 * Returns a pointer to the start of the value array
643 * of the node pointed to by the node header 643 * of the node pointed to by the node header
644 */ 644 */
645static befs_off_t * 645static fs64 *
646befs_bt_valarray(befs_btree_node * node) 646befs_bt_valarray(befs_btree_node * node)
647{ 647{
648 void *keylen_index_start = (void *) befs_bt_keylen_index(node); 648 void *keylen_index_start = (void *) befs_bt_keylen_index(node);
649 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);
650 650
651 return (befs_off_t *) (keylen_index_start + keylen_index_size); 651 return (fs64 *) (keylen_index_start + keylen_index_size);
652} 652}
653 653
654/** 654/**
@@ -680,7 +680,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
680{ 680{
681 int prev_key_end; 681 int prev_key_end;
682 char *keystart; 682 char *keystart;
683 u16 *keylen_index; 683 fs16 *keylen_index;
684 684
685 if (index < 0 || index > node->head.all_key_count) { 685 if (index < 0 || index > node->head.all_key_count) {
686 *keylen = 0; 686 *keylen = 0;