diff options
author | phk <phk@FreeBSD.org> | 2002-09-20 19:36:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-09-20 19:36:05 +0000 |
commit | 57a346a21312d7f99ca28aee15ab6091be10cbd7 (patch) | |
tree | 47b5afae3623c1371d19a0478c850d8e6a08d07b /sys/geom | |
parent | 2fb7a39c0fdc17568c3b60cf37e5f3c2d6dff5e4 (diff) | |
download | FreeBSD-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/geom')
-rw-r--r-- | sys/geom/geom_ccd.c | 1 | ||||
-rw-r--r-- | sys/geom/geom_disk.c | 19 |
2 files changed, 9 insertions, 11 deletions
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index b4387d9..d8e01be 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -100,6 +100,7 @@ #include <sys/stdint.h> #include <sys/sysctl.h> #include <sys/disk.h> +#include <sys/disklabel.h> #include <sys/devicestat.h> #include <sys/fcntl.h> #include <sys/vnode.h> diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index d4091ef..b1fd07e 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -44,6 +44,8 @@ #include <sys/bio.h> #include <sys/conf.h> #include <sys/disk.h> +#include <sys/diskslice.h> +#include <sys/disklabel.h> #include <sys/malloc.h> #include <sys/sysctl.h> #include <sys/stdint.h> @@ -94,8 +96,7 @@ g_disk_access(struct g_provider *pp, int r, int w, int e) } else { error = 0; } - pp->mediasize = - dp->d_label.d_secsize * (off_t)dp->d_label.d_secperunit; + pp->mediasize = dp->d_mediasize; return (error); } @@ -110,7 +111,7 @@ g_disk_kerneldump(struct bio *bp, struct disk *dp) printf("Kerneldump off=%jd len=%jd\n", (intmax_t)gkd->offset, (intmax_t)gkd->length); di.dumper = (dumper_t *)dp->d_devsw->d_dump; di.priv = dp->d_dev; - di.blocksize = dp->d_label.d_secsize; + di.blocksize = dp->d_sectorsize; di.mediaoffset = gkd->offset; di.mediasize = gkd->length; error = set_dumper(&di); @@ -153,17 +154,13 @@ g_disk_start(struct bio *bp) mtx_unlock(&Giant); break; case BIO_GETATTR: - if (g_handleattr_int(bp, "GEOM::sectorsize", - dp->d_label.d_secsize)) + if (g_handleattr_int(bp, "GEOM::sectorsize", dp->d_sectorsize)) break; - else if (g_handleattr_int(bp, "GEOM::fwsectors", - dp->d_label.d_nsectors)) + else if (g_handleattr_int(bp, "GEOM::fwsectors", dp->d_fwsectors)) break; - else if (g_handleattr_int(bp, "GEOM::fwheads", - dp->d_label.d_ntracks)) + else if (g_handleattr_int(bp, "GEOM::fwheads", dp->d_fwheads)) break; - else if (g_handleattr_off_t(bp, "GEOM::mediasize", - dp->d_label.d_secsize * (off_t)dp->d_label.d_secperunit)) + else if (g_handleattr_off_t(bp, "GEOM::mediasize", dp->d_mediasize)) break; else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0)) break; |