aboutsummaryrefslogtreecommitdiffstats
path: root/unmodified_drivers
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@xensource.com>2006-11-27 13:50:02 +0000
committerIan Campbell <ian.campbell@xensource.com>2006-11-27 13:50:02 +0000
commitb23fab8e20f28f83b51a0cf64a921e817375fce3 (patch)
treee182097b298df7ad06ee9049514dad9c87133e7a /unmodified_drivers
parent821b3ff18b15be67d262771a7104dbaf67d6d6ba (diff)
downloadxen-b23fab8e20f28f83b51a0cf64a921e817375fce3.tar.gz
xen-b23fab8e20f28f83b51a0cf64a921e817375fce3.tar.bz2
xen-b23fab8e20f28f83b51a0cf64a921e817375fce3.zip
[LINUX] Import kasprintf patch from upstream.
kasprintf has been merged upstream with a slightly different protoype to the one in Xen. Import this patch and fixup the Xen tree to fit. Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Diffstat (limited to 'unmodified_drivers')
-rw-r--r--unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h5
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/platform-compat.c23
2 files changed, 28 insertions, 0 deletions
diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
index ea0e6b308f..4a5aa7f9f9 100644
--- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
+++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
@@ -64,4 +64,9 @@ void *kzalloc(size_t size, int flags);
#define end_that_request_last(req, uptodate) end_that_request_last(req)
#endif
+#if defined(_LINUX_KERNEL_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+#endif
+
#endif
diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
index f3cef11620..5a0bb9bce8 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
@@ -114,3 +114,26 @@ void *kzalloc(size_t size, int flags)
}
EXPORT_SYMBOL(kzalloc);
#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+/* Simplified asprintf. */
+char *kasprintf(gfp_t gfp, const char *fmt, ...)
+{
+ va_list ap;
+ unsigned int len;
+ char *p, dummy[1];
+
+ va_start(ap, fmt);
+ len = vsnprintf(dummy, 0, fmt, ap);
+ va_end(ap);
+
+ p = kmalloc(len + 1, gfp);
+ if (!p)
+ return NULL;
+ va_start(ap, fmt);
+ vsprintf(p, fmt, ap);
+ va_end(ap);
+ return p;
+}
+EXPORT_SYMBOL(kasprintf);
+#endif