This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
redboot/fs endianess patch
- From: Mark Salter <msalter at redhat dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Tue, 3 Sep 2002 08:49:22 -0400
- Subject: redboot/fs endianess patch
Index: redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.76
diff -u -p -5 -r1.76 ChangeLog
--- redboot/current/ChangeLog 29 Aug 2002 19:30:27 -0000 1.76
+++ redboot/current/ChangeLog 3 Sep 2002 12:46:49 -0000
@@ -1,5 +1,11 @@
+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.
2002-08-26 Thomas Koeller <thomas@koeller.dyndns.org>
Index: redboot/current/include/fs/disk.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/include/fs/disk.h,v
retrieving revision 1.4
diff -u -p -5 -r1.4 disk.h
--- redboot/current/include/fs/disk.h 9 Jul 2002 20:40:55 -0000 1.4
+++ redboot/current/include/fs/disk.h 3 Sep 2002 12:46:49 -0000
@@ -64,11 +64,11 @@
((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
#define __SWAB32(x) \
((((x) & 0xff) << 24) | \
(((x) & 0xff00) << 8) | \
- (((x) >> 8) & 0xff) | \
+ (((x) >> 8) & 0xff00) | \
(((x) >> 24) & 0xff))
#if (CYG_BYTEORDER == CYG_MSBFIRST)
#define SWAB_LE16(x) __SWAB16(x)
#define SWAB_LE32(x) __SWAB32(x)
Index: redboot/current/src/fs/e2fs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fs/e2fs.c,v
retrieving revision 1.4
diff -u -p -5 -r1.4 e2fs.c
--- redboot/current/src/fs/e2fs.c 23 May 2002 23:08:33 -0000 1.4
+++ redboot/current/src/fs/e2fs.c 3 Sep 2002 12:46:49 -0000
@@ -224,22 +224,22 @@ e2fs_inode_block(e2fs_desc_t *e2fs, e2fs
if (bindex < e2fs->nr_ind_blocks) {
// 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;
if (bindex < e2fs->nr_dind_blocks) {
// Double indirect block
if (!__READ_BLOCK(SWAB_LE32(inode->block[E2FS_DIND_BLOCK])))
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;
// Triple indirect block
@@ -248,11 +248,11 @@ e2fs_inode_block(e2fs_desc_t *e2fs, e2fs
if (!__READ_BLOCK(SWAB_LE32(blockbuf[bindex / e2fs->nr_dind_blocks])))
return 0;
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;
}
// search a single directory block in memory looking for an