Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
f21d96d0
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看板
提交
f21d96d0
编写于
3月 08, 2016
作者:
K
Kevin Wolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
block: Use BdrvChild in BlockBackend
Signed-off-by:
N
Kevin Wolf
<
kwolf@redhat.com
>
上级
9aaf28c6
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
192 addition
and
114 deletion
+192
-114
block.c
block.c
+34
-13
block/block-backend.c
block/block-backend.c
+153
-101
include/block/block_int.h
include/block/block_int.h
+5
-0
未找到文件。
block.c
浏览文件 @
f21d96d0
...
...
@@ -1175,10 +1175,9 @@ static int bdrv_fill_options(QDict **options, const char *filename,
return
0
;
}
static
BdrvChild
*
bdrv_attach_child
(
BlockDriverState
*
parent_bs
,
BlockDriverState
*
child_bs
,
const
char
*
child_name
,
const
BdrvChildRole
*
child_role
)
BdrvChild
*
bdrv_root_attach_child
(
BlockDriverState
*
child_bs
,
const
char
*
child_name
,
const
BdrvChildRole
*
child_role
)
{
BdrvChild
*
child
=
g_new
(
BdrvChild
,
1
);
*
child
=
(
BdrvChild
)
{
...
...
@@ -1187,24 +1186,43 @@ static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
.
role
=
child_role
,
};
QLIST_INSERT_HEAD
(
&
parent_bs
->
children
,
child
,
next
);
QLIST_INSERT_HEAD
(
&
child_bs
->
parents
,
child
,
next_parent
);
return
child
;
}
static
BdrvChild
*
bdrv_attach_child
(
BlockDriverState
*
parent_bs
,
BlockDriverState
*
child_bs
,
const
char
*
child_name
,
const
BdrvChildRole
*
child_role
)
{
BdrvChild
*
child
=
bdrv_root_attach_child
(
child_bs
,
child_name
,
child_role
);
QLIST_INSERT_HEAD
(
&
parent_bs
->
children
,
child
,
next
);
return
child
;
}
static
void
bdrv_detach_child
(
BdrvChild
*
child
)
{
QLIST_REMOVE
(
child
,
next
);
if
(
child
->
next
.
le_prev
)
{
QLIST_REMOVE
(
child
,
next
);
child
->
next
.
le_prev
=
NULL
;
}
QLIST_REMOVE
(
child
,
next_parent
);
g_free
(
child
->
name
);
g_free
(
child
);
}
void
bdrv_
unref_child
(
BlockDriverState
*
parent
,
BdrvChild
*
child
)
void
bdrv_
root_unref_child
(
BdrvChild
*
child
)
{
BlockDriverState
*
child_bs
;
child_bs
=
child
->
bs
;
bdrv_detach_child
(
child
);
bdrv_unref
(
child_bs
);
}
void
bdrv_unref_child
(
BlockDriverState
*
parent
,
BdrvChild
*
child
)
{
if
(
child
==
NULL
)
{
return
;
}
...
...
@@ -1213,9 +1231,7 @@ void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
child
->
bs
->
inherits_from
=
NULL
;
}
child_bs
=
child
->
bs
;
bdrv_detach_child
(
child
);
bdrv_unref
(
child_bs
);
bdrv_root_unref_child
(
child
);
}
/*
...
...
@@ -2255,6 +2271,14 @@ static void change_parent_backing_link(BlockDriverState *from,
{
BdrvChild
*
c
,
*
next
;
if
(
from
->
blk
)
{
/* FIXME We bypass blk_set_bs(), so we need to make these updates
* manually. The root problem is not in this change function, but the
* existence of BlockDriverState.blk. */
to
->
blk
=
from
->
blk
;
from
->
blk
=
NULL
;
}
QLIST_FOREACH_SAFE
(
c
,
&
from
->
parents
,
next_parent
,
next
)
{
assert
(
c
->
role
!=
&
child_backing
);
c
->
bs
=
to
;
...
...
@@ -2263,9 +2287,6 @@ static void change_parent_backing_link(BlockDriverState *from,
bdrv_ref
(
to
);
bdrv_unref
(
from
);
}
if
(
from
->
blk
)
{
blk_set_bs
(
from
->
blk
,
to
);
}
}
static
void
swap_feature_fields
(
BlockDriverState
*
bs_top
,
...
...
block/block-backend.c
浏览文件 @
f21d96d0
此差异已折叠。
点击以展开。
include/block/block_int.h
浏览文件 @
f21d96d0
...
...
@@ -692,6 +692,11 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
void
hmp_drive_add_node
(
Monitor
*
mon
,
const
char
*
optstr
);
BdrvChild
*
bdrv_root_attach_child
(
BlockDriverState
*
child_bs
,
const
char
*
child_name
,
const
BdrvChildRole
*
child_role
);
void
bdrv_root_unref_child
(
BdrvChild
*
child
);
void
blk_set_bs
(
BlockBackend
*
blk
,
BlockDriverState
*
bs
);
void
blk_dev_change_media_cb
(
BlockBackend
*
blk
,
bool
load
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录