Sun Mar 5 22:14:51 2017 UTC ()
fix some printf formats in DIAGNOSTIC code.


(mrg)
diff -r1.26 -r1.27 src/sys/arch/ofppc/ofppc/disksubr.c

cvs diff -r1.26 -r1.27 src/sys/arch/ofppc/ofppc/disksubr.c (expand / switch to unified diff)

--- src/sys/arch/ofppc/ofppc/disksubr.c 2015/07/04 06:14:41 1.26
+++ src/sys/arch/ofppc/ofppc/disksubr.c 2017/03/05 22:14:51 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: disksubr.c,v 1.26 2015/07/04 06:14:41 maxv Exp $ */ 1/* $NetBSD: disksubr.c,v 1.27 2017/03/05 22:14:51 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 Frank Wille. 4 * Copyright (c) 2010 Frank Wille.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Frank Wille for The NetBSD Project. 7 * Written by Frank Wille for The NetBSD Project.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -53,27 +53,27 @@ @@ -53,27 +53,27 @@
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE. 60 * SUCH DAMAGE.
61 * 61 *
62 * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 62 * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
63 */ 63 */
64 64
65#include <sys/cdefs.h> 65#include <sys/cdefs.h>
66__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.26 2015/07/04 06:14:41 maxv Exp $"); 66__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.27 2017/03/05 22:14:51 mrg Exp $");
67 67
68#include "opt_disksubr.h" 68#include "opt_disksubr.h"
69 69
70#include <sys/buf.h> 70#include <sys/buf.h>
71#include <sys/disklabel.h> 71#include <sys/disklabel.h>
72#include <sys/bswap.h> 72#include <sys/bswap.h>
73 73
74/* 74/*
75 * In /usr/src/sys/dev/scsipi/sd.c, routine sdstart() adjusts the 75 * In /usr/src/sys/dev/scsipi/sd.c, routine sdstart() adjusts the
76 * block numbers, it changes from DEV_BSIZE units to physical units: 76 * block numbers, it changes from DEV_BSIZE units to physical units:
77 * blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE); 77 * blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE);
78 * As long as media with sector sizes of 512 bytes are used, this 78 * As long as media with sector sizes of 512 bytes are used, this
79 * doesn't matter (divide by 1), but for successful usage of media with 79 * doesn't matter (divide by 1), but for successful usage of media with
@@ -327,45 +327,45 @@ read_rdb_label(dev_t dev, void (*strat)( @@ -327,45 +327,45 @@ read_rdb_label(dev_t dev, void (*strat)(
327 */ 327 */
328 if (rbp->highcyl == 0) 328 if (rbp->highcyl == 0)
329 lp->d_ncylinders = rbp->ncylinders; 329 lp->d_ncylinders = rbp->ncylinders;
330 else 330 else
331 lp->d_ncylinders = rbp->highcyl + 1; 331 lp->d_ncylinders = rbp->highcyl + 1;
332 /* 332 /*
333 * I also don't trust rdb->secpercyl 333 * I also don't trust rdb->secpercyl
334 */ 334 */
335 lp->d_secpercyl = min(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks); 335 lp->d_secpercyl = min(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks);
336 if (lp->d_secpercyl == 0) 336 if (lp->d_secpercyl == 0)
337 lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks; 337 lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
338#ifdef DIAGNOSTIC 338#ifdef DIAGNOSTIC
339 if (lp->d_ncylinders != rbp->ncylinders) 339 if (lp->d_ncylinders != rbp->ncylinders)
340 printf("warning found rdb->ncylinders(%ld) != " 340 printf("warning found rdb->ncylinders(%u) != "
341 "rdb->highcyl(%ld) + 1\n", rbp->ncylinders, 341 "rdb->highcyl(%u) + 1\n", rbp->ncylinders,
342 rbp->highcyl); 342 rbp->highcyl);
343 if (lp->d_nsectors * lp->d_ntracks != rbp->secpercyl) 343 if (lp->d_nsectors * lp->d_ntracks != rbp->secpercyl)
344 printf("warning found rdb->secpercyl(%ld) != " 344 printf("warning found rdb->secpercyl(%u) != "
345 "rdb->nsectors(%ld) * rdb->nheads(%ld)\n", rbp->secpercyl, 345 "rdb->nsectors(%u) * rdb->nheads(%u)\n", rbp->secpercyl,
346 rbp->nsectors, rbp->nheads); 346 rbp->nsectors, rbp->nheads);
347#endif 347#endif
348 lp->d_sparespercyl = 348 lp->d_sparespercyl =
349 max(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks) 349 max(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks)
350 - lp->d_secpercyl; 350 - lp->d_secpercyl;
351 if (lp->d_sparespercyl == 0) 351 if (lp->d_sparespercyl == 0)
352 lp->d_sparespertrack = 0; 352 lp->d_sparespertrack = 0;
353 else { 353 else {
354 lp->d_sparespertrack = lp->d_sparespercyl / lp->d_ntracks; 354 lp->d_sparespertrack = lp->d_sparespercyl / lp->d_ntracks;
355#ifdef DIAGNOSTIC 355#ifdef DIAGNOSTIC
356 if (lp->d_sparespercyl % lp->d_ntracks) 356 if (lp->d_sparespercyl % lp->d_ntracks)
357 printf("warning lp->d_sparespercyl(%d) not multiple " 357 printf("warning lp->d_sparespercyl(%u) not multiple "
358 "of lp->d_ntracks(%d)\n", lp->d_sparespercyl, 358 "of lp->d_ntracks(%u)\n", lp->d_sparespercyl,
359 lp->d_ntracks); 359 lp->d_ntracks);
360#endif 360#endif
361 } 361 }
362 362
363 lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders; 363 lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders;
364 lp->d_acylinders = rbp->ncylinders - (rbp->highcyl - rbp->lowcyl + 1); 364 lp->d_acylinders = rbp->ncylinders - (rbp->highcyl - rbp->lowcyl + 1);
365 lp->d_rpm = 3600; /* good guess I suppose. */ 365 lp->d_rpm = 3600; /* good guess I suppose. */
366 lp->d_interleave = rbp->interleave; 366 lp->d_interleave = rbp->interleave;
367 lp->d_headswitch = lp->d_flags = lp->d_trackskew = lp->d_cylskew = 0; 367 lp->d_headswitch = lp->d_flags = lp->d_trackskew = lp->d_cylskew = 0;
368 lp->d_trkseek = /* rbp->steprate */ 0; 368 lp->d_trkseek = /* rbp->steprate */ 0;
369 369
370 /* 370 /*
371 * raw partition gets the entire disk 371 * raw partition gets the entire disk
@@ -456,30 +456,30 @@ read_rdb_label(dev_t dev, void (*strat)( @@ -456,30 +456,30 @@ read_rdb_label(dev_t dev, void (*strat)(
456 pp = &lp->d_partitions[lp->d_npartitions]; 456 pp = &lp->d_partitions[lp->d_npartitions];
457 break; 457 break;
458 } 458 }
459 if (lp->d_npartitions <= (pp - lp->d_partitions)) 459 if (lp->d_npartitions <= (pp - lp->d_partitions))
460 lp->d_npartitions = (pp - lp->d_partitions) + 1; 460 lp->d_npartitions = (pp - lp->d_partitions) + 1;
461 461
462#ifdef DIAGNOSTIC 462#ifdef DIAGNOSTIC
463 if (lp->d_secpercyl * lp->d_secsize != 463 if (lp->d_secpercyl * lp->d_secsize !=
464 (pbp->e.secpertrk * pbp->e.numheads * pbp->e.sizeblock<<2)) { 464 (pbp->e.secpertrk * pbp->e.numheads * pbp->e.sizeblock<<2)) {
465 if (pbp->partname[0] < sizeof(pbp->partname)) 465 if (pbp->partname[0] < sizeof(pbp->partname))
466 pbp->partname[pbp->partname[0] + 1] = 0; 466 pbp->partname[pbp->partname[0] + 1] = 0;
467 else 467 else
468 pbp->partname[sizeof(pbp->partname) - 1] = 0; 468 pbp->partname[sizeof(pbp->partname) - 1] = 0;
469 printf("Partition '%s' geometry %ld/%ld differs", 469 printf("Partition '%s' geometry %u/%u differs",
470 pbp->partname + 1, pbp->e.numheads, 470 pbp->partname + 1, pbp->e.numheads,
471 pbp->e.secpertrk); 471 pbp->e.secpertrk);
472 printf(" from RDB %d/%d=%d\n", lp->d_ntracks, 472 printf(" from RDB %u/%u=%u\n", lp->d_ntracks,
473 lp->d_nsectors, lp->d_secpercyl); 473 lp->d_nsectors, lp->d_secpercyl);
474 } 474 }
475#endif 475#endif
476 /* 476 /*
477 * insert sort in increasing offset order 477 * insert sort in increasing offset order
478 */ 478 */
479 while ((pp - lp->d_partitions) > RAW_PART + 1) { 479 while ((pp - lp->d_partitions) > RAW_PART + 1) {
480 daddr_t boff; 480 daddr_t boff;
481 481
482 boff = pbp->e.lowcyl * pbp->e.secpertrk 482 boff = pbp->e.lowcyl * pbp->e.secpertrk
483 * pbp->e.numheads; 483 * pbp->e.numheads;
484 if (boff > (pp - 1)->p_offset) 484 if (boff > (pp - 1)->p_offset)
485 break; 485 break;