Module Name: src Committed By: pooka Date: Thu Nov 6 23:25:16 UTC 2014
Modified Files: src/sys/rump/net/lib/libvirtif: if_virt.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/rump/net/lib/libvirtif/if_virt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/net/lib/libvirtif/if_virt.c diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.48 src/sys/rump/net/lib/libvirtif/if_virt.c:1.49 --- src/sys/rump/net/lib/libvirtif/if_virt.c:1.48 Sat Aug 9 09:47:02 2014 +++ src/sys/rump/net/lib/libvirtif/if_virt.c Thu Nov 6 23:25:16 2014 @@ -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 @@ VIF_DELIVERPKT(struct virtif_sc *sc, str 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;