Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
70e60d91
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
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看板
提交
70e60d91
编写于
1月 31, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gadget/function/f_fs.c: switch to ->{read,write}_iter()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
c993c39b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
78 deletion
+58
-78
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/function/f_fs.c
+58
-78
未找到文件。
drivers/usb/gadget/function/f_fs.c
浏览文件 @
70e60d91
...
...
@@ -864,38 +864,6 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
return
ret
;
}
static
ssize_t
ffs_epfile_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
len
,
loff_t
*
ptr
)
{
struct
ffs_io_data
io_data
;
struct
iovec
iov
=
{.
iov_base
=
buf
,
.
iov_len
=
len
};
ENTER
();
io_data
.
aio
=
false
;
io_data
.
read
=
false
;
iov_iter_init
(
&
io_data
.
data
,
WRITE
,
&
iov
,
1
,
len
);
return
ffs_epfile_io
(
file
,
&
io_data
);
}
static
ssize_t
ffs_epfile_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
len
,
loff_t
*
ptr
)
{
struct
ffs_io_data
io_data
;
struct
iovec
iov
=
{.
iov_base
=
buf
,
.
iov_len
=
len
};
ENTER
();
io_data
.
aio
=
false
;
io_data
.
read
=
true
;
io_data
.
to_free
=
NULL
;
iov_iter_init
(
&
io_data
.
data
,
READ
,
&
iov
,
1
,
len
);
return
ffs_epfile_io
(
file
,
&
io_data
);
}
static
int
ffs_epfile_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
...
...
@@ -932,72 +900,84 @@ static int ffs_aio_cancel(struct kiocb *kiocb)
return
value
;
}
static
ssize_t
ffs_epfile_aio_write
(
struct
kiocb
*
kiocb
,
const
struct
iovec
*
iovec
,
unsigned
long
nr_segs
,
loff_t
loff
)
static
ssize_t
ffs_epfile_write_iter
(
struct
kiocb
*
kiocb
,
struct
iov_iter
*
from
)
{
struct
ffs_io_data
*
io_data
;
struct
ffs_io_data
io_data
,
*
p
=
&
io_data
;
ssize_t
res
;
ENTER
();
io_data
=
kmalloc
(
sizeof
(
*
io_data
),
GFP_KERNEL
);
if
(
unlikely
(
!
io_data
))
return
-
ENOMEM
;
if
(
!
is_sync_kiocb
(
kiocb
))
{
p
=
kmalloc
(
sizeof
(
io_data
),
GFP_KERNEL
);
if
(
unlikely
(
!
p
))
return
-
ENOMEM
;
p
->
aio
=
true
;
}
else
{
p
->
aio
=
false
;
}
io_data
->
aio
=
true
;
io_data
->
read
=
false
;
io_data
->
kiocb
=
kiocb
;
iov_iter_init
(
&
io_data
->
data
,
WRITE
,
iovec
,
nr_segs
,
kiocb
->
ki_nbytes
);
io_data
->
mm
=
current
->
mm
;
p
->
read
=
false
;
p
->
kiocb
=
kiocb
;
p
->
data
=
*
from
;
p
->
mm
=
current
->
mm
;
kiocb
->
private
=
io_data
;
kiocb
->
private
=
p
;
kiocb_set_cancel_fn
(
kiocb
,
ffs_aio_cancel
);
res
=
ffs_epfile_io
(
kiocb
->
ki_filp
,
io_data
);
if
(
res
!=
-
EIOCBQUEUED
)
kfree
(
io_data
);
res
=
ffs_epfile_io
(
kiocb
->
ki_filp
,
p
);
if
(
res
==
-
EIOCBQUEUED
)
return
res
;
if
(
p
->
aio
)
kfree
(
p
);
else
*
from
=
p
->
data
;
return
res
;
}
static
ssize_t
ffs_epfile_aio_read
(
struct
kiocb
*
kiocb
,
const
struct
iovec
*
iovec
,
unsigned
long
nr_segs
,
loff_t
loff
)
static
ssize_t
ffs_epfile_read_iter
(
struct
kiocb
*
kiocb
,
struct
iov_iter
*
to
)
{
struct
ffs_io_data
*
io_data
;
struct
iovec
*
iovec_copy
;
struct
ffs_io_data
io_data
,
*
p
=
&
io_data
;
ssize_t
res
;
ENTER
();
iovec_copy
=
kmalloc_array
(
nr_segs
,
sizeof
(
*
iovec_copy
),
GFP_KERNEL
);
if
(
unlikely
(
!
iovec_copy
))
return
-
ENOMEM
;
memcpy
(
iovec_copy
,
iovec
,
sizeof
(
struct
iovec
)
*
nr_segs
);
io_data
=
kmalloc
(
sizeof
(
*
io_data
),
GFP_KERNEL
);
if
(
unlikely
(
!
io_data
))
{
kfree
(
iovec_copy
);
return
-
ENOMEM
;
if
(
!
is_sync_kiocb
(
kiocb
))
{
p
=
kmalloc
(
sizeof
(
io_data
),
GFP_KERNEL
);
if
(
unlikely
(
!
p
))
return
-
ENOMEM
;
p
->
aio
=
true
;
}
else
{
p
->
aio
=
false
;
}
io_data
->
aio
=
true
;
io_data
->
read
=
true
;
io_data
->
kiocb
=
kiocb
;
io_data
->
to_free
=
iovec_copy
;
iov_iter_init
(
&
io_data
->
data
,
READ
,
iovec_copy
,
nr_segs
,
kiocb
->
ki_nbytes
);
io_data
->
mm
=
current
->
mm
;
p
->
read
=
true
;
p
->
kiocb
=
kiocb
;
if
(
p
->
aio
)
{
p
->
to_free
=
dup_iter
(
&
p
->
data
,
to
,
GFP_KERNEL
);
if
(
!
p
->
to_free
)
{
kfree
(
p
);
return
-
ENOMEM
;
}
}
else
{
p
->
data
=
*
to
;
p
->
to_free
=
NULL
;
}
p
->
mm
=
current
->
mm
;
kiocb
->
private
=
io_data
;
kiocb
->
private
=
p
;
kiocb_set_cancel_fn
(
kiocb
,
ffs_aio_cancel
);
res
=
ffs_epfile_io
(
kiocb
->
ki_filp
,
io_data
);
if
(
res
!=
-
EIOCBQUEUED
)
{
kfree
(
io_data
->
to_free
);
kfree
(
io_data
);
res
=
ffs_epfile_io
(
kiocb
->
ki_filp
,
p
);
if
(
res
==
-
EIOCBQUEUED
)
return
res
;
if
(
p
->
aio
)
{
kfree
(
p
->
to_free
);
kfree
(
p
);
}
else
{
*
to
=
p
->
data
;
}
return
res
;
}
...
...
@@ -1079,10 +1059,10 @@ static const struct file_operations ffs_epfile_operations = {
.
llseek
=
no_llseek
,
.
open
=
ffs_epfile_open
,
.
write
=
ffs_epfile
_write
,
.
read
=
ffs_epfile
_read
,
.
aio_write
=
ffs_epfile_aio_write
,
.
aio_read
=
ffs_epfile_aio_read
,
.
write
=
new_sync
_write
,
.
read
=
new_sync
_read
,
.
write_iter
=
ffs_epfile_write_iter
,
.
read_iter
=
ffs_epfile_read_iter
,
.
release
=
ffs_epfile_release
,
.
unlocked_ioctl
=
ffs_epfile_ioctl
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录