From 57a346a21312d7f99ca28aee15ab6091be10cbd7 Mon Sep 17 00:00:00 2001 From: phk 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/ata/atapi-fd.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sys/dev/ata/atapi-fd.c') diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index a8a53ab..e5f887a 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -224,7 +224,6 @@ static int afdopen(dev_t dev, int flags, int fmt, struct thread *td) { struct afd_softc *fdp = dev->si_drv1; - struct disklabel *label = &fdp->disk.d_label; atapi_test_ready(fdp->device); @@ -236,13 +235,12 @@ afdopen(dev_t dev, int flags, int fmt, struct thread *td) fdp->device->flags &= ~ATA_D_MEDIA_CHANGED; - bzero(label, sizeof *label); - label->d_secsize = fdp->cap.sector_size; - label->d_nsectors = fdp->cap.sectors; - label->d_ntracks = fdp->cap.heads; - label->d_ncylinders = fdp->cap.cylinders; - label->d_secpercyl = fdp->cap.sectors * fdp->cap.heads; - label->d_secperunit = label->d_secpercyl * fdp->cap.cylinders; + fdp->disk.d_sectorsize = fdp->cap.sector_size; + fdp->disk.d_mediasize = (off_t)fdp->cap.sector_size * fdp->cap.sectors * + fdp->cap.heads * fdp->cap.cylinders; + fdp->disk.d_fwsectors = fdp->cap.sectors; + fdp->disk.d_fwheads = fdp->cap.heads; + return 0; } -- cgit v1.1