Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/net/lib/libvirtif No reason to attach if_virt as a ...



details:   https://anonhg.NetBSD.org/src/rev/7f6efadfc3f1
branches:  trunk
changeset: 327674:7f6efadfc3f1
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Mar 13 21:11:12 2014 +0000

description:
No reason to attach if_virt as a RUMP_COMPONENT(), simply use MODULE().

diffstat:

 sys/rump/net/lib/libvirtif/Makefile.virtif    |   6 +--
 sys/rump/net/lib/libvirtif/if_virt.c          |  33 +++++++++++++++++-
 sys/rump/net/lib/libvirtif/virtif_component.c |  47 ---------------------------
 3 files changed, 33 insertions(+), 53 deletions(-)

diffs (129 lines):

diff -r 0ae1915e1a3c -r 7f6efadfc3f1 sys/rump/net/lib/libvirtif/Makefile.virtif
--- a/sys/rump/net/lib/libvirtif/Makefile.virtif        Thu Mar 13 20:59:12 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/Makefile.virtif        Thu Mar 13 21:11:12 2014 +0000
@@ -1,16 +1,14 @@
-#      $NetBSD: Makefile.virtif,v 1.3 2014/03/13 20:59:12 pooka Exp $
+#      $NetBSD: Makefile.virtif,v 1.4 2014/03/13 21:11:12 pooka Exp $
 #
 
 .if !defined(VIRTIF)
 .error Define VIRTIF when including ${.PARSEFILE}
 .endif
 
-SRCS=  if_virt.c virtif_component.c
+SRCS=  if_virt.c
 
 VIRTIFDIR:=    ${.PARSEDIR}
 .PATH:         ${VIRTIFDIR}
 
-CPPFLAGS+=     -I${VIRTIFDIR}/../../../librump/rumpkern
-
 CPPFLAGS+=              -DVIRTIF_BASE=${VIRTIF} -I${VIRTIFDIR}
 RUMPCOMP_USER_CPPFLAGS+= -DVIRTIF_BASE=${VIRTIF} -I${VIRTIFDIR}
diff -r 0ae1915e1a3c -r 7f6efadfc3f1 sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c      Thu Mar 13 20:59:12 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c      Thu Mar 13 21:11:12 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_virt.c,v 1.43 2014/03/13 20:59:12 pooka Exp $       */
+/*     $NetBSD: if_virt.c,v 1.44 2014/03/13 21:11:12 pooka Exp $       */
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,12 +26,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.43 2014/03/13 20:59:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.44 2014/03/13 21:11:12 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/kmem.h>
 #include <sys/cprng.h>
+#include <sys/module.h>
 
 #include <net/bpf.h>
 #include <net/if.h>
@@ -378,3 +379,31 @@
        }
        m = NULL;
 }
+
+MODULE(MODULE_CLASS_DRIVER, if_virt, NULL);
+
+static int
+if_virt_modcmd(modcmd_t cmd, void *opaque)
+{
+       int error = 0;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               if_clone_attach(&VIF_CLONER);
+               break;
+       case MODULE_CMD_FINI:
+               /*
+                * not sure if interfaces are refcounted
+                * and properly protected
+                */
+#if 0
+               if_clone_detach(&VIF_CLONER);
+#else
+               error = ENOTTY;
+#endif
+               break;
+       default:
+               error = ENOTTY;
+       }
+       return error;
+}
diff -r 0ae1915e1a3c -r 7f6efadfc3f1 sys/rump/net/lib/libvirtif/virtif_component.c
--- a/sys/rump/net/lib/libvirtif/virtif_component.c     Thu Mar 13 20:59:12 2014 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*     $NetBSD: virtif_component.c,v 1.1 2014/03/12 23:42:33 pooka Exp $       */
-
-/*
- * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
- *
- * Development of this software was supported by The Nokia Foundation
- *
- * 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/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtif_component.c,v 1.1 2014/03/12 23:42:33 pooka Exp $");
-
-#include <sys/param.h>
-#include <sys/domain.h>
-#include <sys/protosw.h>
-
-#include <net/if.h>
-
-#include "rump_private.h"
-#include "if_virt.h"
-
-RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
-{
-       extern struct if_clone VIF_CLONER; /* XXX */
-
-       if_clone_attach(&VIF_CLONER);
-}



Home | Main Index | Thread Index | Old Index