scst: RHEL 5 build fix

Avoid that building the scst kernel module fails on RHEL 5 due to
a missing kvasprintf() implementation.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5584 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2014-06-11 19:33:18 +00:00
parent 27477a769b
commit c237fa24d9
2 changed files with 25 additions and 0 deletions
+4
View File
@@ -79,6 +79,10 @@ typedef _Bool bool;
#define __aligned __attribute__((aligned))
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
#define lockdep_assert_held(l) do { (void)(l); } while (0)
#endif
+21
View File
@@ -76,6 +76,27 @@ static int strncasecmp(const char *s1, const char *s2, size_t n)
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
{
unsigned int len;
char *p;
va_list aq;
va_copy(aq, ap);
len = vsnprintf(NULL, 0, fmt, aq);
va_end(aq);
p = kmalloc_track_caller(len + 1, gfp);
if (!p)
return NULL;
vsnprintf(p, len + 1, fmt, ap);
return p;
}
#endif
#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)) && defined(SCSI_EXEC_REQ_FIFO_DEFINED)) && !defined(HAVE_SG_COPY)
static int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)