scst: RHEL 5 build fixes

Avoid that compilation fails on RHEL 5.9. In the RHEL 5.9 kernel headers
neither __printf() nor sg_is_last() has been defined. Additionally, the
variable 'fd' in vdisk_unmap_range() is only defined when building against
kernel version > 2.6.27.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2013-12-18 05:55:31 +00:00
parent bea15720dc
commit b628b36da3
2 changed files with 9 additions and 1 deletions

View File

@@ -92,6 +92,12 @@ typedef _Bool bool;
#include "scst_sgv.h"
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20)
#ifndef __printf
#define __printf(a, b) __attribute__((format(printf,a,b)))
#endif
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) && !defined(BACKPORT_LINUX_CPUMASK_H)
#define nr_cpu_ids NR_CPUS
#endif
@@ -3787,6 +3793,8 @@ static inline struct scatterlist *sg_chain_ptr(struct scatterlist *sg)
return NULL;
}
#define sg_is_last(sg) false
#ifndef sg_page
static inline struct page *sg_page(struct scatterlist *sg)
{

View File

@@ -2134,8 +2134,8 @@ static int vdisk_unmap_range(struct scst_cmd *cmd,
(unsigned long long)start_lba, (unsigned long long)blocks);
if (virt_dev->blockio) {
struct inode *inode = fd->f_dentry->d_inode;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27)
struct inode *inode = fd->f_dentry->d_inode;
gfp_t gfp = scst_cmd_get_gfp_flags(cmd);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)
err = blkdev_issue_discard(inode->i_bdev, start_lba, blocks, gfp);