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 Ensure that no two VIRTIF's have ...



details:   https://anonhg.NetBSD.org/src/rev/008d7e1bdd34
branches:  trunk
changeset: 803660:008d7e1bdd34
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Nov 06 23:25:16 2014 +0000

description:
Ensure that no two VIRTIF's have the same modname, therefore
allowing them to coexist in the same rump kernel.

from Alexander Guy, via github

diffstat:

 sys/rump/net/lib/libvirtif/if_virt.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r ba8dc56b4c43 -r 008d7e1bdd34 sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c      Thu Nov 06 23:19:38 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c      Thu Nov 06 23:25:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_virt.c,v 1.48 2014/08/09 09:47:02 ozaki-r Exp $     */
+/*     $NetBSD: if_virt.c,v 1.49 2014/11/06 23:25:16 pooka Exp $       */
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.48 2014/08/09 09:47:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.49 2014/11/06 23:25:16 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -385,10 +385,16 @@
        m = NULL;
 }
 
-MODULE(MODULE_CLASS_DRIVER, if_virt, NULL);
-
+/*
+ * The following ensures that no two modules using if_virt end up with
+ * the same module name.  MODULE() and modcmd wrapped in ... bad mojo.
+ */
+#define VIF_MOJO(x) MODULE(MODULE_CLASS_DRIVER,x,NULL);
+#define VIF_MODULE() VIF_MOJO(VIF_BASENAME(if_virt_,VIRTIF_BASE))
+#define VIF_MODCMD VIF_BASENAME3(if_virt_,VIRTIF_BASE,_modcmd)
+VIF_MODULE();
 static int
-if_virt_modcmd(modcmd_t cmd, void *opaque)
+VIF_MODCMD(modcmd_t cmd, void *opaque)
 {
        int error = 0;
 



Home | Main Index | Thread Index | Old Index