linux side: replace vfs_read by kernel_read
vfs_read has been unexported in bd8df82be66 ("fs: unexport vfs_read and vfs_write")
in kernel 4.14.
kernel_read has always™ existed and is actually more appropriate: we can
remove the set_fs calls that are done in kernel_read.
The downside is that the function prototype also changed in 4.14 with
bdd1d2d3d251 ("fs: fix kernel_read prototype")...
(same with kernel_write e13ec939e96b ("fs: fix kernel_write prototype"))
Change-Id: I6f76a6387ae02b4d33bd62952d995a90b1952fc9
This commit is contained in:
committed by
Dominique Martinet
parent
61a942acdc
commit
ea35954613
@@ -798,7 +798,6 @@ static int read_file(void *buf, size_t size, char *fmt, va_list ap)
|
||||
int n;
|
||||
struct file *fp = NULL;
|
||||
loff_t off;
|
||||
mm_segment_t ofs;
|
||||
ssize_t ss;
|
||||
|
||||
dprintk("read_file(%p,%ld,%s,%p)\n", buf, size, fmt, ap);
|
||||
@@ -824,13 +823,14 @@ static int read_file(void *buf, size_t size, char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
off = 0;
|
||||
ofs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
ss = vfs_read(fp, buf, size, &off);
|
||||
set_fs(ofs);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
|
||||
ss = kernel_read(fp, buf, size, &off);
|
||||
#else
|
||||
ss = kernel_read(fp, off, buf, size);
|
||||
#endif
|
||||
if (ss < 0) {
|
||||
error = ss;
|
||||
eprintk("mcctrl:read_file:vfs_read failed. %d\n", error);
|
||||
eprintk("mcctrl:read_file:kernel_read failed. %d\n", error);
|
||||
goto out;
|
||||
}
|
||||
if (ss >= size) {
|
||||
|
||||
Reference in New Issue
Block a user