Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
ab5b027e
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看板
提交
ab5b027e
编写于
3月 02, 2010
作者:
M
Markus Armbruster
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
error: Rename qemu_error_new() to qerror_report()
上级
1ecda02b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
49 deletion
+49
-49
hw/qdev.c
hw/qdev.c
+1
-1
monitor.c
monitor.c
+40
-40
qemu-error.c
qemu-error.c
+3
-3
qemu-error.h
qemu-error.h
+5
-5
未找到文件。
hw/qdev.c
浏览文件 @
ab5b027e
...
...
@@ -191,7 +191,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
/* find driver */
info
=
qdev_find_info
(
NULL
,
driver
);
if
(
!
info
)
{
qe
mu_error_new
(
QERR_DEVICE_NOT_FOUND
,
driver
);
qe
rror_report
(
QERR_DEVICE_NOT_FOUND
,
driver
);
return
NULL
;
}
if
(
info
->
no_user
)
{
...
...
monitor.c
浏览文件 @
ab5b027e
...
...
@@ -208,7 +208,7 @@ static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void
*
opaque
)
{
if
(
monitor_ctrl_mode
(
mon
))
{
qe
mu_error_new
(
QERR_MISSING_PARAMETER
,
"password"
);
qe
rror_report
(
QERR_MISSING_PARAMETER
,
"password"
);
return
-
EINVAL
;
}
else
if
(
mon
->
rs
)
{
readline_start
(
mon
->
rs
,
"Password: "
,
1
,
readline_func
,
opaque
);
...
...
@@ -607,7 +607,7 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
if
(
cmd
->
name
==
NULL
)
{
if
(
monitor_ctrl_mode
(
mon
))
{
qe
mu_error_new
(
QERR_COMMAND_NOT_FOUND
,
item
);
qe
rror_report
(
QERR_COMMAND_NOT_FOUND
,
item
);
return
-
1
;
}
goto
help
;
...
...
@@ -639,7 +639,7 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
}
else
{
if
(
monitor_ctrl_mode
(
mon
))
{
/* handler not converted yet */
qe
mu_error_new
(
QERR_COMMAND_NOT_FOUND
,
item
);
qe
rror_report
(
QERR_COMMAND_NOT_FOUND
,
item
);
return
-
1
;
}
else
{
cmd
->
mhandler
.
info
(
mon
);
...
...
@@ -961,7 +961,7 @@ static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
int
index
=
qdict_get_int
(
qdict
,
"index"
);
if
(
mon_set_cpu
(
index
)
<
0
)
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER
,
"index"
);
qe
rror_report
(
QERR_INVALID_PARAMETER
,
"index"
);
return
-
1
;
}
return
0
;
...
...
@@ -1014,12 +1014,12 @@ static int eject_device(Monitor *mon, BlockDriverState *bs, int force)
if
(
bdrv_is_inserted
(
bs
))
{
if
(
!
force
)
{
if
(
!
bdrv_is_removable
(
bs
))
{
qe
mu_error_new
(
QERR_DEVICE_NOT_REMOVABLE
,
qe
rror_report
(
QERR_DEVICE_NOT_REMOVABLE
,
bdrv_get_device_name
(
bs
));
return
-
1
;
}
if
(
bdrv_is_locked
(
bs
))
{
qe
mu_error_new
(
QERR_DEVICE_LOCKED
,
bdrv_get_device_name
(
bs
));
qe
rror_report
(
QERR_DEVICE_LOCKED
,
bdrv_get_device_name
(
bs
));
return
-
1
;
}
}
...
...
@@ -1036,7 +1036,7 @@ static int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
bs
=
bdrv_find
(
filename
);
if
(
!
bs
)
{
qe
mu_error_new
(
QERR_DEVICE_NOT_FOUND
,
filename
);
qe
rror_report
(
QERR_DEVICE_NOT_FOUND
,
filename
);
return
-
1
;
}
return
eject_device
(
mon
,
bs
,
force
);
...
...
@@ -1049,12 +1049,12 @@ static int do_block_set_passwd(Monitor *mon, const QDict *qdict,
bs
=
bdrv_find
(
qdict_get_str
(
qdict
,
"device"
));
if
(
!
bs
)
{
qe
mu_error_new
(
QERR_DEVICE_NOT_FOUND
,
qdict_get_str
(
qdict
,
"device"
));
qe
rror_report
(
QERR_DEVICE_NOT_FOUND
,
qdict_get_str
(
qdict
,
"device"
));
return
-
1
;
}
if
(
bdrv_set_key
(
bs
,
qdict_get_str
(
qdict
,
"password"
))
<
0
)
{
qe
mu_error_new
(
QERR_INVALID_PASSWORD
);
qe
rror_report
(
QERR_INVALID_PASSWORD
);
return
-
1
;
}
...
...
@@ -1069,13 +1069,13 @@ static int do_change_block(Monitor *mon, const char *device,
bs
=
bdrv_find
(
device
);
if
(
!
bs
)
{
qe
mu_error_new
(
QERR_DEVICE_NOT_FOUND
,
device
);
qe
rror_report
(
QERR_DEVICE_NOT_FOUND
,
device
);
return
-
1
;
}
if
(
fmt
)
{
drv
=
bdrv_find_whitelisted_format
(
fmt
);
if
(
!
drv
)
{
qe
mu_error_new
(
QERR_INVALID_BLOCK_FORMAT
,
fmt
);
qe
rror_report
(
QERR_INVALID_BLOCK_FORMAT
,
fmt
);
return
-
1
;
}
}
...
...
@@ -1091,7 +1091,7 @@ static int do_change_block(Monitor *mon, const char *device,
static
int
change_vnc_password
(
const
char
*
password
)
{
if
(
vnc_display_password
(
NULL
,
password
)
<
0
)
{
qe
mu_error_new
(
QERR_SET_PASSWD_FAILED
);
qe
rror_report
(
QERR_SET_PASSWD_FAILED
);
return
-
1
;
}
...
...
@@ -1119,7 +1119,7 @@ static int do_change_vnc(Monitor *mon, const char *target, const char *arg)
}
}
else
{
if
(
vnc_display_open
(
NULL
,
target
)
<
0
)
{
qe
mu_error_new
(
QERR_VNC_SERVER_FAILED
,
target
);
qe
rror_report
(
QERR_VNC_SERVER_FAILED
,
target
);
return
-
1
;
}
}
...
...
@@ -1491,7 +1491,7 @@ static int do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data)
f
=
fopen
(
filename
,
"wb"
);
if
(
!
f
)
{
qe
mu_error_new
(
QERR_OPEN_FILE_FAILED
,
filename
);
qe
rror_report
(
QERR_OPEN_FILE_FAILED
,
filename
);
return
-
1
;
}
while
(
size
!=
0
)
{
...
...
@@ -1527,7 +1527,7 @@ static int do_physical_memory_save(Monitor *mon, const QDict *qdict,
f
=
fopen
(
filename
,
"wb"
);
if
(
!
f
)
{
qe
mu_error_new
(
QERR_OPEN_FILE_FAILED
,
filename
);
qe
rror_report
(
QERR_OPEN_FILE_FAILED
,
filename
);
return
-
1
;
}
while
(
size
!=
0
)
{
...
...
@@ -2301,13 +2301,13 @@ static int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque)
int
ret
;
if
(
kvm_enabled
()
&&
!
kvm_has_sync_mmu
())
{
qe
mu_error_new
(
QERR_KVM_MISSING_CAP
,
"synchronous MMU"
,
"balloon"
);
qe
rror_report
(
QERR_KVM_MISSING_CAP
,
"synchronous MMU"
,
"balloon"
);
return
-
1
;
}
ret
=
qemu_balloon_status
(
cb
,
opaque
);
if
(
!
ret
)
{
qe
mu_error_new
(
QERR_DEVICE_NOT_ACTIVE
,
"balloon"
);
qe
rror_report
(
QERR_DEVICE_NOT_ACTIVE
,
"balloon"
);
return
-
1
;
}
...
...
@@ -2323,13 +2323,13 @@ static int do_balloon(Monitor *mon, const QDict *params,
int
ret
;
if
(
kvm_enabled
()
&&
!
kvm_has_sync_mmu
())
{
qe
mu_error_new
(
QERR_KVM_MISSING_CAP
,
"synchronous MMU"
,
"balloon"
);
qe
rror_report
(
QERR_KVM_MISSING_CAP
,
"synchronous MMU"
,
"balloon"
);
return
-
1
;
}
ret
=
qemu_balloon
(
qdict_get_int
(
params
,
"value"
),
cb
,
opaque
);
if
(
ret
==
0
)
{
qe
mu_error_new
(
QERR_DEVICE_NOT_ACTIVE
,
"balloon"
);
qe
rror_report
(
QERR_DEVICE_NOT_ACTIVE
,
"balloon"
);
return
-
1
;
}
...
...
@@ -2470,21 +2470,21 @@ static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data)
fd
=
qemu_chr_get_msgfd
(
mon
->
chr
);
if
(
fd
==
-
1
)
{
qe
mu_error_new
(
QERR_FD_NOT_SUPPLIED
);
qe
rror_report
(
QERR_FD_NOT_SUPPLIED
);
return
-
1
;
}
if
(
qemu_isdigit
(
fdname
[
0
]))
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER
,
"fdname"
);
qe
rror_report
(
QERR_INVALID_PARAMETER
,
"fdname"
);
return
-
1
;
}
fd
=
dup
(
fd
);
if
(
fd
==
-
1
)
{
if
(
errno
==
EMFILE
)
qe
mu_error_new
(
QERR_TOO_MANY_FILES
);
qe
rror_report
(
QERR_TOO_MANY_FILES
);
else
qe
mu_error_new
(
QERR_UNDEFINED_ERROR
);
qe
rror_report
(
QERR_UNDEFINED_ERROR
);
return
-
1
;
}
...
...
@@ -2523,7 +2523,7 @@ static int do_closefd(Monitor *mon, const QDict *qdict, QObject **ret_data)
return
0
;
}
qe
mu_error_new
(
QERR_FD_NOT_FOUND
,
fdname
);
qe
rror_report
(
QERR_FD_NOT_FOUND
,
fdname
);
return
-
1
;
}
...
...
@@ -3895,7 +3895,7 @@ static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
* Action: Report an internal error to the client if in QMP.
*/
if
(
monitor_ctrl_mode
(
mon
))
{
qe
mu_error_new
(
QERR_UNDEFINED_ERROR
);
qe
rror_report
(
QERR_UNDEFINED_ERROR
);
}
MON_DEBUG
(
"command '%s' returned failure but did not pass an error
\n
"
,
cmd
->
name
);
...
...
@@ -4218,7 +4218,7 @@ typedef struct CmdArgs {
static
int
check_opt
(
const
CmdArgs
*
cmd_args
,
const
char
*
name
,
QDict
*
args
)
{
if
(
!
cmd_args
->
optional
)
{
qe
mu_error_new
(
QERR_MISSING_PARAMETER
,
name
);
qe
rror_report
(
QERR_MISSING_PARAMETER
,
name
);
return
-
1
;
}
...
...
@@ -4251,7 +4251,7 @@ static int check_arg(const CmdArgs *cmd_args, QDict *args)
case
'B'
:
case
's'
:
if
(
qobject_type
(
value
)
!=
QTYPE_QSTRING
)
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"string"
);
qe
rror_report
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"string"
);
return
-
1
;
}
break
;
...
...
@@ -4262,11 +4262,11 @@ static int check_arg(const CmdArgs *cmd_args, QDict *args)
for
(
i
=
0
;
keys
[
i
];
i
++
)
{
QObject
*
obj
=
qdict_get
(
args
,
keys
[
i
]);
if
(
!
obj
)
{
qe
mu_error_new
(
QERR_MISSING_PARAMETER
,
name
);
qe
rror_report
(
QERR_MISSING_PARAMETER
,
name
);
return
-
1
;
}
if
(
qobject_type
(
obj
)
!=
QTYPE_QINT
)
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"int"
);
qe
rror_report
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"int"
);
return
-
1
;
}
}
...
...
@@ -4276,21 +4276,21 @@ static int check_arg(const CmdArgs *cmd_args, QDict *args)
case
'l'
:
case
'M'
:
if
(
qobject_type
(
value
)
!=
QTYPE_QINT
)
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"int"
);
qe
rror_report
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"int"
);
return
-
1
;
}
break
;
case
'b'
:
case
'T'
:
if
(
qobject_type
(
value
)
!=
QTYPE_QINT
&&
qobject_type
(
value
)
!=
QTYPE_QFLOAT
)
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"number"
);
qe
rror_report
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"number"
);
return
-
1
;
}
break
;
case
'-'
:
if
(
qobject_type
(
value
)
!=
QTYPE_QINT
&&
qobject_type
(
value
)
!=
QTYPE_QBOOL
)
{
qe
mu_error_new
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"bool"
);
qe
rror_report
(
QERR_INVALID_PARAMETER_TYPE
,
name
,
"bool"
);
return
-
1
;
}
if
(
qobject_type
(
value
)
==
QTYPE_QBOOL
)
{
...
...
@@ -4387,10 +4387,10 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
obj
=
json_parser_parse
(
tokens
,
NULL
);
if
(
!
obj
)
{
// FIXME: should be triggered in json_parser_parse()
qe
mu_error_new
(
QERR_JSON_PARSING
);
qe
rror_report
(
QERR_JSON_PARSING
);
goto
err_out
;
}
else
if
(
qobject_type
(
obj
)
!=
QTYPE_QDICT
)
{
qe
mu_error_new
(
QERR_QMP_BAD_INPUT_OBJECT
,
"object"
);
qe
rror_report
(
QERR_QMP_BAD_INPUT_OBJECT
,
"object"
);
qobject_decref
(
obj
);
goto
err_out
;
}
...
...
@@ -4402,17 +4402,17 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
obj
=
qdict_get
(
input
,
"execute"
);
if
(
!
obj
)
{
qe
mu_error_new
(
QERR_QMP_BAD_INPUT_OBJECT
,
"execute"
);
qe
rror_report
(
QERR_QMP_BAD_INPUT_OBJECT
,
"execute"
);
goto
err_input
;
}
else
if
(
qobject_type
(
obj
)
!=
QTYPE_QSTRING
)
{
qe
mu_error_new
(
QERR_QMP_BAD_INPUT_OBJECT
,
"string"
);
qe
rror_report
(
QERR_QMP_BAD_INPUT_OBJECT
,
"string"
);
goto
err_input
;
}
cmd_name
=
qstring_get_str
(
qobject_to_qstring
(
obj
));
if
(
invalid_qmp_mode
(
mon
,
cmd_name
))
{
qe
mu_error_new
(
QERR_COMMAND_NOT_FOUND
,
cmd_name
);
qe
rror_report
(
QERR_COMMAND_NOT_FOUND
,
cmd_name
);
goto
err_input
;
}
...
...
@@ -4421,7 +4421,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
* converted into 'query-' commands
*/
if
(
compare_cmd
(
cmd_name
,
"info"
))
{
qe
mu_error_new
(
QERR_COMMAND_NOT_FOUND
,
cmd_name
);
qe
rror_report
(
QERR_COMMAND_NOT_FOUND
,
cmd_name
);
goto
err_input
;
}
else
if
(
strstart
(
cmd_name
,
"query-"
,
&
info_item
))
{
cmd
=
monitor_find_command
(
"info"
);
...
...
@@ -4430,7 +4430,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
}
else
{
cmd
=
monitor_find_command
(
cmd_name
);
if
(
!
cmd
||
!
monitor_handler_ported
(
cmd
))
{
qe
mu_error_new
(
QERR_COMMAND_NOT_FOUND
,
cmd_name
);
qe
rror_report
(
QERR_COMMAND_NOT_FOUND
,
cmd_name
);
goto
err_input
;
}
}
...
...
@@ -4663,7 +4663,7 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
}
if
(
monitor_ctrl_mode
(
mon
))
{
qe
mu_error_new
(
QERR_DEVICE_ENCRYPTED
,
bdrv_get_device_name
(
bs
));
qe
rror_report
(
QERR_DEVICE_ENCRYPTED
,
bdrv_get_device_name
(
bs
));
return
-
1
;
}
...
...
qemu-error.c
浏览文件 @
ab5b027e
...
...
@@ -44,7 +44,7 @@ void error_printf(const char *fmt, ...)
/*
* Print an error message to current monitor if we have one, else to stderr.
* Appends a newline to the message.
* It's wrong to call this in a QMP monitor. Use qe
mu_error_new
() there.
* It's wrong to call this in a QMP monitor. Use qe
rror_report
() there.
*/
void
error_report
(
const
char
*
fmt
,
...)
{
...
...
@@ -56,8 +56,8 @@ void error_report(const char *fmt, ...)
error_printf
(
"
\n
"
);
}
void
qe
mu_error
_internal
(
const
char
*
file
,
int
linenr
,
const
char
*
func
,
const
char
*
fmt
,
...)
void
qe
rror_report
_internal
(
const
char
*
file
,
int
linenr
,
const
char
*
func
,
const
char
*
fmt
,
...)
{
va_list
va
;
QError
*
qerror
;
...
...
qemu-error.h
浏览文件 @
ab5b027e
...
...
@@ -16,11 +16,11 @@
void
error_vprintf
(
const
char
*
fmt
,
va_list
ap
);
void
error_printf
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
error_report
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
qe
mu_error
_internal
(
const
char
*
file
,
int
linenr
,
const
char
*
func
,
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
4
,
5
)));
void
qe
rror_report
_internal
(
const
char
*
file
,
int
linenr
,
const
char
*
func
,
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
4
,
5
)));
#define qe
mu_error_new
(fmt, ...) \
qe
mu_error
_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
#define qe
rror_report
(fmt, ...) \
qe
rror_report
_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录