From 9a8c5d8459f83ef36bb746b461dc9e13129d8107 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 2 Oct 2018 13:03:49 +0000 Subject: [PATCH 1/2] scst/include/backport.h: Restore the proper vzalloc() backport git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7488 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 99d61fd4b..1b8847a8e 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -832,15 +832,18 @@ static inline void put_unaligned_be64(uint64_t i, void *p) /* */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) -static inline void *vzalloc(size_t size) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 5 || \ + RHEL_MAJOR -0 == 5 && RHEL_MINOR -0 < 10 || \ + RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1) +/* + * See also patch "mm: add vzalloc() and vzalloc_node() helpers" (commit + * e1ca7788dec6773b1a2bce51b7141948f2b8bccf). + */ +static inline void *vzalloc(unsigned long size) { - void *p; - - p = vmalloc(size); - if (p) - memset(p, 0, size); - return p; + return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, + PAGE_KERNEL); } #endif From 92acee3c256dba9ff14f64233ca6948782c1ad83 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 2 Oct 2018 13:12:33 +0000 Subject: [PATCH 2/2] scst/include/backport.h: RHEL 7 build fix Avoid that compilation fails on RHEL 7 due to a duplicate definition of rdtsc(). Reported-by: Anton Kulshenko git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7489 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 1b8847a8e..3455f3769 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -68,7 +68,7 @@ #ifdef CONFIG_X86 #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(RHEL_RELEASE_CODE) static __always_inline unsigned long long rdtsc(void) { return native_read_tsc();