Module Name:    src
Committed By:   pooka
Date:           Sun Apr 28 09:58:12 UTC 2013

Modified Files:
        src/lib/librumpuser: rumpuser.c
        src/sys/rump/dev/lib/libugenhc: Makefile ugenhc.c
        src/sys/rump/include/rump: rumpuser.h
Added Files:
        src/sys/rump/dev/lib/libugenhc: rumpcomp_user.c rumpcomp_user.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/librumpuser/rumpuser.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libugenhc/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/rump/dev/lib/libugenhc/rumpcomp_user.c \
    src/sys/rump/dev/lib/libugenhc/rumpcomp_user.h
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/dev/lib/libugenhc/ugenhc.c
cvs rdiff -u -r1.85 -r1.86 src/sys/rump/include/rump/rumpuser.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpuser/rumpuser.c
diff -u src/lib/librumpuser/rumpuser.c:1.33 src/lib/librumpuser/rumpuser.c:1.34
--- src/lib/librumpuser/rumpuser.c:1.33	Sat Apr 27 16:56:29 2013
+++ src/lib/librumpuser/rumpuser.c	Sun Apr 28 09:58:11 2013
@@ -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 @@ rumpuser_open(const char *path, int rufl
 }
 
 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)
 {
 

Index: src/sys/rump/dev/lib/libugenhc/Makefile
diff -u src/sys/rump/dev/lib/libugenhc/Makefile:1.2 src/sys/rump/dev/lib/libugenhc/Makefile:1.3
--- src/sys/rump/dev/lib/libugenhc/Makefile:1.2	Mon Mar  8 10:24:37 2010
+++ src/sys/rump/dev/lib/libugenhc/Makefile	Sun Apr 28 09:58:11 2013
@@ -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 @@ SRCS=	ugenhc.c ugenhc_at_mainbus.c
 
 CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern
 
+RUMPUSER_COMP= ioctl
+
 .include <bsd.lib.mk>
 .include <bsd.klinks.mk>

Index: src/sys/rump/dev/lib/libugenhc/ugenhc.c
diff -u src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.12 src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.13
--- src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.12	Sat Oct 27 17:18:40 2012
+++ src/sys/rump/dev/lib/libugenhc/ugenhc.c	Sun Apr 28 09:58:11 2013
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1
 
 #include <rump/rumpuser.h>
 
+#include "rumpcomp_user.h"
+
 #include "rump_private.h"
 #include "rump_dev_private.h"
 
@@ -387,7 +389,7 @@ rumpusb_device_ctrl_start(usbd_xfer_hand
 			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 @@ rumpusb_device_ctrl_start(usbd_xfer_hand
 			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 @@ rumpusb_device_ctrl_start(usbd_xfer_hand
 			{
 			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 @@ rumpusb_device_ctrl_start(usbd_xfer_hand
 		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 @@ rumpusb_device_ctrl_start(usbd_xfer_hand
 		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 @@ rumpusb_device_ctrl_start(usbd_xfer_hand
 
 		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 @@ rumpusb_device_bulk_start(usbd_xfer_hand
 
 	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 @@ ugenhc_open(struct usbd_pipe *pipe)
 				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;

Index: src/sys/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.85 src/sys/rump/include/rump/rumpuser.h:1.86
--- src/sys/rump/include/rump/rumpuser.h:1.85	Sat Apr 27 16:56:30 2013
+++ src/sys/rump/include/rump/rumpuser.h	Sun Apr 28 09:58:11 2013
@@ -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 @@ int   rumpuser_memsync(void *, size_t, i
 #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 *);
 

Added files:

Index: src/sys/rump/dev/lib/libugenhc/rumpcomp_user.c
diff -u /dev/null src/sys/rump/dev/lib/libugenhc/rumpcomp_user.c:1.1
--- /dev/null	Sun Apr 28 09:58:12 2013
+++ src/sys/rump/dev/lib/libugenhc/rumpcomp_user.c	Sun Apr 28 09:58:11 2013
@@ -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;
+}
Index: src/sys/rump/dev/lib/libugenhc/rumpcomp_user.h
diff -u /dev/null src/sys/rump/dev/lib/libugenhc/rumpcomp_user.h:1.1
--- /dev/null	Sun Apr 28 09:58:12 2013
+++ src/sys/rump/dev/lib/libugenhc/rumpcomp_user.h	Sun Apr 28 09:58:11 2013
@@ -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 *);

Reply via email to