mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user