[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 2/7] bootindex: add del_boot_device_path function
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v3 2/7] bootindex: add del_boot_device_path function |
Date: |
Sat, 26 Jul 2014 12:45:28 +0800 |
From: Gonglei <address@hidden>
Introduce a del_boot_device_path() cleanup fw_cfg content
when hot-unplugging devcie refer to bootindex.
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Chenliang <address@hidden>
---
include/sysemu/sysemu.h | 1 +
vl.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index e1b0659..7a79ff4 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);
char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
diff --git a/vl.c b/vl.c
index 3e42eaa..0cdadb4 100644
--- a/vl.c
+++ b/vl.c
@@ -1248,6 +1248,23 @@ void add_boot_device_path(int32_t bootindex, DeviceState
*dev,
QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
}
+void del_boot_device_path(DeviceState *dev)
+{
+ FWBootEntry *i;
+
+ assert(dev != NULL);
+
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ if (i->dev->id && dev->id && !strcmp(i->dev->id, dev->id)) {
+ /* remove all entries of the assigend 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)
{
--
1.7.12.4
- [Qemu-devel] [PATCH v3 0/7] modify boot order of guest, and take effect after rebooting, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 4/7] bootindex: delete bootindex when device is removed, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 5/7] qmp: add set-bootindex command, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 1/7] bootindex: add modify_boot_device_path function, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 2/7] bootindex: add del_boot_device_path function,
arei.gonglei <=
- [Qemu-devel] [PATCH v3 3/7] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 7/7] spapr: fix possible memory leak, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 6/7] qemu-monitor: HMP set-bootindex wrapper, arei.gonglei, 2014/07/26