Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi * use format_bytes() to display the disk size



details:   https://anonhg.NetBSD.org/src/rev/af43031b23e8
branches:  trunk
changeset: 473372:af43031b23e8
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon May 31 12:05:39 1999 +0000

description:
* use format_bytes() to display the disk size
* wrap a couple of printf()s

diffstat:

 sys/dev/scsipi/sd.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (55 lines):

diff -r 3d69a7cbd492 -r af43031b23e8 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c       Mon May 31 11:14:07 1999 +0000
+++ b/sys/dev/scsipi/sd.c       Mon May 31 12:05:39 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.144 1999/02/28 17:14:57 explorer Exp $        */
+/*     $NetBSD: sd.c,v 1.145 1999/05/31 12:05:39 lukem Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -131,6 +131,7 @@
 {
        int error, result;
        struct disk_parms *dp = &sd->params;
+       char pbuf[9];
 
        SC_DEBUG(sc_link, SDEV_DB2, ("sdattach: "));
 
@@ -174,9 +175,12 @@
        printf("%s: ", sd->sc_dev.dv_xname);
        switch (result) {
        case SDGP_RESULT_OK:
-               printf("%ldMB, %ld cyl, %ld head, %ld sec, %ld bytes/sect x %ld sectors",
-                   dp->disksize / (1048576 / dp->blksize), dp->cyls,
-                   dp->heads, dp->sectors, dp->blksize, dp->disksize);
+               format_bytes(pbuf, sizeof(pbuf),
+                   (u_int64_t)dp->disksize * dp->blksize);
+               printf(
+               "%s, %ld cyl, %ld head, %ld sec, %ld bytes/sect x %ld sectors",
+                   pbuf, dp->cyls, dp->heads, dp->sectors, dp->blksize,
+                   dp->disksize);
                break;
 
        case SDGP_RESULT_OFFLINE:
@@ -1018,8 +1022,9 @@
                } else if ((sense->add_sense_code_qual == 0x2) &&
                    (sd->sc_link->quirks & SDEV_NOSTARTUNIT) == 0) {
                        if (sd->sc_link->flags & SDEV_REMOVABLE) {
-                               printf("%s: removable disk stopped- not "
-                                   "restarting\n", sd->sc_dev.dv_xname);
+                               printf(
+                               "%s: removable disk stopped - not restarting\n",
+                                   sd->sc_dev.dv_xname);
                                retval = EIO;
                        } else {
                                printf("%s: respinning up disk\n",
@@ -1027,7 +1032,8 @@
                                retval = scsipi_start(sd->sc_link, SSS_START,
                                    SCSI_URGENT | SCSI_NOSLEEP);
                                if (retval != 0) {
-                                       printf("%s: respin of disk failed-%d\n",
+                                       printf(
+                                           "%s: respin of disk failed - %d\n",
                                            sd->sc_dev.dv_xname, retval);
                                        retval = EIO;
                                } else {



Home | Main Index | Thread Index | Old Index