Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
8bc27249
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8bc27249
编写于
2月 10, 2010
作者:
M
Markus Armbruster
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
monitor: convert do_device_add() to QObject
上级
c7e4e8ce
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
10 deletion
+37
-10
hw/qdev.c
hw/qdev.c
+34
-8
hw/qdev.h
hw/qdev.h
+1
-1
qemu-monitor.hx
qemu-monitor.hx
+2
-1
未找到文件。
hw/qdev.c
浏览文件 @
8bc27249
...
...
@@ -586,7 +586,9 @@ static BusState *qbus_find(const char *path)
dev
=
qbus_find_dev
(
bus
,
elem
);
if
(
!
dev
)
{
qerror_report
(
QERR_DEVICE_NOT_FOUND
,
elem
);
qbus_list_dev
(
bus
);
if
(
!
monitor_cur_is_qmp
())
{
qbus_list_dev
(
bus
);
}
return
NULL
;
}
...
...
@@ -605,7 +607,9 @@ static BusState *qbus_find(const char *path)
return
QLIST_FIRST
(
&
dev
->
child_bus
);
default:
qerror_report
(
QERR_DEVICE_MULTIPLE_BUSSES
,
elem
);
qbus_list_bus
(
dev
);
if
(
!
monitor_cur_is_qmp
())
{
qbus_list_bus
(
dev
);
}
return
NULL
;
}
}
...
...
@@ -619,7 +623,9 @@ static BusState *qbus_find(const char *path)
bus
=
qbus_find_bus
(
dev
,
elem
);
if
(
!
bus
)
{
qerror_report
(
QERR_BUS_NOT_FOUND
,
elem
);
qbus_list_bus
(
dev
);
if
(
!
monitor_cur_is_qmp
())
{
qbus_list_bus
(
dev
);
}
return
NULL
;
}
}
...
...
@@ -762,16 +768,36 @@ void do_info_qdm(Monitor *mon)
}
}
void
do_device_add
(
Monitor
*
mon
,
const
QDict
*
qdict
)
/**
* do_device_add(): Add a device
*
* Argument qdict contains
* - "driver": the name of the new device's driver
* - "bus": the device's parent bus (device tree path)
* - "id": the device's ID (must be unique)
* - device properties
*
* Example:
*
* { "driver": "usb-net", "id": "eth1", "netdev": "netdev1" }
*/
int
do_device_add
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
)
{
QemuOpts
*
opts
;
opts
=
qemu_opts_from_qdict
(
&
qemu_device_opts
,
qdict
);
if
(
opts
)
{
if
(
qdev_device_help
(
opts
)
||
qdev_device_add
(
opts
)
==
NULL
)
{
qemu_opts_del
(
opts
);
}
if
(
!
opts
)
{
return
-
1
;
}
if
(
!
monitor_cur_is_qmp
()
&&
qdev_device_help
(
opts
))
{
qemu_opts_del
(
opts
);
return
0
;
}
if
(
!
qdev_device_add
(
opts
))
{
qemu_opts_del
(
opts
);
return
-
1
;
}
return
0
;
}
void
do_device_del
(
Monitor
*
mon
,
const
QDict
*
qdict
)
...
...
hw/qdev.h
浏览文件 @
8bc27249
...
...
@@ -175,7 +175,7 @@ void qbus_free(BusState *bus);
void
do_info_qtree
(
Monitor
*
mon
);
void
do_info_qdm
(
Monitor
*
mon
);
void
do_device_add
(
Monitor
*
mon
,
const
QDict
*
qdict
);
int
do_device_add
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
);
void
do_device_del
(
Monitor
*
mon
,
const
QDict
*
qdict
);
/*** qdev-properties.c ***/
...
...
qemu-monitor.hx
浏览文件 @
8bc27249
...
...
@@ -573,7 +573,8 @@ ETEXI
.args_type = "device:O",
.params = "driver[,prop=value][,...]",
.help = "add device, like -device on the command line",
.mhandler.cmd = do_device_add,
.user_print = monitor_user_noop,
.mhandler.cmd_new = do_device_add,
},
STEXI
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录