From 7812d86f03dbed973e20eee5da963ae5efc666c4 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 20 Sep 2002 19:36:05 +0000 Subject: (This commit touches about 15 disk device drivers in a very consistent and predictable way, and I apologize if I have gotten it wrong anywhere, getting prior review on a patch like this is not feasible, considering the number of people involved and hardware availability etc.) If struct disklabel is the messenger: kill the messenger. Inside struct disk we had a struct disklabel which disk drivers used to communicate certain metrics to the disklayer above (GEOM or the disk mini-layer). This commit changes this communication to use four explicit fields instead. Amongst the benefits is that the fields do not get overwritten by wrong or bogus on-disk disklabels. Once that is clear, which is included in the drivers no longer need to pull and in, the few places that needs them, have gotten explicit #includes for them. The disklabel inside struct disk is now only for internal use in the disk mini-layer, so instead of embedding it, we malloc it as we need it. This concludes (modulus any mistakes) the series of disklabel related commits. I belive it all amounts to a NOP for all the rest of you :-) Sponsored by: DARPA & NAI Labs. --- sys/dev/ofw/ofw_disk.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'sys/dev/ofw') diff --git a/sys/dev/ofw/ofw_disk.c b/sys/dev/ofw/ofw_disk.c index 878e8e88a088..8262e0f4fb72 100644 --- a/sys/dev/ofw/ofw_disk.c +++ b/sys/dev/ofw/ofw_disk.c @@ -114,24 +114,16 @@ static int ofwd_open(dev_t dev, int flags, int fmt, struct thread *td) { struct ofwd_softc *sc; - struct disklabel *label; sc = (struct ofwd_softc *)dev->si_drv1; if (sc == NULL) return (ENXIO); - /* - * Build synthetic label. - */ - label = &sc->ofwd_disk.d_label; - bzero(label, sizeof(*label)); - label->d_type = DTYPE_ESDI; - label->d_secsize = OFWD_BLOCKSIZE; - label->d_nsectors = 33554432; - label->d_ntracks = 1; - label->d_ncylinders = 1024; - label->d_secpercyl = 32768; - label->d_secperunit = 33554432; + sc->ofwd_disk.d_sectorsize = OFWD_BLOCKSIZE; + sc->ofwd_disk.d_mediasize = (off_t)33554432 * OFWD_BLOCKSIZE; + /* XXX: probably don't need the next two */ + sc->ofwd_disk.d_fwsectors = 33554432; + sc->ofwd_disk.d_fwheads = 1 sc->ofwd_flags |= OFWD_OPEN; return (0); -- cgit v1.3