Module Name:    src
Committed By:   pooka
Date:           Mon Dec 13 20:48:45 UTC 2010

Modified Files:
        src/sbin/modload: Makefile main.c
        src/sbin/modstat: Makefile main.c
        src/sbin/modunload: Makefile main.c
Added Files:
        src/sbin/modload: modload_hostops.c modload_rumpops.c prog_ops.h
        src/sbin/modstat: modstat_hostops.c modstat_rumpops.c prog_ops.h
        src/sbin/modunload: modunload_hostops.c modunload_rumpops.c prog_ops.h

Log Message:
Add rump client support for module utilities.  It should be noted
that while modstat and modunload and builtin modules work exactly
the same as in the host case, modload loads file system kernel
modules from the rump kernel namespace.  By default, archs which
have rump support for the kernel kernel ABI have the host module
directory mapped into the rump kernel namespace at the same location
(/stand/...).  Therefore, if the *host* module directory is populated,
"rump.modload foo" will work as expected.  Otherwise, RUMP_MODULEBASE
can be used to point to the module directory.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/modload/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sbin/modload/main.c
cvs rdiff -u -r0 -r1.1 src/sbin/modload/modload_hostops.c \
    src/sbin/modload/modload_rumpops.c src/sbin/modload/prog_ops.h
cvs rdiff -u -r1.1 -r1.2 src/sbin/modstat/Makefile
cvs rdiff -u -r1.10 -r1.11 src/sbin/modstat/main.c
cvs rdiff -u -r0 -r1.1 src/sbin/modstat/modstat_hostops.c \
    src/sbin/modstat/modstat_rumpops.c src/sbin/modstat/prog_ops.h
cvs rdiff -u -r1.13 -r1.14 src/sbin/modunload/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sbin/modunload/main.c
cvs rdiff -u -r0 -r1.1 src/sbin/modunload/modunload_hostops.c \
    src/sbin/modunload/modunload_rumpops.c src/sbin/modunload/prog_ops.h

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

Modified files:

Index: src/sbin/modload/Makefile
diff -u src/sbin/modload/Makefile:1.14 src/sbin/modload/Makefile:1.15
--- src/sbin/modload/Makefile:1.14	Wed Nov 12 12:35:53 2008
+++ src/sbin/modload/Makefile	Mon Dec 13 20:48:44 2010
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.14 2008/11/12 12:35:53 ad Exp $
+#	$NetBSD: Makefile,v 1.15 2010/12/13 20:48:44 pooka Exp $
 
 .include <bsd.own.mk>
 
-PROG=	modload
+RUMPPRG=modload
 SRCS=	main.c
 MAN=	modload.8
 LDADD=	-lprop

