From 9ac77f979ddae45d1142f96c0d8ee4e57bf68ef9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Nov 2020 15:56:18 +0000 Subject: [PATCH] scst: Simplify the kernel_write() backport Instead of duplicating some of the scst_writev() implementation, always call scst_writev(). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9188 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 7471e2edb..da7322837 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -5999,25 +5999,12 @@ static int scst_cmp_fs_ds(void) ssize_t kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos) { - mm_segment_t old_fs = get_fs(); - ssize_t result; - - set_fs(KERNEL_DS); - { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) struct iovec iov = { .iov_base = (void __force __user *)buf, .iov_len = count }; - result = scst_writev(file, &iov, 1, pos); -#else - result = vfs_write(file, (void __force __user *)buf, count, pos); -#endif - } - set_fs(old_fs); - - return result; + return scst_writev(file, &iov, 1, pos); } EXPORT_SYMBOL(kernel_write); #endif