summaryrefslogtreecommitdiffstats
path: root/sys/dev/mlx
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/mlx
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/mlx')
-rw-r--r--sys/dev/mlx/mlx_disk.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c
index 49005b1..a5ff92d 100644
--- a/sys/dev/mlx/mlx_disk.c
+++ b/sys/dev/mlx/mlx_disk.c
@@ -98,7 +98,6 @@ static int
mlxd_open(dev_t dev, int flags, int fmt, struct thread *td)
{
struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1;
- struct disklabel *label;
debug_called(1);
@@ -109,15 +108,10 @@ mlxd_open(dev_t dev, int flags, int fmt, struct thread *td)
if (sc->mlxd_controller->mlx_state & MLX_STATE_SHUTDOWN)
return(ENXIO);
- label = &sc->mlxd_disk.d_label;
- bzero(label, sizeof(*label));
- label->d_type = DTYPE_SCSI;
- label->d_secsize = MLX_BLKSIZE;
- label->d_nsectors = sc->mlxd_drive->ms_sectors;
- label->d_ntracks = sc->mlxd_drive->ms_heads;
- label->d_ncylinders = sc->mlxd_drive->ms_cylinders;
- label->d_secpercyl = sc->mlxd_drive->ms_sectors * sc->mlxd_drive->ms_heads;
- label->d_secperunit = sc->mlxd_drive->ms_size;
+ sc->mlxd_disk.d_sectorsize = MLX_BLKSIZE;
+ sc->mlxd_disk.d_mediasize = MLX_BLKSIZE * (off_t)sc->mlxd_drive->ms_size;
+ sc->mlxd_disk.d_fwsectors = sc->mlxd_drive->ms_sectors;
+ sc->mlxd_disk.d_fwheads = sc->mlxd_drive->ms_heads;
sc->mlxd_flags |= MLXD_OPEN;
return (0);
OpenPOWER on IntegriCloud