Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
8ae5e030
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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,发现更多精彩内容 >>
提交
8ae5e030
编写于
11月 28, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
net: switch sockets to ->read_iter/->write_iter
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
6d652330
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
29 deletion
+27
-29
net/socket.c
net/socket.c
+27
-29
未找到文件。
net/socket.c
浏览文件 @
8ae5e030
...
...
@@ -113,10 +113,8 @@ unsigned int sysctl_net_busy_read __read_mostly;
unsigned
int
sysctl_net_busy_poll
__read_mostly
;
#endif
static
ssize_t
sock_aio_read
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
);
static
ssize_t
sock_aio_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
);
static
ssize_t
sock_read_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
to
);
static
ssize_t
sock_write_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
);
static
int
sock_mmap
(
struct
file
*
file
,
struct
vm_area_struct
*
vma
);
static
int
sock_close
(
struct
inode
*
inode
,
struct
file
*
file
);
...
...
@@ -142,8 +140,10 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
static
const
struct
file_operations
socket_file_ops
=
{
.
owner
=
THIS_MODULE
,
.
llseek
=
no_llseek
,
.
aio_read
=
sock_aio_read
,
.
aio_write
=
sock_aio_write
,
.
read
=
new_sync_read
,
.
write
=
new_sync_write
,
.
read_iter
=
sock_read_iter
,
.
write_iter
=
sock_write_iter
,
.
poll
=
sock_poll
,
.
unlocked_ioctl
=
sock_ioctl
,
#ifdef CONFIG_COMPAT
...
...
@@ -845,49 +845,47 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
return
sock
->
ops
->
splice_read
(
sock
,
ppos
,
pipe
,
len
,
flags
);
}
static
ssize_t
sock_aio_read
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
static
ssize_t
sock_read_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
to
)
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
socket
*
sock
=
file
->
private_data
;
struct
msghdr
msg
;
struct
msghdr
msg
=
{.
msg_iter
=
*
to
};
ssize_t
res
;
if
(
file
->
f_flags
&
O_NONBLOCK
)
msg
.
msg_flags
=
MSG_DONTWAIT
;
if
(
pos
!=
0
)
if
(
iocb
->
ki_
pos
!=
0
)
return
-
ESPIPE
;
if
(
iocb
->
ki_nbytes
==
0
)
/* Match SYS5 behaviour */
return
0
;
msg
.
msg_name
=
NULL
;
msg
.
msg_namelen
=
0
;
msg
.
msg_control
=
NULL
;
msg
.
msg_controllen
=
0
;
iov_iter_init
(
&
msg
.
msg_iter
,
READ
,
iov
,
nr_segs
,
iocb
->
ki_nbytes
);
msg
.
msg_flags
=
(
file
->
f_flags
&
O_NONBLOCK
)
?
MSG_DONTWAIT
:
0
;
return
__sock_recvmsg
(
iocb
,
sock
,
&
msg
,
iocb
->
ki_nbytes
,
msg
.
msg_flags
);
res
=
__sock_recvmsg
(
iocb
,
sock
,
&
msg
,
iocb
->
ki_nbytes
,
msg
.
msg_flags
);
*
to
=
msg
.
msg_iter
;
return
res
;
}
static
ssize_t
sock_aio_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
static
ssize_t
sock_write_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
socket
*
sock
=
file
->
private_data
;
struct
msghdr
msg
;
struct
msghdr
msg
=
{.
msg_iter
=
*
from
};
ssize_t
res
;
if
(
pos
!=
0
)
if
(
iocb
->
ki_
pos
!=
0
)
return
-
ESPIPE
;
msg
.
msg_name
=
NULL
;
msg
.
msg_namelen
=
0
;
msg
.
msg_control
=
NULL
;
msg
.
msg_controllen
=
0
;
iov_iter_init
(
&
msg
.
msg_iter
,
WRITE
,
iov
,
nr_segs
,
iocb
->
ki_nbytes
);
msg
.
msg_flags
=
(
file
->
f_flags
&
O_NONBLOCK
)
?
MSG_DONTWAIT
:
0
;
if
(
file
->
f_flags
&
O_NONBLOCK
)
msg
.
msg_flags
=
MSG_DONTWAIT
;
if
(
sock
->
type
==
SOCK_SEQPACKET
)
msg
.
msg_flags
|=
MSG_EOR
;
return
__sock_sendmsg
(
iocb
,
sock
,
&
msg
,
iocb
->
ki_nbytes
);
res
=
__sock_sendmsg
(
iocb
,
sock
,
&
msg
,
iocb
->
ki_nbytes
);
*
from
=
msg
.
msg_iter
;
return
res
;
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录