Module Name: src
Committed By: tsutsui
Date: Mon Oct 26 14:26:25 UTC 2009
Modified Files:
src/usr.sbin/installboot/arch: alpha.c
Log Message:
A checksum value in alpha boot block is stored in little endian,
so use le64toh() to print it on the host tool.
While here, use consistent (unsignd long long) casts on printing it.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/installboot/arch/alpha.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/installboot/arch/alpha.c
diff -u src/usr.sbin/installboot/arch/alpha.c:1.19 src/usr.sbin/installboot/arch/alpha.c:1.20
--- src/usr.sbin/installboot/arch/alpha.c:1.19 Sun Apr 5 11:55:39 2009
+++ src/usr.sbin/installboot/arch/alpha.c Mon Oct 26 14:26:25 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha.c,v 1.19 2009/04/05 11:55:39 lukem Exp $ */
+/* $NetBSD: alpha.c,v 1.20 2009/10/26 14:26:25 tsutsui Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
#include <sys/cdefs.h>
#if !defined(__lint)
-__RCSID("$NetBSD: alpha.c,v 1.19 2009/04/05 11:55:39 lukem Exp $");
+__RCSID("$NetBSD: alpha.c,v 1.20 2009/10/26 14:26:25 tsutsui Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -154,8 +154,8 @@
if (cksum != bb.bb_cksum) { // XXX check bb_cksum endian?
warnx(
"Old boot block checksum invalid (was %#llx, calculated %#llx)",
- (unsigned long long)bb.bb_cksum,
- (unsigned long long)cksum);
+ (unsigned long long)le64toh(bb.bb_cksum),
+ (unsigned long long)le64toh(cksum));
warnx("Boot block invalid");
return (0);
}
@@ -166,7 +166,7 @@
printf("Old bootstrap size: %llu\n",
(unsigned long long)le64toh(bb.bb_secsize));
printf("Old bootstrap checksum: %#llx\n",
- (unsigned long long)bb.bb_cksum);
+ (unsigned long long)le64toh(bb.bb_cksum));
}
bb.bb_secstart = bb.bb_secsize = bb.bb_flags = 0;
@@ -180,7 +180,7 @@
printf("New bootstrap size: %llu\n",
(unsigned long long)le64toh(bb.bb_secsize));
printf("New bootstrap checksum: %#llx\n",
- (unsigned long long)bb.bb_cksum);
+ (unsigned long long)le64toh(bb.bb_cksum));
if (params->flags & IB_VERBOSE)
printf("%slearing boot block\n",
@@ -296,7 +296,7 @@
printf("Bootstrap sector count: %llu\n",
(unsigned long long)le64toh(bb.bb_secsize));
printf("New boot block checksum: %#llx\n",
- (unsigned long long)bb.bb_cksum);
+ (unsigned long long)le64toh(bb.bb_cksum));
printf("%sriting bootstrap\n",
(params->flags & IB_NOWRITE) ? "Not w" : "W");
}
@@ -368,7 +368,8 @@
if (bb16 != NULL)
memcpy(bb16, bb, sizeof(*bb));
if ((params->flags & IB_VERBOSE) && lastsum != bb->bb_cksum)
- printf("alpha checksum now %016llx\n", (long long)bb->bb_cksum);
+ printf("alpha checksum now %016llx\n",
+ (unsigned long long)le64toh(bb->bb_cksum));
lastsum = bb->bb_cksum;
}
@@ -431,7 +432,7 @@
resum(params, bb, bb16);
if (params->flags & IB_VERBOSE)
printf("final harmonized checksum: %016llx\n",
- (long long)bb->bb_cksum);
+ (unsigned long long)le64toh(bb->bb_cksum));
check_sparc(bb, "Final");
}