diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2009-08-13 19:51:50 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2009-08-13 19:51:50 +0000 |
commit | d157e37f7f569362bcb8bc76d3048720185319c4 (patch) | |
tree | 5835e91488c01e9afbc0acb3e954ddc13b130a19 /sys/dev | |
parent | b9deecac5e25dd37511c29ceffc655a8836030fd (diff) |
add ioctls to allow userland to initiator a probe or detach of devices it
is providing to the kernel. this uses the req api i just added, otherwise
attaches and detaches would be run from the context of the process issuing
the ioctls, which then will not be able to answer them since theyre busy
running the attach/detach in the kernel.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/vscsi.c | 12 | ||||
-rw-r--r-- | sys/dev/vscsivar.h | 10 |
2 files changed, 20 insertions, 2 deletions
diff --git a/sys/dev/vscsi.c b/sys/dev/vscsi.c index 550d879ccd7..e062d211e2a 100644 --- a/sys/dev/vscsi.c +++ b/sys/dev/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.2 2009/02/16 21:19:06 miod Exp $ */ +/* $OpenBSD: vscsi.c,v 1.3 2009/08/13 19:51:49 dlg Exp $ */ /* * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> @@ -261,6 +261,7 @@ int vscsiioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) { struct vscsi_softc *sc = DEV2SC(dev); + struct vscsi_ioc_devevent *de = (struct vscsi_ioc_devevent *)addr; int read = 0; int err = 0; @@ -279,6 +280,15 @@ vscsiioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) err = vscsi_t2i(sc, (struct vscsi_ioc_t2i *)addr); break; + case VSCSI_REQPROBE: + err = scsi_req_probe(sc->sc_scsibus, de->target, de->lun); + break; + + case VSCSI_REQDETACH: + err = scsi_req_detach(sc->sc_scsibus, de->target, de->lun, + DETACH_FORCE); + break; + default: err = ENOTTY; break; diff --git a/sys/dev/vscsivar.h b/sys/dev/vscsivar.h index 143805e8c96..4b9069d33cb 100644 --- a/sys/dev/vscsivar.h +++ b/sys/dev/vscsivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsivar.h,v 1.1 2008/12/03 23:39:32 dlg Exp $ */ +/* $OpenBSD: vscsivar.h,v 1.2 2009/08/13 19:51:49 dlg Exp $ */ /* * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> @@ -60,4 +60,12 @@ struct vscsi_ioc_t2i { #define VSCSI_T2I _IOW('I', 3, struct vscsi_ioc_t2i) +struct vscsi_ioc_devevent { + u_int target; + u_int lun; +}; + +#define VSCSI_REQPROBE _IOW('I', 4, struct vscsi_ioc_devevent) +#define VSCSI_REQDETACH _IOW('I', 5, struct vscsi_ioc_devevent) + #endif /* _SYS_DEV_VSCSIVAR_H */ |