Module Name: src Committed By: mlelstv Date: Sat Oct 17 09:42:36 UTC 2020
Modified Files: src/sys/kern: subr_disk.c Log Message: Attach disk info even for zero sized disks. Slight refactoring. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/sys/kern/subr_disk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/subr_disk.c diff -u src/sys/kern/subr_disk.c:1.131 src/sys/kern/subr_disk.c:1.132 --- src/sys/kern/subr_disk.c:1.131 Thu Jun 11 02:32:06 2020 +++ src/sys/kern/subr_disk.c Sat Oct 17 09:42:35 2020 @@ -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 @@ disk_set_info(device_t dev, struct disk 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) { -#ifdef DIAGNOSTIC - printf("%s: secperunit and ncylinders are zero\n", dk->dk_name); -#endif - return; - } - if (dg->dg_secperunit == 0) { - if (dg->dg_nsectors == 0 || dg->dg_ntracks == 0) { #ifdef DIAGNOSTIC + 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) { printf("%s: secperunit and (sectors or tracks) " "are zero\n", dk->dk_name); -#endif - return; } +#endif dg->dg_secperunit = (int64_t) dg->dg_nsectors * dg->dg_ntracks * dg->dg_ncylinders; }