Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src The ioctl hypercall is used only by the usb host controller ...
details: https://anonhg.NetBSD.org/src/rev/21f328f32b0a
branches: trunk
changeset: 786419:21f328f32b0a
user: pooka <pooka%NetBSD.org@localhost>
date: Sun Apr 28 09:58:11 2013 +0000
description:
The ioctl hypercall is used only by the usb host controller driver,
so make it exclusive to that component. I'm happy to see it gone.
diffstat:
lib/librumpuser/rumpuser.c | 11 +-----
sys/rump/dev/lib/libugenhc/Makefile | 4 +-
sys/rump/dev/lib/libugenhc/rumpcomp_user.c | 50 ++++++++++++++++++++++++++++++
sys/rump/dev/lib/libugenhc/rumpcomp_user.h | 28 ++++++++++++++++
sys/rump/dev/lib/libugenhc/ugenhc.c | 22 +++++++------
sys/rump/include/rump/rumpuser.h | 3 +-
6 files changed, 96 insertions(+), 22 deletions(-)
diffs (251 lines):
diff -r 2856ff68f6c8 -r 21f328f32b0a lib/librumpuser/rumpuser.c
--- a/lib/librumpuser/rumpuser.c Sun Apr 28 08:08:03 2013 +0000
+++ b/lib/librumpuser/rumpuser.c Sun Apr 28 09:58:11 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser.c,v 1.33 2013/04/27 16:56:29 pooka Exp $ */
+/* $NetBSD: rumpuser.c,v 1.34 2013/04/28 09:58:11 pooka Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.33 2013/04/27 16:56:29 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.34 2013/04/28 09:58:11 pooka Exp $");
#endif /* !lint */
#include <sys/ioctl.h>
@@ -388,13 +388,6 @@
}
int
-rumpuser_ioctl(int fd, u_long cmd, void *data, int *error)
-{
-
- DOCALL_KLOCK(int, (ioctl(fd, cmd, data)));
-}
-
-int
rumpuser_close(int fd, int *error)
{
diff -r 2856ff68f6c8 -r 21f328f32b0a sys/rump/dev/lib/libugenhc/Makefile
--- a/sys/rump/dev/lib/libugenhc/Makefile Sun Apr 28 08:08:03 2013 +0000
+++ b/sys/rump/dev/lib/libugenhc/Makefile Sun Apr 28 09:58:11 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2010/03/08 10:24:37 pooka Exp $
+# $NetBSD: Makefile,v 1.3 2013/04/28 09:58:11 pooka Exp $
#
LIB= rumpdev_ugenhc
@@ -8,5 +8,7 @@
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern
+RUMPUSER_COMP= ioctl
+
.include <bsd.lib.mk>
.include <bsd.klinks.mk>
diff -r 2856ff68f6c8 -r 21f328f32b0a sys/rump/dev/lib/libugenhc/rumpcomp_user.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/dev/lib/libugenhc/rumpcomp_user.c Sun Apr 28 09:58:11 2013 +0000
@@ -0,0 +1,50 @@
+/* $NetBSD: rumpcomp_user.c,v 1.1 2013/04/28 09:58:11 pooka Exp $ */
+
+/*
+ * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <rump/rumpuser_component.h>
+
+#include "rumpcomp_user.h"
+
+int
+rumpcomp_ugenhc_ioctl(int fd, u_long cmd, void *data, int *error)
+{
+ void *cookie;
+ int rv;
+
+ cookie = rumpuser_component_unschedule();
+ rv = ioctl(fd, cmd, data);
+ if (rv == -1)
+ *error = errno;
+ else
+ *error = 0;
+ rumpuser_component_schedule(cookie);
+
+ return rv;
+}
diff -r 2856ff68f6c8 -r 21f328f32b0a sys/rump/dev/lib/libugenhc/rumpcomp_user.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/dev/lib/libugenhc/rumpcomp_user.h Sun Apr 28 09:58:11 2013 +0000
@@ -0,0 +1,28 @@
+/* $NetBSD: rumpcomp_user.h,v 1.1 2013/04/28 09:58:11 pooka Exp $ */
+
+/*
+ * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+int rumpcomp_ugenhc_ioctl(int, u_long, void *, int *);
diff -r 2856ff68f6c8 -r 21f328f32b0a sys/rump/dev/lib/libugenhc/ugenhc.c
--- a/sys/rump/dev/lib/libugenhc/ugenhc.c Sun Apr 28 08:08:03 2013 +0000
+++ b/sys/rump/dev/lib/libugenhc/ugenhc.c Sun Apr 28 09:58:11 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugenhc.c,v 1.12 2012/10/27 17:18:40 chs Exp $ */
+/* $NetBSD: ugenhc.c,v 1.13 2013/04/28 09:58:11 pooka Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1.12 2012/10/27 17:18:40 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1.13 2013/04/28 09:58:11 pooka Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -81,6 +81,8 @@
#include <rump/rumpuser.h>
+#include "rumpcomp_user.h"
+
#include "rump_private.h"
#include "rump_dev_private.h"
@@ -387,7 +389,7 @@
usb_device_descriptor_t uddesc;
totlen = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
memset(buf, 0, totlen);
- if (rumpuser_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
+ if (rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
USB_GET_DEVICE_DESC, &uddesc, &ru_error) == -1) {
err = EIO;
goto ret;
@@ -403,7 +405,7 @@
ufdesc.ufd_size = len;
ufdesc.ufd_data = buf;
memset(buf, 0, len);
- if (rumpuser_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
+ if (rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
USB_GET_FULL_DESC, &ufdesc, &ru_error) == -1) {
err = USBD_IOERROR;
goto ret;
@@ -416,7 +418,7 @@
{
struct usb_device_info udi;
- if (rumpuser_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
+ if (rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
USB_GET_DEVICEINFO, &udi, &ru_error) == -1) {
printf("ugenhc: get dev info failed: %d\n",
ru_error);
@@ -451,7 +453,7 @@
break;
case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
- if (rumpuser_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
+ if (rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
USB_SET_CONFIG, &value, &ru_error) == -1) {
printf("ugenhc: set config failed: %d\n",
ru_error);
@@ -467,7 +469,7 @@
totlen = 0;
uai.uai_interface_index = UGETW(req->wIndex);
uai.uai_alt_no = value;
- if (rumpuser_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
+ if (rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
USB_SET_ALTINTERFACE, &uai, &ru_error) == -1) {
printf("ugenhc: set alt interface failed: %d\n",
ru_error);
@@ -517,7 +519,7 @@
memcpy(&ucr.ucr_request, req, sizeof(ucr.ucr_request));
ucr.ucr_data = buf;
- if (rumpuser_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
+ if (rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[UGEN_EPT_CTRL],
USB_DO_REQUEST, &ucr, &ru_error) == -1) {
if (!mightfail) {
panic("request failed: %d", ru_error);
@@ -748,7 +750,7 @@
while (RUSB(xfer)->rusb_status == 0) {
if (isread) {
- rumpuser_ioctl(sc->sc_ugenfd[endpt],
+ rumpcomp_ugenhc_ioctl(sc->sc_ugenfd[endpt],
USB_SET_SHORT_XFER, &shortval, &error);
n = rumpuser_read(sc->sc_ugenfd[endpt],
buf+done, len-done, &error);
@@ -977,7 +979,7 @@
return USBD_INVAL; /* XXX: no mapping */
}
val = 100;
- if (rumpuser_ioctl(fd, USB_SET_TIMEOUT, &val,
+ if (rumpcomp_ugenhc_ioctl(fd, USB_SET_TIMEOUT, &val,
&error) == -1)
panic("timeout set failed");
sc->sc_ugenfd[endpt] = fd;
diff -r 2856ff68f6c8 -r 21f328f32b0a sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h Sun Apr 28 08:08:03 2013 +0000
+++ b/sys/rump/include/rump/rumpuser.h Sun Apr 28 09:58:11 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser.h,v 1.85 2013/04/27 16:56:30 pooka Exp $ */
+/* $NetBSD: rumpuser.h,v 1.86 2013/04/28 09:58:11 pooka Exp $ */
/*
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
@@ -80,7 +80,6 @@
#define RUMPUSER_OPEN_DIRECT 0x080000
int rumpuser_open(const char *, int, int *);
-int rumpuser_ioctl(int, u_long, void *, int *);
int rumpuser_close(int, int *);
int rumpuser_fsync(int, int *);
Home |
Main Index |
Thread Index |
Old Index