Merged revisions 5584 via svnmerge from

svn+ssh://vlnb@svn.code.sf.net/p/scst/svn/trunk

........
  r5584 | vlnb | 2014-06-11 12:33:18 -0700 (Wed, 11 Jun 2014) | 8 lines
  
  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/branches/3.0.x@5591 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2014-06-11 23:52:43 +00:00
parent 68489e57f9
commit a7947ad9ee
2 changed files with 29 additions and 0 deletions

View File

@@ -79,6 +79,14 @@ 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
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
#ifndef O_DSYNC
#define O_DSYNC O_SYNC

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)