[dahdi-commits] sruffell: linux/trunk r9593 - in /linux/trunk: drivers/dahdi/ include/dahdi/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Mon Jan 3 18:27:09 UTC 2011
Author: sruffell
Date: Mon Jan 3 12:27:05 2011
New Revision: 9593
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9593
Log:
dahdi: Introduce dahdi_kasprintf for pre 2.6.12 kernels.
kasprintf will be used in upcoming changes and it's not supported on
RHEL4 kernels. This change essentially backports it.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Kinsey Moore <kmoore at digium.com>
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
linux/trunk/include/dahdi/kernel.h
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9593&r1=9592&r2=9593
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan 3 12:27:05 2011
@@ -9058,5 +9058,34 @@
#endif
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
+char *dahdi_kasprintf(gfp_t gfp, const char *fmt, ...)
+{
+ va_list ap;
+ char *p;
+ char *temp;
+ unsigned int len;
+
+ temp = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (!temp)
+ return NULL;
+
+ va_start(ap, fmt);
+ len = vsnprintf(temp, PAGE_SIZE, fmt, ap);
+ va_end(ap);
+
+ p = kzalloc(len + 1, gfp);
+ if (!p) {
+ kfree(temp);
+ return NULL;
+ }
+
+ memcpy(p, temp, len + 1);
+ kfree(temp);
+ return p;
+}
+EXPORT_SYMBOL(dahdi_kasprintf);
+#endif
+
module_init(dahdi_init);
module_exit(dahdi_cleanup);
Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=9593&r1=9592&r2=9593
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Mon Jan 3 12:27:05 2011
@@ -1285,6 +1285,8 @@
#define kzalloc(a, b) kcalloc(1, a, b)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
#define synchronize_rcu() synchronize_kernel()
+#define kasprintf dahdi_kasprintf
+char *dahdi_kasprintf(gfp_t gfp, const char *fmt, ...);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
#if !defined(HAVE_WAIT_FOR_COMPLETION_TIMEOUT)
static inline unsigned long
@@ -1301,6 +1303,7 @@
return timeout;
}
#endif
+
#endif /* 2.6.11 */
#endif /* 2.6.12 */
#endif /* 2.6.14 */
More information about the dahdi-commits
mailing list