summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atapi-fd.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-20 19:36:05 +0000
committerphk <phk@FreeBSD.org>2002-09-20 19:36:05 +0000
commit57a346a21312d7f99ca28aee15ab6091be10cbd7 (patch)
tree47b5afae3623c1371d19a0478c850d8e6a08d07b /sys/dev/ata/atapi-fd.c
parent2fb7a39c0fdc17568c3b60cf37e5f3c2d6dff5e4 (diff)
downloadFreeBSD-src-57a346a21312d7f99ca28aee15ab6091be10cbd7.zip
FreeBSD-src-57a346a21312d7f99ca28aee15ab6091be10cbd7.tar.gz
(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, <sys/disk.h> which is included in the drivers no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> 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.
Diffstat (limited to 'sys/dev/ata/atapi-fd.c')
-rw-r--r--sys/dev/ata/atapi-fd.c14
1 files changed, 6 insertions, 8 deletions
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;
}
OpenPOWER on IntegriCloud