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/ata-disk.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sys/dev/ata/ata-disk.c') diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index b4a8656..f8bae5e 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -208,14 +208,10 @@ ad_attach(struct ata_device *atadev) dev->si_iosize_max = adp->max_iosize; adp->dev = dev; - /* construct the disklabel */ - bzero(&adp->disk.d_label, sizeof(struct disklabel)); - adp->disk.d_label.d_secsize = DEV_BSIZE; - adp->disk.d_label.d_nsectors = adp->sectors; - adp->disk.d_label.d_ntracks = adp->heads; - adp->disk.d_label.d_ncylinders = adp->total_secs/(adp->heads*adp->sectors); - adp->disk.d_label.d_secpercyl = adp->sectors * adp->heads; - adp->disk.d_label.d_secperunit = adp->total_secs; + adp->disk.d_sectorsize = DEV_BSIZE; + adp->disk.d_mediasize = DEV_BSIZE * (off_t)adp->total_secs; + adp->disk.d_fwsectors = adp->sectors; + adp->disk.d_fwheads = adp->heads; atadev->driver = adp; atadev->flags = 0; -- cgit v1.1