Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/installboot/arch A checksum value in alpha boot blo...



details:   https://anonhg.NetBSD.org/src/rev/d40d8e06b272
branches:  trunk
changeset: 748530:d40d8e06b272
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Oct 26 14:26:25 2009 +0000

description:
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.

diffstat:

 usr.sbin/installboot/arch/alpha.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (75 lines):

diff -r abb23e49ff65 -r d40d8e06b272 usr.sbin/installboot/arch/alpha.c
--- a/usr.sbin/installboot/arch/alpha.c Mon Oct 26 14:22:47 2009 +0000
+++ b/usr.sbin/installboot/arch/alpha.c Mon Oct 26 14:26:25 2009 +0000
@@ -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");
 }
 



Home | Main Index | Thread Index | Old Index