Really provide disk properties, the old code computed values that were
never attached to the device.
This commit is contained in:
parent
c61278b1af
commit
9c0686ce5c
|
@ -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 @@ dkwedge_array_expand(void)
|
|||
}
|
||||
|
||||
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 @@ dkwedge_add(struct dkwedge_info *dkw)
|
|||
|
||||
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! */
|
||||
|
|
Loading…
Reference in New Issue