changeset 325:e46ccba0c5f1

redboot/fs endianess tweak
author msalter
date Tue, 03 Sep 2002 12:48:51 +0000
parents 28d0fbc11048
children afd0ab675643
files packages/redboot/current/ChangeLog packages/redboot/current/include/fs/disk.h packages/redboot/current/src/fs/e2fs.c
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,9 @@
+2002-09-03  Yoshinori Sato <qzb04471@nifty.ne.jp>
+2002-09-03  Mark Salter  <msalter@redhat.com>
+
+	* include/fs/disk.h (__SWAB32): Fix incorrect masking.
+	* src/fs/e2fs.c (e2fs_inode_block): Fix endianess of block numbers.
+
 2002-08-29  Mark Salter  <msalter@redhat.com>
 
 	* src/net/net_io.c (net_init): Initialize dns before showing addresses.
--- a/packages/redboot/current/include/fs/disk.h
+++ b/packages/redboot/current/include/fs/disk.h
@@ -66,7 +66,7 @@
 #define __SWAB32(x)         \
    ((((x) & 0xff) << 24)   |  \
     (((x) & 0xff00) <<  8) |  \
-    (((x) >> 8) & 0xff)    |  \
+    (((x) >> 8) & 0xff00)  |  \
     (((x) >> 24) & 0xff))
 
 #if (CYG_BYTEORDER == CYG_MSBFIRST)
--- a/packages/redboot/current/src/fs/e2fs.c
+++ b/packages/redboot/current/src/fs/e2fs.c
@@ -226,7 +226,7 @@ e2fs_inode_block(e2fs_desc_t *e2fs, e2fs
 	// Indirect block
 	if (!__READ_BLOCK(SWAB_LE32(inode->block[E2FS_IND_BLOCK])))
 	    return 0;
-	*pblknr = blockbuf[bindex];
+	*pblknr = SWAB_LE32(blockbuf[bindex]);
 	return 1;
     }
     bindex -= e2fs->nr_ind_blocks;
@@ -237,7 +237,7 @@ e2fs_inode_block(e2fs_desc_t *e2fs, e2fs
 	    return 0;
 	if (!__READ_BLOCK(SWAB_LE32(blockbuf[bindex / e2fs->nr_ind_blocks])))
 	    return 0;
-	*pblknr  = blockbuf[bindex % e2fs->nr_ind_blocks];
+	*pblknr  = SWAB_LE32(blockbuf[bindex % e2fs->nr_ind_blocks]);
 	return 1;
     }
     bindex -= e2fs->nr_dind_blocks;
@@ -250,7 +250,7 @@ e2fs_inode_block(e2fs_desc_t *e2fs, e2fs
     bindex %= e2fs->nr_dind_blocks;
     if (!__READ_BLOCK(SWAB_LE32(blockbuf[bindex / e2fs->nr_ind_blocks])))
 	return 0;
-    *pblknr = blockbuf[bindex % e2fs->nr_ind_blocks];
+    *pblknr = SWAB_LE32(blockbuf[bindex % e2fs->nr_ind_blocks]);
     return 1;
 }