From: Peter Dinda Date: Wed, 20 Jun 2012 16:07:41 +0000 (-0500) Subject: New style printk for vnet X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=f674908a9b4e959da53f1ed45771cf2d8de46d27;p=palacios.releases.git New style printk for vnet --- diff --git a/linux_module/palacios-vnet.c b/linux_module/palacios-vnet.c index f13a0a9..2020e48 100644 --- a/linux_module/palacios-vnet.c +++ b/linux_module/palacios-vnet.c @@ -15,17 +15,45 @@ #include #include "mm.h" +#include "palacios.h" #include "palacios-vnet.h" #include "linux-exts.h" static void host_print(const char * fmt, ...) { +#if V3_PRINTK_OLD_STYLE_OUTPUT - va_list ap; - va_start(ap, fmt); - vprintk(fmt, ap); - va_end(ap); + va_list ap; - return; + va_start(ap, fmt); + vprintk(fmt, ap); + va_end(ap); + + return + +#else + + va_list ap; + char *buf; + + // Allocate space atomically, in case we are called + // with a lock held + buf = kmalloc(V3_PRINTK_BUF_SIZE, GFP_ATOMIC); + if (!buf) { + printk("palacios: output skipped - unable to allocate\n"); + return; + } + + va_start(ap, fmt); + vsnprintf(buf,V3_PRINTK_BUF_SIZE, fmt, ap); + va_end(ap); + + printk(KERN_INFO "palacios: %s",buf); + + kfree(buf); + + return; + +#endif }