Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
a55d3fba
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a55d3fba
编写于
3月 08, 2016
作者:
K
Kevin Wolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
block: Use blk_prw() in blk_pread()/blk_pwrite()
Signed-off-by:
N
Kevin Wolf
<
kwolf@redhat.com
>
上级
fc1453cd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
15 deletion
+21
-15
block/block-backend.c
block/block-backend.c
+21
-15
未找到文件。
block/block-backend.c
浏览文件 @
a55d3fba
...
...
@@ -743,9 +743,9 @@ static void blk_write_entry(void *opaque)
rwco
->
qiov
,
rwco
->
flags
);
}
static
int
blk_
rw
(
BlockBackend
*
blk
,
int64_t
sector_num
,
uint8_t
*
buf
,
int
nb_sector
s
,
CoroutineEntry
co_entry
,
BdrvRequestFlags
flags
)
static
int
blk_
prw
(
BlockBackend
*
blk
,
int64_t
offset
,
uint8_t
*
buf
,
int64_t
byte
s
,
CoroutineEntry
co_entry
,
BdrvRequestFlags
flags
)
{
AioContext
*
aio_context
;
QEMUIOVector
qiov
;
...
...
@@ -753,19 +753,15 @@ static int blk_rw(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
Coroutine
*
co
;
BlkRwCo
rwco
;
if
(
nb_sectors
<
0
||
nb_sectors
>
BDRV_REQUEST_MAX_SECTORS
)
{
return
-
EINVAL
;
}
iov
=
(
struct
iovec
)
{
.
iov_base
=
buf
,
.
iov_len
=
nb_sectors
*
BDRV_SECTOR_SIZE
,
.
iov_len
=
bytes
,
};
qemu_iovec_init_external
(
&
qiov
,
&
iov
,
1
);
rwco
=
(
BlkRwCo
)
{
.
blk
=
blk
,
.
offset
=
sector_num
<<
BDRV_SECTOR_BITS
,
.
offset
=
offset
,
.
qiov
=
&
qiov
,
.
flags
=
flags
,
.
ret
=
NOT_DONE
,
...
...
@@ -782,6 +778,18 @@ static int blk_rw(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
return
rwco
.
ret
;
}
static
int
blk_rw
(
BlockBackend
*
blk
,
int64_t
sector_num
,
uint8_t
*
buf
,
int
nb_sectors
,
CoroutineEntry
co_entry
,
BdrvRequestFlags
flags
)
{
if
(
nb_sectors
<
0
||
nb_sectors
>
BDRV_REQUEST_MAX_SECTORS
)
{
return
-
EINVAL
;
}
return
blk_prw
(
blk
,
sector_num
<<
BDRV_SECTOR_BITS
,
buf
,
nb_sectors
<<
BDRV_SECTOR_BITS
,
co_entry
,
flags
);
}
int
blk_read
(
BlockBackend
*
blk
,
int64_t
sector_num
,
uint8_t
*
buf
,
int
nb_sectors
)
{
...
...
@@ -862,22 +870,20 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
int
blk_pread
(
BlockBackend
*
blk
,
int64_t
offset
,
void
*
buf
,
int
count
)
{
int
ret
=
blk_
check_byte_request
(
blk
,
offset
,
count
);
int
ret
=
blk_
prw
(
blk
,
offset
,
buf
,
count
,
blk_read_entry
,
0
);
if
(
ret
<
0
)
{
return
ret
;
}
return
bdrv_pread
(
blk_bs
(
blk
),
offset
,
buf
,
count
);
return
count
;
}
int
blk_pwrite
(
BlockBackend
*
blk
,
int64_t
offset
,
const
void
*
buf
,
int
count
)
{
int
ret
=
blk_
check_byte_request
(
blk
,
offset
,
count
);
int
ret
=
blk_
prw
(
blk
,
offset
,
(
void
*
)
buf
,
count
,
blk_write_entry
,
0
);
if
(
ret
<
0
)
{
return
ret
;
}
return
bdrv_pwrite
(
blk_bs
(
blk
),
offset
,
buf
,
count
);
return
count
;
}
int64_t
blk_getlength
(
BlockBackend
*
blk
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录