Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Calculate a missing cylinder count in the geometry s...
details: https://anonhg.NetBSD.org/src/rev/4e447d162bf7
branches: trunk
changeset: 433840:4e447d162bf7
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Oct 07 11:54:14 2018 +0000
description:
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 9f8005720505 -r 4e447d162bf7 sys/dev/vnd.c
--- a/sys/dev/vnd.c Sun Oct 07 11:51:26 2018 +0000
+++ b/sys/dev/vnd.c Sun Oct 07 11:54:14 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.267 2018/10/07 11:51:26 mlelstv Exp $ */
+/* $NetBSD: vnd.c,v 1.268 2018/10/07 11:54:14 mlelstv 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.267 2018/10/07 11:51:26 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.268 2018/10/07 11:54:14 mlelstv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -1427,7 +1427,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;
@@ -1435,6 +1434,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