[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 03/30] bootindex: add del_boot_device_path functi
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v9 03/30] bootindex: add del_boot_device_path function |
Date: |
Wed, 10 Sep 2014 20:30:59 +0800 |
From: Gonglei <address@hidden>
Introduce del_boot_device_path() to clean up fw_cfg content when
hot-unplugging a device that refers to a bootindex.
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Chenliang <address@hidden>
---
bootdevice.c | 21 +++++++++++++++++++++
include/sysemu/sysemu.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/bootdevice.c b/bootdevice.c
index f5399df..89aca7f 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -51,6 +51,27 @@ void check_boot_index(int32_t bootindex, Error **errp)
}
}
+void del_boot_device_path(DeviceState *dev)
+{
+ FWBootEntry *i;
+
+ assert(dev != NULL);
+
+ /* remove all entries of the assigned device */
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ if (i->dev == NULL) {
+ continue;
+ }
+ if (i->dev == dev) {
+ QTAILQ_REMOVE(&fw_boot_order, i, link);
+ g_free(i->suffix);
+ g_free(i);
+
+ break;
+ }
+ }
+}
+
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
const char *suffix)
{
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 72463de..10cd573 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -214,6 +214,7 @@ char *get_boot_devices_list(size_t *size, bool
ignore_suffixes);
DeviceState *get_boot_device(uint32_t position);
void check_boot_index(int32_t bootindex, Error **errp);
+void del_boot_device_path(DeviceState *dev);
QemuOpts *qemu_get_machine_opts(void);
--
1.7.12.4
- [Qemu-devel] [PATCH v9 00/30] modify boot order of guest, and take effect after rebooting, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 02/30] bootindex: add check bootindex function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 03/30] bootindex: add del_boot_device_path function,
arei.gonglei <=
- [Qemu-devel] [PATCH v9 01/30] bootdevice: move bootdevice related code to new file bootdevice.c, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 06/30] bootindex: support to set a existent device's bootindex to -1, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 07/30] bootindex: add a setter/getter functions wrapper for bootindex property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 05/30] bootindex: rework add_boot_device_path function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 08/30] virtio-net: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 04/30] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 12/30] pcnet: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 13/30] rtl8139: add bootindex to qom property, arei.gonglei, 2014/09/10