summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2009-08-13 19:51:49 +0000
committerdlg <dlg@openbsd.org>2009-08-13 19:51:49 +0000
commitee9d3df04bfc866e63b035ebf17d05e33ed1006f (patch)
treeac30c83290e0c5c2fa5e812376f332b2366e27b3
parentfunction is named int des_string_to_2key, not int des_string_to_2keys; (diff)
downloadwireguard-openbsd-ee9d3df04bfc866e63b035ebf17d05e33ed1006f.tar.xz
wireguard-openbsd-ee9d3df04bfc866e63b035ebf17d05e33ed1006f.zip
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.
-rw-r--r--sys/dev/vscsi.c12
-rw-r--r--sys/dev/vscsivar.h10
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 */