[PATCH 9/10] squashfs: first use of swabbing

From: Jörn Engel
Date: Fri Apr 22 2005 - 02:32:45 EST


Jörn

--
To recognize individual spam features you have to try to get into the
mind of the spammer, and frankly I want to spend as little time inside
the minds of spammers as possible.
-- Paul Graham


Signed-off-by: Jörn Engel <joern@xxxxxxxxxxxxxxxxxxxx>
---

fs/squashfs/inode.c | 25 +++++++------------------
1 files changed, 7 insertions(+), 18 deletions(-)

--- linux-2.6.12-rc3cow/fs/squashfs/inode.c~squashfs_cu10 2005-04-22 09:06:09.550109088 +0200
+++ linux-2.6.12-rc3cow/fs/squashfs/inode.c 2005-04-22 09:15:50.279824752 +0200
@@ -122,7 +122,7 @@ static struct buffer_head *get_block_len
int *cur_index, int *offset, int *c_byte)
{
squashfs_sb_info *msBlk = s->s_fs_info;
- unsigned short temp;
+ u16 temp;
struct buffer_head *bh;
unsigned char *data;

@@ -131,30 +131,19 @@ static struct buffer_head *get_block_len

if (msBlk->devblksize - *offset == 1) {
data = bh->b_data;
- if (msBlk->swap)
- ((unsigned char *) &temp)[1] = data[*offset];
- else
- ((unsigned char *) &temp)[0] = data[*offset];
+ ((unsigned char *) &temp)[0] = data[*offset];
brelse(bh);
if (!(bh = sb_bread(s, ++(*cur_index))))
return NULL;
data = bh->b_data;
- if (msBlk->swap)
- ((unsigned char *) &temp)[0] = data[0];
- else
- ((unsigned char *) &temp)[1] = data[0];
- *c_byte = temp;
+ ((unsigned char *) &temp)[1] = data[0];
+ *c_byte = (msBlk->swab16)(temp);
*offset = 1;
} else {
data = bh->b_data;
- if (msBlk->swap) {
- ((unsigned char *) &temp)[1] = data[*offset];
- ((unsigned char *) &temp)[0] = data[*offset + 1];
- } else {
- ((unsigned char *) &temp)[0] = data[*offset];
- ((unsigned char *) &temp)[1] = data[*offset + 1];
- }
- *c_byte = temp;
+ ((unsigned char *) &temp)[0] = data[*offset];
+ ((unsigned char *) &temp)[1] = data[*offset + 1];
+ *c_byte = (msBlk->swab16)(temp);
*offset += 2;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/