Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
e494b6b5
cloud-kernel
项目概览
openanolis
/
cloud-kernel
12 个月 前同步成功
通知
152
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e494b6b5
编写于
4月 01, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
9p: switch to ->read_iter/->write_iter
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
42b1ab97
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
39 addition
and
44 deletion
+39
-44
fs/9p/vfs_file.c
fs/9p/vfs_file.c
+39
-44
未找到文件。
fs/9p/vfs_file.c
浏览文件 @
e494b6b5
...
@@ -374,23 +374,19 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd,
...
@@ -374,23 +374,19 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd,
*/
*/
static
ssize_t
static
ssize_t
v9fs_file_read
(
struct
file
*
filp
,
char
__user
*
udata
,
size_t
count
,
v9fs_file_read_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
to
)
loff_t
*
offset
)
{
{
struct
p9_fid
*
fid
=
filp
->
private_data
;
struct
p9_fid
*
fid
=
iocb
->
ki_filp
->
private_data
;
struct
iovec
iov
=
{.
iov_base
=
udata
,
.
iov_len
=
count
};
struct
iov_iter
to
;
int
ret
,
err
;
int
ret
,
err
;
iov_iter_init
(
&
to
,
READ
,
&
iov
,
1
,
count
);
p9_debug
(
P9_DEBUG_VFS
,
"count %zu offset %lld
\n
"
,
iov_iter_count
(
to
),
iocb
->
ki_pos
);
p9_debug
(
P9_DEBUG_VFS
,
"count %zu offset %lld
\n
"
,
count
,
*
offset
);
ret
=
p9_client_read
(
fid
,
iocb
->
ki_pos
,
to
,
&
err
);
ret
=
p9_client_read
(
fid
,
*
offset
,
&
to
,
&
err
);
if
(
!
ret
)
if
(
!
ret
)
return
err
;
return
err
;
*
offset
+=
ret
;
iocb
->
ki_pos
+=
ret
;
return
ret
;
return
ret
;
}
}
...
@@ -403,33 +399,26 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count,
...
@@ -403,33 +399,26 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count,
*
*
*/
*/
static
ssize_t
static
ssize_t
v9fs_file_write
(
struct
file
*
filp
,
const
char
__user
*
data
,
v9fs_file_write_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
size_t
count
,
loff_t
*
offset
)
{
{
struct
file
*
file
=
iocb
->
ki_filp
;
ssize_t
retval
=
0
;
ssize_t
retval
=
0
;
loff_t
origin
=
*
offset
;
loff_t
origin
=
iocb
->
ki_pos
;
struct
iovec
iov
=
{.
iov_base
=
(
void
__user
*
)
data
,
.
iov_len
=
count
};
size_t
count
=
iov_iter_count
(
from
);
struct
iov_iter
from
;
int
err
=
0
;
int
err
=
0
;
iov_iter_init
(
&
from
,
WRITE
,
&
iov
,
1
,
count
);
retval
=
generic_write_checks
(
file
,
&
origin
,
&
count
,
0
);
retval
=
generic_write_checks
(
filp
,
&
origin
,
&
count
,
0
);
if
(
retval
)
if
(
retval
)
return
retval
;
return
retval
;
iov_iter_truncate
(
&
from
,
count
);
iov_iter_truncate
(
from
,
count
);
p9_debug
(
P9_DEBUG_VFS
,
"data %p count %d offset %x
\n
"
,
data
,
(
int
)
count
,
(
int
)
*
offset
);
retval
=
0
;
if
(
!
count
)
if
(
!
count
)
return
0
;
return
0
;
retval
=
p9_client_write
(
fil
p
->
private_data
,
origin
,
&
from
,
&
err
);
retval
=
p9_client_write
(
fil
e
->
private_data
,
origin
,
from
,
&
err
);
if
(
retval
>
0
)
{
if
(
retval
>
0
)
{
struct
inode
*
inode
=
file_inode
(
fil
p
);
struct
inode
*
inode
=
file_inode
(
fil
e
);
loff_t
i_size
;
loff_t
i_size
;
unsigned
long
pg_start
,
pg_end
;
unsigned
long
pg_start
,
pg_end
;
pg_start
=
origin
>>
PAGE_CACHE_SHIFT
;
pg_start
=
origin
>>
PAGE_CACHE_SHIFT
;
...
@@ -437,18 +426,18 @@ v9fs_file_write(struct file *filp, const char __user * data,
...
@@ -437,18 +426,18 @@ v9fs_file_write(struct file *filp, const char __user * data,
if
(
inode
->
i_mapping
&&
inode
->
i_mapping
->
nrpages
)
if
(
inode
->
i_mapping
&&
inode
->
i_mapping
->
nrpages
)
invalidate_inode_pages2_range
(
inode
->
i_mapping
,
invalidate_inode_pages2_range
(
inode
->
i_mapping
,
pg_start
,
pg_end
);
pg_start
,
pg_end
);
*
offset
+=
retval
;
origin
+=
retval
;
i_size
=
i_size_read
(
inode
);
i_size
=
i_size_read
(
inode
);
if
(
*
offset
>
i_size
)
{
iocb
->
ki_pos
=
origin
;
inode_add_bytes
(
inode
,
*
offset
-
i_size
);
if
(
origin
>
i_size
)
{
i_size_write
(
inode
,
*
offset
);
inode_add_bytes
(
inode
,
origin
-
i_size
);
i_size_write
(
inode
,
origin
);
}
}
return
retval
;
return
retval
;
}
}
return
err
;
return
err
;
}
}
static
int
v9fs_file_fsync
(
struct
file
*
filp
,
loff_t
start
,
loff_t
end
,
static
int
v9fs_file_fsync
(
struct
file
*
filp
,
loff_t
start
,
loff_t
end
,
int
datasync
)
int
datasync
)
{
{
...
@@ -584,11 +573,10 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
...
@@ -584,11 +573,10 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
*
*
*/
*/
static
ssize_t
static
ssize_t
v9fs_mmap_file_read
(
struct
file
*
filp
,
char
__user
*
data
,
size_t
count
,
v9fs_mmap_file_read_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
to
)
loff_t
*
offset
)
{
{
/* TODO: Check if there are dirty pages */
/* TODO: Check if there are dirty pages */
return
v9fs_file_read
(
filp
,
data
,
count
,
offset
);
return
v9fs_file_read
_iter
(
iocb
,
to
);
}
}
/**
/**
...
@@ -600,14 +588,13 @@ v9fs_mmap_file_read(struct file *filp, char __user *data, size_t count,
...
@@ -600,14 +588,13 @@ v9fs_mmap_file_read(struct file *filp, char __user *data, size_t count,
*
*
*/
*/
static
ssize_t
static
ssize_t
v9fs_mmap_file_write
(
struct
file
*
filp
,
const
char
__user
*
data
,
v9fs_mmap_file_write_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
size_t
count
,
loff_t
*
offset
)
{
{
/*
/*
* TODO: invalidate mmaps on filp's inode between
* TODO: invalidate mmaps on filp's inode between
* offset and offset+count
* offset and offset+count
*/
*/
return
v9fs_file_write
(
filp
,
data
,
count
,
offset
);
return
v9fs_file_write
_iter
(
iocb
,
from
);
}
}
static
void
v9fs_mmap_vm_close
(
struct
vm_area_struct
*
vma
)
static
void
v9fs_mmap_vm_close
(
struct
vm_area_struct
*
vma
)
...
@@ -679,8 +666,10 @@ const struct file_operations v9fs_cached_file_operations_dotl = {
...
@@ -679,8 +666,10 @@ const struct file_operations v9fs_cached_file_operations_dotl = {
const
struct
file_operations
v9fs_file_operations
=
{
const
struct
file_operations
v9fs_file_operations
=
{
.
llseek
=
generic_file_llseek
,
.
llseek
=
generic_file_llseek
,
.
read
=
v9fs_file_read
,
.
read
=
new_sync_read
,
.
write
=
v9fs_file_write
,
.
write
=
new_sync_write
,
.
read_iter
=
v9fs_file_read_iter
,
.
write_iter
=
v9fs_file_write_iter
,
.
open
=
v9fs_file_open
,
.
open
=
v9fs_file_open
,
.
release
=
v9fs_dir_release
,
.
release
=
v9fs_dir_release
,
.
lock
=
v9fs_file_lock
,
.
lock
=
v9fs_file_lock
,
...
@@ -690,8 +679,10 @@ const struct file_operations v9fs_file_operations = {
...
@@ -690,8 +679,10 @@ const struct file_operations v9fs_file_operations = {
const
struct
file_operations
v9fs_file_operations_dotl
=
{
const
struct
file_operations
v9fs_file_operations_dotl
=
{
.
llseek
=
generic_file_llseek
,
.
llseek
=
generic_file_llseek
,
.
read
=
v9fs_file_read
,
.
read
=
new_sync_read
,
.
write
=
v9fs_file_write
,
.
write
=
new_sync_write
,
.
read_iter
=
v9fs_file_read_iter
,
.
write_iter
=
v9fs_file_write_iter
,
.
open
=
v9fs_file_open
,
.
open
=
v9fs_file_open
,
.
release
=
v9fs_dir_release
,
.
release
=
v9fs_dir_release
,
.
lock
=
v9fs_file_lock_dotl
,
.
lock
=
v9fs_file_lock_dotl
,
...
@@ -702,8 +693,10 @@ const struct file_operations v9fs_file_operations_dotl = {
...
@@ -702,8 +693,10 @@ const struct file_operations v9fs_file_operations_dotl = {
const
struct
file_operations
v9fs_mmap_file_operations
=
{
const
struct
file_operations
v9fs_mmap_file_operations
=
{
.
llseek
=
generic_file_llseek
,
.
llseek
=
generic_file_llseek
,
.
read
=
v9fs_mmap_file_read
,
.
read
=
new_sync_read
,
.
write
=
v9fs_mmap_file_write
,
.
write
=
new_sync_write
,
.
read_iter
=
v9fs_mmap_file_read_iter
,
.
write_iter
=
v9fs_mmap_file_write_iter
,
.
open
=
v9fs_file_open
,
.
open
=
v9fs_file_open
,
.
release
=
v9fs_dir_release
,
.
release
=
v9fs_dir_release
,
.
lock
=
v9fs_file_lock
,
.
lock
=
v9fs_file_lock
,
...
@@ -713,8 +706,10 @@ const struct file_operations v9fs_mmap_file_operations = {
...
@@ -713,8 +706,10 @@ const struct file_operations v9fs_mmap_file_operations = {
const
struct
file_operations
v9fs_mmap_file_operations_dotl
=
{
const
struct
file_operations
v9fs_mmap_file_operations_dotl
=
{
.
llseek
=
generic_file_llseek
,
.
llseek
=
generic_file_llseek
,
.
read
=
v9fs_mmap_file_read
,
.
read
=
new_sync_read
,
.
write
=
v9fs_mmap_file_write
,
.
write
=
new_sync_write
,
.
read_iter
=
v9fs_mmap_file_read_iter
,
.
write_iter
=
v9fs_mmap_file_write_iter
,
.
open
=
v9fs_file_open
,
.
open
=
v9fs_file_open
,
.
release
=
v9fs_dir_release
,
.
release
=
v9fs_dir_release
,
.
lock
=
v9fs_file_lock_dotl
,
.
lock
=
v9fs_file_lock_dotl
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录