linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libext2fs: Fix various errors result from crc32c/metadata checksum integration
@ 2011-09-30 19:38 Darrick J. Wong
  2011-09-30 21:08 ` Andreas Dilger
  2011-09-30 21:12 ` Ted Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2011-09-30 19:38 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

Fix several minor errors in structure definitions, the byteswap code, and
Makefiles that result from merging the crc32c and initial parts of the metadata
checksumming patchset.

(This fix is required by the metadata checksumming patchset)

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 lib/ext2fs/Makefile.in |    2 +-
 lib/ext2fs/ext2fs.h    |    4 ++--
 lib/ext2fs/swapfs.c    |   18 ++++++++----------
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index c2bfb70..3de9f87 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -398,7 +398,7 @@ clean::
 		tst_bitops tst_types tst_icount tst_super_size tst_csum \
 		ext2_tdbtool mkjournal debug_cmds.c \
 		../libext2fs.a ../libext2fs_p.a ../libext2fs_chk.a \
-		crc32c_table.h
+		crc32c_table.h gen_crc32ctable tst_crc32c
 
 mostlyclean:: clean
 distclean:: clean
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 203d222..357bf60 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -916,8 +916,8 @@ extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
 extern void ext2fs_update_dynamic_rev(ext2_filsys fs);
 
 /* crc32c.c */
-extern __u32 crc32c_be(__u32 crc, unsigned char const *p, size_t len);
-extern __u32 crc32c_le(__u32 crc, unsigned char const *p, size_t len);
+extern __u32 ext2fs_crc32c_be(__u32 crc, unsigned char const *p, size_t len);
+extern __u32 ext2fs_crc32c_le(__u32 crc, unsigned char const *p, size_t len);
 
 /* csum.c */
 extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group);
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 7962472..7c99373 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -260,7 +260,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
 		t->osd2.linux2.l_i_gid_high =
 		  ext2fs_swab16 (f->osd2.linux2.l_i_gid_high);
 		t->osd2.linux2.l_i_checksum_lo =
-			ext2fs_swab32(f->osd2.linux2.l_i_checksum_lo);
+			ext2fs_swab16(f->osd2.linux2.l_i_checksum_lo);
 		break;
 	case EXT2_OS_HURD:
 		t->osd1.hurd1.h_i_translator =
@@ -294,21 +294,19 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
 		return;
 	}
 
-	if (extra_isize >= 2)
+	if (extra_isize >= 4)
 		t->i_checksum_hi = ext2fs_swab16(f->i_checksum_hi);
-	if (extra_isize >= 6)
-		t->i_checksum_hi = ext2fs_swab32(f->i_checksum_hi);
-	if (extra_isize >= 10)
+	if (extra_isize >= 8)
 		t->i_ctime_extra = ext2fs_swab32(f->i_ctime_extra);
-	if (extra_isize >= 14)
+	if (extra_isize >= 12)
 		t->i_mtime_extra = ext2fs_swab32(f->i_mtime_extra);
-	if (extra_isize >= 18)
+	if (extra_isize >= 16)
 		t->i_atime_extra = ext2fs_swab32(f->i_atime_extra);
-	if (extra_isize >= 22)
+	if (extra_isize >= 20)
 		t->i_crtime = ext2fs_swab32(f->i_crtime);
-	if (extra_isize >= 26)
+	if (extra_isize >= 24)
 		t->i_crtime_extra = ext2fs_swab32(f->i_crtime_extra);
-	if (extra_isize >= 30)
+	if (extra_isize >= 28)
 		t->i_version_hi = ext2fs_swab32(f->i_version_hi);
 
 	i = sizeof(struct ext2_inode) + extra_isize + sizeof(__u32);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-30 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 19:38 [PATCH] libext2fs: Fix various errors result from crc32c/metadata checksum integration Darrick J. Wong
2011-09-30 21:08 ` Andreas Dilger
2011-09-30 21:12 ` Ted Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).