Modified patch from Bart Van Assche <bart.vanassche@gmail.com>

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
This commit is contained in:
Vladislav Bolkhovitin
2009-01-23 19:51:54 +00:00
parent c5faf6a7b4
commit 48addc3482
4 changed files with 25 additions and 1 deletions

View 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

View File

@@ -38,6 +38,22 @@
#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"

View 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 "

View 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);