Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
bd2d80b2
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看板
提交
bd2d80b2
编写于
12年前
作者:
G
Gerd Hoffmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chardev: add error reporting for qemu_chr_new_from_opts
Signed-off-by:
N
Gerd Hoffmann
<
kraxel@redhat.com
>
上级
249d4172
无相关合并请求
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
13 deletion
+23
-13
include/char/char.h
include/char/char.h
+2
-1
qemu-char.c
qemu-char.c
+15
-9
vl.c
vl.c
+6
-3
未找到文件。
include/char/char.h
浏览文件 @
bd2d80b2
...
...
@@ -89,7 +89,8 @@ struct CharDriverState {
* Returns: a new character backend
*/
CharDriverState
*
qemu_chr_new_from_opts
(
QemuOpts
*
opts
,
void
(
*
init
)(
struct
CharDriverState
*
s
));
void
(
*
init
)(
struct
CharDriverState
*
s
),
Error
**
errp
);
/**
* @qemu_chr_new:
...
...
This diff is collapsed.
Click to expand it.
qemu-char.c
浏览文件 @
bd2d80b2
...
...
@@ -2779,19 +2779,20 @@ static const struct {
};
CharDriverState
*
qemu_chr_new_from_opts
(
QemuOpts
*
opts
,
void
(
*
init
)(
struct
CharDriverState
*
s
))
void
(
*
init
)(
struct
CharDriverState
*
s
),
Error
**
errp
)
{
CharDriverState
*
chr
;
int
i
;
if
(
qemu_opts_id
(
opts
)
==
NULL
)
{
fprintf
(
stderr
,
"chardev: no id specified
\n
"
);
error_setg
(
errp
,
"chardev: no id specified
\n
"
);
return
NULL
;
}
if
(
qemu_opt_get
(
opts
,
"backend"
)
==
NULL
)
{
fprintf
(
stderr
,
"chardev:
\"
%s
\"
missing backend
\n
"
,
qemu_opts_id
(
opts
));
error_setg
(
errp
,
"chardev:
\"
%s
\"
missing backend
\n
"
,
qemu_opts_id
(
opts
));
return
NULL
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
backend_table
);
i
++
)
{
...
...
@@ -2799,15 +2800,15 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
break
;
}
if
(
i
==
ARRAY_SIZE
(
backend_table
))
{
fprintf
(
stderr
,
"chardev: backend
\"
%s
\"
not found
\n
"
,
qemu_opt_get
(
opts
,
"backend"
));
error_setg
(
errp
,
"chardev: backend
\"
%s
\"
not found
\n
"
,
qemu_opt_get
(
opts
,
"backend"
));
return
NULL
;
}
chr
=
backend_table
[
i
].
open
(
opts
);
if
(
!
chr
)
{
fprintf
(
stderr
,
"chardev: opening backend
\"
%s
\"
failed
\n
"
,
qemu_opt_get
(
opts
,
"backend"
));
error_setg
(
errp
,
"chardev: opening backend
\"
%s
\"
failed
\n
"
,
qemu_opt_get
(
opts
,
"backend"
));
return
NULL
;
}
...
...
@@ -2837,6 +2838,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in
const
char
*
p
;
CharDriverState
*
chr
;
QemuOpts
*
opts
;
Error
*
err
=
NULL
;
if
(
strstart
(
filename
,
"chardev:"
,
&
p
))
{
return
qemu_chr_find
(
p
);
...
...
@@ -2846,7 +2848,11 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in
if
(
!
opts
)
return
NULL
;
chr
=
qemu_chr_new_from_opts
(
opts
,
init
);
chr
=
qemu_chr_new_from_opts
(
opts
,
init
,
&
err
);
if
(
error_is_set
(
&
err
))
{
fprintf
(
stderr
,
"%s
\n
"
,
error_get_pretty
(
err
));
error_free
(
err
);
}
if
(
chr
&&
qemu_opt_get_bool
(
opts
,
"mux"
,
0
))
{
monitor_init
(
chr
,
MONITOR_USE_READLINE
);
}
...
...
This diff is collapsed.
Click to expand it.
vl.c
浏览文件 @
bd2d80b2
...
...
@@ -2238,11 +2238,14 @@ static int device_init_func(QemuOpts *opts, void *opaque)
static
int
chardev_init_func
(
QemuOpts
*
opts
,
void
*
opaque
)
{
CharDriverState
*
chr
;
Error
*
local_err
=
NULL
;
chr
=
qemu_chr_new_from_opts
(
opts
,
NULL
);
if
(
!
chr
)
qemu_chr_new_from_opts
(
opts
,
NULL
,
&
local_err
);
if
(
error_is_set
(
&
local_err
))
{
fprintf
(
stderr
,
"%s
\n
"
,
error_get_pretty
(
local_err
));
error_free
(
local_err
);
return
-
1
;
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部