Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Attach disk info even for zero sized disks.



details:   https://anonhg.NetBSD.org/src/rev/416623858dd4
branches:  trunk
changeset: 1015191:416623858dd4
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Oct 17 09:42:35 2020 +0000

description:
Attach disk info even for zero sized disks.
Slight refactoring.

diffstat:

 sys/kern/subr_disk.c |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (46 lines):

diff -r a27a981405dc -r 416623858dd4 sys/kern/subr_disk.c
--- a/sys/kern/subr_disk.c      Sat Oct 17 09:36:45 2020 +0000
+++ b/sys/kern/subr_disk.c      Sat Oct 17 09:42:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk.c,v 1.131 2020/06/11 02:32:06 thorpej Exp $  */
+/*     $NetBSD: subr_disk.c,v 1.132 2020/10/17 09:42:35 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.131 2020/06/11 02:32:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.132 2020/10/17 09:42:35 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -687,21 +687,17 @@
        dk->dk_blkshift = DK_BSIZE2BLKSHIFT(dg->dg_secsize);
        dk->dk_byteshift = DK_BSIZE2BYTESHIFT(dg->dg_secsize);
 
-       if (dg->dg_secperunit == 0 && dg->dg_ncylinders == 0) {
+       if (dg->dg_secperunit == 0) {
 #ifdef DIAGNOSTIC
-               printf("%s: secperunit and ncylinders are zero\n", dk->dk_name);
-#endif
-               return;
-       }
-
-       if (dg->dg_secperunit == 0) {
+               if (dg->dg_ncylinders == 0) {
+                       printf("%s: secperunit and ncylinders are zero\n",
+                           dk->dk_name);
+               }
                if (dg->dg_nsectors == 0 || dg->dg_ntracks == 0) {
-#ifdef DIAGNOSTIC
                        printf("%s: secperunit and (sectors or tracks) "
                            "are zero\n", dk->dk_name);
+               }
 #endif
-                       return;
-               }
                dg->dg_secperunit = (int64_t) dg->dg_nsectors *
                    dg->dg_ntracks * dg->dg_ncylinders;
        }



Home | Main Index | Thread Index | Old Index