Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge Really provide disk properties, the old code...



details:   https://anonhg.NetBSD.org/src/rev/b4d52fd9e323
branches:  trunk
changeset: 334826:b4d52fd9e323
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Dec 08 17:45:12 2014 +0000

description:
Really provide disk properties, the old code computed values that were
never attached to the device.

diffstat:

 sys/dev/dkwedge/dk.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (55 lines):

diff -r 4b13485687ed -r b4d52fd9e323 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Mon Dec 08 16:16:45 2014 +0000
+++ b/sys/dev/dkwedge/dk.c      Mon Dec 08 17:45:12 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.75 2014/11/22 11:59:33 mlelstv Exp $  */
+/*     $NetBSD: dk.c,v 1.76 2014/12/08 17:45:12 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.75 2014/11/22 11:59:33 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.76 2014/12/08 17:45:12 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -258,20 +258,22 @@
 }
 
 static void
-dkgetproperties(struct disk *disk, struct dkwedge_info *dkw)
+dk_set_geometry(struct dkwedge_softc *sc)
 {
+       struct disk *disk = &sc->sc_dk;
        struct disk_geom *dg = &disk->dk_geom;
 
        memset(dg, 0, sizeof(*dg));
 
-       dg->dg_secperunit = dkw->dkw_size >> disk->dk_blkshift;
+       dg->dg_secperunit = sc->sc_size >> disk->dk_blkshift;
        dg->dg_secsize = DEV_BSIZE << disk->dk_blkshift;
+
+       /* fake numbers, 1 cylinder is 1 MB with default sector size */
        dg->dg_nsectors = 32;
        dg->dg_ntracks = 64;
-       /* XXX: why is that dkw->dkw_size instead of secperunit?!?! */
-       dg->dg_ncylinders = dkw->dkw_size / (dg->dg_nsectors * dg->dg_ntracks);
+       dg->dg_ncylinders = dg->dg_secperunit / (dg->dg_nsectors * dg->dg_ntracks);
 
-       disk_set_info(NULL, disk, "ESDI");
+       disk_set_info(sc->sc_dev, disk, NULL);
 }
 
 /*
@@ -454,7 +456,7 @@
 
        disk_init(&sc->sc_dk, device_xname(sc->sc_dev), NULL);
        disk_blocksize(&sc->sc_dk, DEV_BSIZE << pdk->dk_blkshift);
-       dkgetproperties(&sc->sc_dk, dkw);
+       dk_set_geometry(sc);
        disk_attach(&sc->sc_dk);
 
        /* Disk wedge is ready for use! */



Home | Main Index | Thread Index | Old Index