Index: src/sbin/modload/main.c
diff -u src/sbin/modload/main.c:1.13 src/sbin/modload/main.c:1.14
--- src/sbin/modload/main.c:1.13	Thu Jun 11 08:12:00 2009
+++ src/sbin/modload/main.c	Mon Dec 13 20:48:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.13 2009/06/11 08:12:00 wiz Exp $	*/
+/*	$NetBSD: main.c,v 1.14 2010/12/13 20:48:44 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.13 2009/06/11 08:12:00 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 2010/12/13 20:48:44 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/module.h>
@@ -44,6 +44,8 @@
 
 #include <prop/proplib.h>
 
+#include "prog_ops.h"
+
 int		main(int, char **);
 static void	parse_bool_param(prop_dictionary_t, const char *,
 				 const char *);
@@ -160,12 +162,14 @@
 	} else {
 		if (argc != 1)
 			usage();
+		if (prog_init && prog_init() == -1)
+			err(1, "prog init failed");
 		cmdargs.ml_filename = argv[0];
 		cmdargs.ml_flags = flags;
 		cmdargs.ml_props = propsstr;
 		cmdargs.ml_propslen = strlen(propsstr);
 
-		if (modctl(MODCTL_LOAD, &cmdargs)) {
+		if (prog_modctl(MODCTL_LOAD, &cmdargs)) {
 			err(EXIT_FAILURE, NULL);
 		}
 	}

Index: src/sbin/modstat/Makefile
diff -u src/sbin/modstat/Makefile:1.1 src/sbin/modstat/Makefile:1.2
--- src/sbin/modstat/Makefile:1.1	Wed Jan 16 12:34:57 2008
+++ src/sbin/modstat/Makefile	Mon Dec 13 20:48:45 2010
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.1 2008/01/16 12:34:57 ad Exp $
+#	$NetBSD: Makefile,v 1.2 2010/12/13 20:48:45 pooka Exp $
 
-PROG=	modstat
+RUMPPRG=modstat
 SRCS=	main.c
 MAN=	modstat.8
 

Index: src/sbin/modstat/main.c
diff -u src/sbin/modstat/main.c:1.10 src/sbin/modstat/main.c:1.11
--- src/sbin/modstat/main.c:1.10	Fri Mar 19 16:25:33 2010
+++ src/sbin/modstat/main.c	Mon Dec 13 20:48:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.10 2010/03/19 16:25:33 pooka Exp $	*/
+/*	$NetBSD: main.c,v 1.11 2010/12/13 20:48:45 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.10 2010/03/19 16:25:33 pooka Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2010/12/13 20:48:45 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/module.h>
@@ -39,6 +39,8 @@
 #include <unistd.h>
 #include <err.h>
 
+#include "prog_ops.h"
+
 int	main(int, char **);
 static void	usage(void) __dead;
 static int	modstatcmp(const void *, const void *);
@@ -88,10 +90,13 @@
 	if (argc != 0)
 		usage();
 
+	if (prog_init && prog_init() == -1)
+		err(1, "prog init failed");
+
 	for (len = 8192;;) {
 		iov.iov_base = malloc(len);
 		iov.iov_len = len;
-		if (modctl(MODCTL_STAT, &iov)) {
+		if (prog_modctl(MODCTL_STAT, &iov)) {
 			err(EXIT_FAILURE, "modctl(MODCTL_STAT)");
 		}
 		if (len >= iov.iov_len) {

Index: src/sbin/modunload/Makefile
diff -u src/sbin/modunload/Makefile:1.13 src/sbin/modunload/Makefile:1.14
--- src/sbin/modunload/Makefile:1.13	Wed Nov 12 12:35:53 2008
+++ src/sbin/modunload/Makefile	Mon Dec 13 20:48:45 2010
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.13 2008/11/12 12:35:53 ad Exp $
+#	$NetBSD: Makefile,v 1.14 2010/12/13 20:48:45 pooka Exp $
 
-PROG=	modunload
+RUMPPRG=modunload
 SRCS=	main.c
 MAN=	modunload.8
 

Index: src/sbin/modunload/main.c
diff -u src/sbin/modunload/main.c:1.3 src/sbin/modunload/main.c:1.4
--- src/sbin/modunload/main.c:1.3	Mon Dec  6 23:42:48 2010
+++ src/sbin/modunload/main.c	Mon Dec 13 20:48:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.3 2010/12/06 23:42:48 jmcneill Exp $	*/
+/*	$NetBSD: main.c,v 1.4 2010/12/13 20:48:45 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.3 2010/12/06 23:42:48 jmcneill Exp $");
+__RCSID("$NetBSD: main.c,v 1.4 2010/12/13 20:48:45 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/module.h>
@@ -39,6 +39,8 @@
 #include <unistd.h>
 #include <err.h>
 
+#include "prog_ops.h"
+
 int	main(int, char **);
 static void	usage(void) __dead;
 
@@ -50,8 +52,11 @@
 	if (argc < 2)
 		usage();
 
+	if (prog_init && prog_init() == -1)
+		err(1, "init failed");
+
 	for (i = 1; i < argc; i++) {
-		if (modctl(MODCTL_UNLOAD, argv[i])) {
+		if (prog_modctl(MODCTL_UNLOAD, argv[i])) {
 			err(EXIT_FAILURE, NULL);
 		}
 	}

Added files:

Index: src/sbin/modload/modload_hostops.c
diff -u /dev/null src/sbin/modload/modload_hostops.c:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modload/modload_hostops.c	Mon Dec 13 20:48:44 2010
@@ -0,0 +1,41 @@
+/*	$NetBSD: modload_hostops.c,v 1.1 2010/12/13 20:48:44 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: modload_hostops.c,v 1.1 2010/12/13 20:48:44 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/module.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_modctl = modctl,
+};
Index: src/sbin/modload/modload_rumpops.c
diff -u /dev/null src/sbin/modload/modload_rumpops.c:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modload/modload_rumpops.c	Mon Dec 13 20:48:44 2010
@@ -0,0 +1,47 @@
+/*	$NetBSD: modload_rumpops.c,v 1.1 2010/12/13 20:48:44 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: modload_rumpops.c,v 1.1 2010/12/13 20:48:44 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/module.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+#include <rump/rumpclient.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_init =	rumpclient_init,
+
+	.op_modctl =	rump_sys_modctl,
+};
Index: src/sbin/modload/prog_ops.h
diff -u /dev/null src/sbin/modload/prog_ops.h:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modload/prog_ops.h	Mon Dec 13 20:48:44 2010
@@ -0,0 +1,44 @@
+/*      $NetBSD: prog_ops.h,v 1.1 2010/12/13 20:48:44 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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.
+ */
+
+#ifndef _PROG_OPS_H_
+#define _PROG_OPS_H_
+
+#include <sys/types.h>
+
+struct prog_ops {
+	int (*op_init)(void);
+
+	int (*op_modctl)(int, void *);
+};
+extern const struct prog_ops prog_ops;
+
+#define prog_init prog_ops.op_init
+#define prog_modctl prog_ops.op_modctl
+
+#endif /* _PROG_OPS_H_ */

