Modified patch from Bart Van Assche <bart.vanassche@gmail.com>
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 23 Jan 2009 19:51:54 +0000 (19:51 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 23 Jan 2009 19:51:54 +0000 (19:51 +0000)
It, hopefully, fixes compilation problems on CentOS 5.2 as well as on vanilla kernels <2.6.28

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@638 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/include/scst.h
scst/src/dev_handlers/scst_vdisk.c
scst_local/scst_local.c
srpt/src/ib_srpt.c

index 5e12830..e2cd7d6 100644 (file)
@@ -49,7 +49,9 @@
                SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
+#ifndef RHEL_RELEASE_CODE
 typedef _Bool bool;
+#endif
 #define true  1
 #define false 0
 #endif
index 7b27d60..06a8896 100644 (file)
 #include <asm/atomic.h>
 #include <linux/kthread.h>
 #include <linux/sched.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+#include <linux/math64.h>
+#else
+#include <asm/div64.h>
+static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
+{
+       unsigned long long d = dividend;
+       unsigned int dd = divisor, r;
+
+       r = do_div(d, dd);
+       *remainder = r;
+       return d;
+}
+#endif
 
 #define LOG_PREFIX                     "dev_vdisk"
 
index 2d53da0..aa5c741 100644 (file)
@@ -742,9 +742,15 @@ static int __init scst_local_init(void)
        /*
         * Allocate a pool of structures for tgt_specific structures
         */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
        tgt_specific_pool = kmem_cache_create("scst_tgt_specific",
                                      sizeof(struct scst_local_tgt_specific),
                                      0, SCST_SLAB_FLAGS, NULL);
+#else
+       tgt_specific_pool = kmem_cache_create("scst_tgt_specific",
+                                     sizeof(struct scst_local_tgt_specific),
+                                     0, SCST_SLAB_FLAGS, NULL, NULL);
+#endif
 
        if (!tgt_specific_pool) {
                printk(KERN_WARNING "%s: out of memory for "
index 23c797a..e0fe8ab 100644 (file)
@@ -1055,7 +1055,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
                return -ENOMEM;
 
        cqe = SRPT_RQ_SIZE + SRPT_SQ_SIZE - 1;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) && ! defined(RHEL_RELEASE_CODE)
        ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, cqe);
 #else
        ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, cqe, 0);