Module Name:    src
Committed By:   martin
Date:           Sat Oct 13 17:19:05 UTC 2018

Modified Files:
        src/sys/dev [netbsd-8]: vnd.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1058):

        sys/dev/vnd.c: revision 1.268

Calculate a missing cylinder count in the geometry spec from image size.


To generate a diff of this commit:
cvs rdiff -u -r1.259.6.2 -r1.259.6.3 src/sys/dev/vnd.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/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.259.6.2 src/sys/dev/vnd.c:1.259.6.3
--- src/sys/dev/vnd.c:1.259.6.2	Tue Oct  9 09:58:09 2018
+++ src/sys/dev/vnd.c	Sat Oct 13 17:19:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.259.6.2 2018/10/09 09:58:09 martin Exp $	*/
+/*	$NetBSD: vnd.c,v 1.259.6.3 2018/10/13 17:19:05 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.259.6.2 2018/10/09 09:58:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.259.6.3 2018/10/13 17:19:05 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1419,7 +1419,6 @@ vndioctl(dev_t dev, u_long cmd, void *da
 			 * Sanity-check the sector size.
 			 */
 			if (!DK_DEV_BSIZE_OK(vnd->sc_geom.vng_secsize) ||
-			    vnd->sc_geom.vng_ncylinders == 0 ||
 			    vnd->sc_geom.vng_ntracks == 0 ||
 			    vnd->sc_geom.vng_nsectors == 0) {
 				error = EINVAL;
@@ -1427,6 +1426,14 @@ vndioctl(dev_t dev, u_long cmd, void *da
 			}
 
 			/*
+			 * Compute missing cylinder count from size
+			 */
+			if (vnd->sc_geom.vng_ncylinders == 0)
+				vnd->sc_geom.vng_ncylinders = vnd->sc_size /
+					(vnd->sc_geom.vng_ntracks *
+					vnd->sc_geom.vng_nsectors);
+
+			/*
 			 * Compute the size (in DEV_BSIZE blocks) specified
 			 * by the geometry.
 			 */

Reply via email to