diff options
author | phk <phk@FreeBSD.org> | 2003-05-31 18:56:58 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-05-31 18:56:58 +0000 |
commit | 8d009765a16a9b1c042236aab83986d9f30b7c52 (patch) | |
tree | 61b08008fdd521aef8f5ff0babd019c02b6709ca /sys | |
parent | b11f7951ececfa28b9fe5f05cfedc01fcde978ff (diff) | |
download | FreeBSD-src-8d009765a16a9b1c042236aab83986d9f30b7c52.zip FreeBSD-src-8d009765a16a9b1c042236aab83986d9f30b7c52.tar.gz |
Hang softc from dev_t
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i386/isa/wt.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index e29664d..f994a7e 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -249,6 +249,7 @@ static int wtattach (struct isa_device *id) { wtinfo_t *t = wttab + id->id_unit; + dev_t dev; id->id_ointr = wtintr; if (t->type == ARCHIVE) { @@ -260,7 +261,9 @@ wtattach (struct isa_device *id) t->dens = -1; /* unknown density */ isa_dmainit(t->chan, 1024); - make_dev(&wt_cdevsw, id->id_unit, 0, 0, 0600, "rwt%d", id->id_unit); + dev = make_dev(&wt_cdevsw, id->id_unit, + UID_ROOT, GID_WHEEL, 0600, "rwt%d", id->id_unit); + dev->si_drv1 = t; return (1); } @@ -279,10 +282,15 @@ static int wtopen (dev_t dev, int flag, int fmt, struct thread *td) { int u = minor (dev) & WT_UNIT; - wtinfo_t *t = wttab + u; + wtinfo_t *t; int error; - if (u >= NWT || t->type == UNKNOWN) + if (u >= NWT) + return (ENXIO); + + t = dev->si_drv1; + + if (t->type == UNKNOWN) return (ENXIO); /* Check that device is not in use */ @@ -361,7 +369,9 @@ static int wtclose (dev_t dev, int flags, int fmt, struct thread *td) { int u = minor (dev) & WT_UNIT; - wtinfo_t *t = wttab + u; + wtinfo_t *t; + + t = dev->si_drv1; if (u >= NWT || t->type == UNKNOWN) return (ENXIO); @@ -410,9 +420,10 @@ static int wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct thread *td) { int u = minor (dev) & WT_UNIT; - wtinfo_t *t = wttab + u; + wtinfo_t *t; int error, count, op; + t = dev->si_drv1; if (u >= NWT || t->type == UNKNOWN) return (ENXIO); @@ -508,9 +519,10 @@ static void wtstrategy (struct bio *bp) { int u = minor (bp->bio_dev) & WT_UNIT; - wtinfo_t *t = wttab + u; + wtinfo_t *t; int s; + t = bp->bio_dev->si_drv1; bp->bio_resid = bp->bio_bcount; if (u >= NWT || t->type == UNKNOWN) { bp->bio_error = ENXIO; |