[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function |
Date: |
Mon, 4 Aug 2014 20:46:16 +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>
---
include/sysemu/sysemu.h | 1 +
vl.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 06e1b72..130f971 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -209,6 +209,7 @@ void usb_info(Monitor *mon, const QDict *qdict);
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
const char *suffix);
+void del_boot_device_path(DeviceState *dev);
void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
const char *suffix, Error **errp);
char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
diff --git a/vl.c b/vl.c
index 770ad67..2424135 100644
--- a/vl.c
+++ b/vl.c
@@ -1263,6 +1263,26 @@ static bool is_same_fw_dev_path(DeviceState *src,
DeviceState *dst)
return ret;
}
+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->id && dev->id &&
+ !strcmp(i->dev->id, dev->id)) ||
+ (!i->dev->id && is_same_fw_dev_path(i->dev, dev))) {
+ QTAILQ_REMOVE(&fw_boot_order, i, link);
+ g_free(i->suffix);
+ g_free(i);
+
+ break;
+ }
+ }
+}
+
void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
const char *suffix, Error **errp)
{
--
1.7.12.4
- [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 5/8] qmp: add set-bootindex command, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function,
arei.gonglei <=
- [Qemu-devel] [PATCH v5 4/8] bootindex: delete bootindex when device is removed, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 3/8] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 7/8] qmp: add query-bootindex command, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 8/8] qemu-monitor: add HMP "info-bootindex" command, arei.gonglei, 2014/08/04
- [Qemu-devel] [PATCH v5 6/8] qemu-monitor: HMP set-bootindex wrapper, arei.gonglei, 2014/08/04
- Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting, Gonglei (Arei), 2014/08/04
- Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting, Gonglei (Arei), 2014/08/07