summaryrefslogtreecommitdiffstats
path: root/sys/dev/twe
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/twe
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/twe')
-rw-r--r--sys/dev/twe/twe_freebsd.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c
index df194a4..5187c25 100644
--- a/sys/dev/twe/twe_freebsd.c
+++ b/sys/dev/twe/twe_freebsd.c
@@ -549,7 +549,6 @@ struct twed_softc
struct twe_drive *twed_drive; /* drive data in parent softc */
struct disk twed_disk; /* generic disk handle */
struct devstat twed_stats; /* accounting */
- struct disklabel twed_label; /* synthetic label */
int twed_flags;
#define TWED_OPEN (1<<0) /* drive is open (can't shut down) */
};
@@ -622,7 +621,6 @@ static int
twed_open(dev_t dev, int flags, int fmt, d_thread_t *td)
{
struct twed_softc *sc = (struct twed_softc *)dev->si_drv1;
- struct disklabel *label;
debug_called(4);
@@ -633,16 +631,10 @@ twed_open(dev_t dev, int flags, int fmt, d_thread_t *td)
if (sc->twed_controller->twe_state & TWE_STATE_SHUTDOWN)
return(ENXIO);
- /* build synthetic label */
- label = &sc->twed_disk.d_label;
- bzero(label, sizeof(*label));
- label->d_type = DTYPE_ESDI;
- label->d_secsize = TWE_BLOCK_SIZE;
- label->d_nsectors = sc->twed_drive->td_sectors;
- label->d_ntracks = sc->twed_drive->td_heads;
- label->d_ncylinders = sc->twed_drive->td_cylinders;
- label->d_secpercyl = sc->twed_drive->td_sectors * sc->twed_drive->td_heads;
- label->d_secperunit = sc->twed_drive->td_size;
+ sc->twed_disk.d_sectorsize = TWE_BLOCK_SIZE;
+ sc->twed_disk.d_mediasize = TWE_BLOCK_SIZE * (off_t)sc->twed_drive->td_size;
+ sc->twed_disk.d_fwsectors = sc->twed_drive->td_sectors;
+ sc->twed_disk.d_fwheads = sc->twed_drive->td_heads;
sc->twed_flags |= TWED_OPEN;
return (0);
OpenPOWER on IntegriCloud