Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by mlels...



details:   https://anonhg.NetBSD.org/src/rev/77d0f8bbc3e5
branches:  netbsd-8
changeset: 852043:77d0f8bbc3e5
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Oct 13 17:19:05 2018 +0000

description:
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.

diffstat:

 sys/dev/vnd.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r b1683f7cb3c0 -r 77d0f8bbc3e5 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Sat Oct 13 17:16:12 2018 +0000
+++ b/sys/dev/vnd.c     Sat Oct 13 17:19:05 2018 +0000
@@ -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 @@
                         * 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 @@
                        }
 
                        /*
+                        * 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.
                         */



Home | Main Index | Thread Index | Old Index