From e2fa367d968926500584912e98cf7b17bd9487a6 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 9 Feb 2017 11:40:46 +0100 Subject: [PATCH 103/104] zc: Use the power of #elif While here, get rid of that trailing newline as well. Fixes: 2b29be8ac4141 ("adjust to API changes in kernel >=4.10") Suggested-by: Frediano Ziglio Signed-off-by: Phil Sutter --- zc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/zc.c b/zc.c index 2f4ea99..ae464ff 100644 --- a/zc.c +++ b/zc.c @@ -62,21 +62,17 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) ret = get_user_pages(task, mm, (unsigned long)addr, pgcount, write, 0, pg, NULL); -#else -# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) ret = get_user_pages_remote(task, mm, (unsigned long)addr, pgcount, write, 0, pg, NULL); -# else -# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) ret = get_user_pages_remote(task, mm, (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, pg, NULL); -# else +#else ret = get_user_pages_remote(task, mm, (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, pg, NULL, NULL); -# endif -# endif #endif up_read(&mm->mmap_sem); if (ret != pgcount) @@ -222,4 +218,3 @@ int get_userbuf(struct csession *ses, } return 0; } - -- 2.10.2