Hang softc from dev_t

This commit is contained in:
Poul-Henning Kamp 2003-05-31 18:56:58 +00:00
parent d6b602d4b2
commit e64f402ff1

View file

@ -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;