Module Name: src Committed By: tsutsui Date: Thu Jan 10 16:20:11 UTC 2013
Modified Files: src/sys/arch/luna68k/stand/boot: disklabel.c omron_disklabel.h Log Message: 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) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/disklabel.c \ src/sys/arch/luna68k/stand/boot/omron_disklabel.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/luna68k/stand/boot/disklabel.c diff -u src/sys/arch/luna68k/stand/boot/disklabel.c:1.1 src/sys/arch/luna68k/stand/boot/disklabel.c:1.2 --- src/sys/arch/luna68k/stand/boot/disklabel.c:1.1 Sat Jan 5 17:44:24 2013 +++ src/sys/arch/luna68k/stand/boot/disklabel.c Thu Jan 10 16:20:11 2013 @@ -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 @@ int 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 @@ disklabel(int argc, char *argv[]) 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 @@ disklabel(int argc, char *argv[]) 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")) { Index: src/sys/arch/luna68k/stand/boot/omron_disklabel.h diff -u src/sys/arch/luna68k/stand/boot/omron_disklabel.h:1.1 src/sys/arch/luna68k/stand/boot/omron_disklabel.h:1.2 --- src/sys/arch/luna68k/stand/boot/omron_disklabel.h:1.1 Sat Jan 5 17:44:24 2013 +++ src/sys/arch/luna68k/stand/boot/omron_disklabel.h Thu Jan 10 16:20:11 2013 @@ -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 */ };