From 48addc34824c9c10ab574c890803054c366d6896 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 23 Jan 2009 19:51:54 +0000 Subject: [PATCH] Modified patch from Bart Van Assche It, hopefully, fixes compilation problems on CentOS 5.2 as well as on vanilla kernels <2.6.28 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@638 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 2 ++ scst/src/dev_handlers/scst_vdisk.c | 16 ++++++++++++++++ scst_local/scst_local.c | 6 ++++++ srpt/src/ib_srpt.c | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index 5e12830e5..e2cd7d635 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -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 diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 7b27d6084..06a8896c6 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -38,6 +38,22 @@ #include #include #include +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +#include +#else +#include +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" diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 2d53da0ef..aa5c74153 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -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 " diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 23c797afd..e0fe8aba2 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -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);