Index: src/sbin/modstat/modstat_hostops.c
diff -u /dev/null src/sbin/modstat/modstat_hostops.c:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modstat/modstat_hostops.c	Mon Dec 13 20:48:45 2010
@@ -0,0 +1,41 @@
+/*	$NetBSD: modstat_hostops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: modstat_hostops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/module.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_modctl = modctl,
+};
Index: src/sbin/modstat/modstat_rumpops.c
diff -u /dev/null src/sbin/modstat/modstat_rumpops.c:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modstat/modstat_rumpops.c	Mon Dec 13 20:48:45 2010
@@ -0,0 +1,47 @@
+/*	$NetBSD: modstat_rumpops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: modstat_rumpops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/module.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+#include <rump/rumpclient.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_init =	rumpclient_init,
+
+	.op_modctl =	rump_sys_modctl,
+};
Index: src/sbin/modstat/prog_ops.h
diff -u /dev/null src/sbin/modstat/prog_ops.h:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modstat/prog_ops.h	Mon Dec 13 20:48:45 2010
@@ -0,0 +1,44 @@
+/*      $NetBSD: prog_ops.h,v 1.1 2010/12/13 20:48:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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.
+ */
+
+#ifndef _PROG_OPS_H_
+#define _PROG_OPS_H_
+
+#include <sys/types.h>
+
+struct prog_ops {
+	int (*op_init)(void);
+
+	int (*op_modctl)(int, void *);
+};
+extern const struct prog_ops prog_ops;
+
+#define prog_init prog_ops.op_init
+#define prog_modctl prog_ops.op_modctl
+
+#endif /* _PROG_OPS_H_ */

Index: src/sbin/modunload/modunload_hostops.c
diff -u /dev/null src/sbin/modunload/modunload_hostops.c:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modunload/modunload_hostops.c	Mon Dec 13 20:48:45 2010
@@ -0,0 +1,41 @@
+/*	$NetBSD: modunload_hostops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: modunload_hostops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/module.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_modctl = modctl,
+};
Index: src/sbin/modunload/modunload_rumpops.c
diff -u /dev/null src/sbin/modunload/modunload_rumpops.c:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modunload/modunload_rumpops.c	Mon Dec 13 20:48:45 2010
@@ -0,0 +1,47 @@
+/*	$NetBSD: modunload_rumpops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: modunload_rumpops.c,v 1.1 2010/12/13 20:48:45 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/module.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+#include <rump/rumpclient.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_init =	rumpclient_init,
+
+	.op_modctl =	rump_sys_modctl,
+};
Index: src/sbin/modunload/prog_ops.h
diff -u /dev/null src/sbin/modunload/prog_ops.h:1.1
--- /dev/null	Mon Dec 13 20:48:45 2010
+++ src/sbin/modunload/prog_ops.h	Mon Dec 13 20:48:45 2010
@@ -0,0 +1,44 @@
+/*      $NetBSD: prog_ops.h,v 1.1 2010/12/13 20:48:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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.
+ */
+
+#ifndef _PROG_OPS_H_
+#define _PROG_OPS_H_
+
+#include <sys/types.h>
+
+struct prog_ops {
+	int (*op_init)(void);
+
+	int (*op_modctl)(int, void *);
+};
+extern const struct prog_ops prog_ops;
+
+#define prog_init prog_ops.op_init
+#define prog_modctl prog_ops.op_modctl
+
+#endif /* _PROG_OPS_H_ */

Reply via email to