提交 ef80b466 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

store a pointer to QemuOpts in DeviceState, release it when zapping a device.

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 7101174e
...@@ -218,6 +218,7 @@ DeviceState *qdev_device_add(QemuOpts *opts) ...@@ -218,6 +218,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
qdev_free(qdev); qdev_free(qdev);
return NULL; return NULL;
} }
qdev->opts = opts;
return qdev; return qdev;
} }
...@@ -276,6 +277,8 @@ void qdev_free(DeviceState *dev) ...@@ -276,6 +277,8 @@ void qdev_free(DeviceState *dev)
qemu_unregister_reset(dev->info->reset, dev); qemu_unregister_reset(dev->info->reset, dev);
if (dev->info->exit) if (dev->info->exit)
dev->info->exit(dev); dev->info->exit(dev);
if (dev->opts)
qemu_opts_del(dev->opts);
} }
QLIST_REMOVE(dev, sibling); QLIST_REMOVE(dev, sibling);
qemu_free(dev); qemu_free(dev);
......
...@@ -29,6 +29,7 @@ enum DevState { ...@@ -29,6 +29,7 @@ enum DevState {
struct DeviceState { struct DeviceState {
const char *id; const char *id;
enum DevState state; enum DevState state;
QemuOpts *opts;
int hotplugged; int hotplugged;
DeviceInfo *info; DeviceInfo *info;
BusState *parent_bus; BusState *parent_bus;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册