kernel already support vfs read and write
This commit is contained in:
@ -94,7 +94,7 @@ static int klib_fwrite(const char *buf, unsigned long size, struct file *filp)
|
||||
old_fs = os_get_fs();
|
||||
os_set_ds();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
|
||||
writelen = vfs_write(filp, (void __user *)buf, size, &filp->f_pos);
|
||||
#else
|
||||
writelen = kernel_write(filp, (void __user *)buf, size, &filp->f_pos);
|
||||
@ -117,7 +117,7 @@ static int klib_fread(char *buf, unsigned long size, struct file *filp)
|
||||
os_set_ds();
|
||||
|
||||
/* The cast to a user pointer is valid due to the set_fs() */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
|
||||
readlen = vfs_read(filp, (void __user *)buf, size, &filp->f_pos);
|
||||
#else
|
||||
readlen = kernel_read(filp, (void __user *)buf, size, &filp->f_pos);
|
||||
|
||||
Reference in New Issue
Block a user