Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k/stand/boot Make "disklabel" command print c...



details:   https://anonhg.NetBSD.org/src/rev/bdf4cb0acd89
branches:  trunk
changeset: 783850:bdf4cb0acd89
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Jan 10 16:20:11 2013 +0000

description:
Make "disklabel" command print correct disklabel info.
- use exact-width interger types to define on-disk format
  (daddr_t could be a different size)
- use proper LABELOFFSET to locate BSD disklabel
  (LABELOFFSET for luna68k is 64 as 4.4BSD-Lite2 while other
   ports that use sun_disklabel use 128)

diffstat:

 sys/arch/luna68k/stand/boot/disklabel.c       |  10 ++++----
 sys/arch/luna68k/stand/boot/omron_disklabel.h |  30 +++++++++++++-------------
 2 files changed, 20 insertions(+), 20 deletions(-)

diffs (82 lines):

diff -r a11ace34445c -r bdf4cb0acd89 sys/arch/luna68k/stand/boot/disklabel.c
--- a/sys/arch/luna68k/stand/boot/disklabel.c   Thu Jan 10 16:03:49 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/disklabel.c   Thu Jan 10 16:20:11 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $    */
+/*     $NetBSD: disklabel.c,v 1.2 2013/01/10 16:20:11 tsutsui Exp $    */
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -112,7 +112,7 @@
 disklabel(int argc, char *argv[])
 {
        struct scd_dk_label *omp = (struct scd_dk_label *) lbl_buff;
-       struct disklabel    *bp  = (struct disklabel *)omp->dkl_pad;
+       struct disklabel    *bp  = (struct disklabel *)&lbl_buff[LABELOFFSET];
        struct fs *fp = (struct fs *) lbl_buff;
        u_short *p;
        u_long chksum, count;
@@ -147,7 +147,7 @@
                printf("Offset = %d\n", i);
                printf("\n");
                printf("Checksum of Bad Track:\t0x%x\n",        omp->dkl_badchk);
-               printf("Logical Block Total:\t%lu(0x%lx)\n",    omp->dkl_maxblk, omp->dkl_maxblk);
+               printf("Logical Block Total:\t%u(0x%x)\n",      omp->dkl_maxblk, omp->dkl_maxblk);
                printf("Disk Drive Type:\t0x%x\n",              omp->dkl_dtype);
                printf("Number of Disk Drives:\t%d(0x%x)\n",    omp->dkl_ndisk, omp->dkl_ndisk);
                printf("Number of Data Cylinders:\t%d(0x%x)\n", omp->dkl_ncyl, omp->dkl_ncyl);
@@ -162,8 +162,8 @@
                printf("Physical Partition Number:\t%d(0x%x)\n",
                       omp->dkl_ppart, omp->dkl_ppart);
                for (i = 0; i < NLPART; i++)
-                       printf("\t%d:\t%ld\t%ld\n", i,
-                              (long)omp->dkl_map[i].dkl_blkno, (long)omp->dkl_map[i].dkl_nblk);
+                       printf("\t%d:\t%d\t%d\n", i,
+                              omp->dkl_map[i].dkl_blkno, omp->dkl_map[i].dkl_nblk);
                printf("Identifies This Label Format:\t0x%x\n", omp->dkl_magic);
                printf("XOR Checksum of Sector:\t0x%x\n",       omp->dkl_cksum);
        } else if (!strcmp(argv[1], "checksum")) {
diff -r a11ace34445c -r bdf4cb0acd89 sys/arch/luna68k/stand/boot/omron_disklabel.h
--- a/sys/arch/luna68k/stand/boot/omron_disklabel.h     Thu Jan 10 16:03:49 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/omron_disklabel.h     Thu Jan 10 16:20:11 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: omron_disklabel.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $      */
+/*     $NetBSD: omron_disklabel.h,v 1.2 2013/01/10 16:20:11 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -80,20 +80,20 @@
 struct scd_dk_label {
        char    dkl_asciilabel[128];            /* for compatibility */
        char    dkl_pad[512-(128+8*8+11*2+4)];
-       unsigned short  dkl_badchk;             /* checksum of bad track */
-       unsigned long   dkl_maxblk;             /* # of total logical block */
-       unsigned short  dkl_dtype;              /* disk drive type */
-       unsigned short  dkl_ndisk;              /* # of disk drives */
-       unsigned short  dkl_ncyl;               /* # of data cylinders */
-       unsigned short  dkl_acyl;               /* # of alternate cylinders */
-       unsigned short  dkl_nhead;              /* # of heads in this partition */
-       unsigned short  dkl_nsect;              /* # of 512 byte sectors per track */
-       unsigned short  dkl_bhead;              /* identifies proper label locations */
-       unsigned short  dkl_ppart;              /* physical partition # */
+       uint16_t        dkl_badchk;             /* checksum of bad track */
+       uint32_t        dkl_maxblk;             /* # of total logical block */
+       uint16_t        dkl_dtype;              /* disk drive type */
+       uint16_t        dkl_ndisk;              /* # of disk drives */
+       uint16_t        dkl_ncyl;               /* # of data cylinders */
+       uint16_t        dkl_acyl;               /* # of alternate cylinders */
+       uint16_t        dkl_nhead;              /* # of heads in this partition */
+       uint16_t        dkl_nsect;              /* # of 512 byte sectors per track */
+       uint16_t        dkl_bhead;              /* identifies proper label locations */
+       uint16_t        dkl_ppart;              /* physical partition # */
        struct dk_map {                         /* logical partitions */
-               daddr_t dkl_blkno;              /* starting block */
-               daddr_t dkl_nblk;               /* number of blocks */
+               int32_t dkl_blkno;              /* starting block */
+               int32_t dkl_nblk;               /* number of blocks */
        } dkl_map[NLPART];
-       unsigned short  dkl_magic;              /* identifies this label format */
-       unsigned short  dkl_cksum;              /* xor checksum of sector */
+       uint16_t        dkl_magic;              /* identifies this label format */
+       uint16_t        dkl_cksum;              /* xor checksum of sector */
 };



Home | Main Index | Thread Index | Old Index