[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 05/30] bootindex: rework add_boot_device_path fun
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v9 05/30] bootindex: rework add_boot_device_path function |
Date: |
Wed, 10 Sep 2014 20:31:01 +0800 |
From: Gonglei <address@hidden>
Add the function of updating bootindex about fw_boot_order list
in add_boot_device_path(). We should delete the old one if a
device has existed in global fw_boot_order list.
Signed-off-by: Gonglei <address@hidden>
---
bootdevice.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/bootdevice.c b/bootdevice.c
index 89aca7f..628596d 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -72,6 +72,25 @@ void del_boot_device_path(DeviceState *dev)
}
}
+static void del_original_boot_device(DeviceState *dev, const char *suffix)
+{
+ FWBootEntry *i;
+
+ if (dev == NULL) {
+ return;
+ }
+
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ if (i->dev == dev && !g_strcmp0(i->suffix, suffix)) {
+ 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)
{
@@ -83,6 +102,8 @@ void add_boot_device_path(int32_t bootindex, DeviceState
*dev,
assert(dev != NULL || suffix != NULL);
+ del_original_boot_device(dev, suffix);
+
node = g_malloc0(sizeof(FWBootEntry));
node->bootindex = bootindex;
node->suffix = g_strdup(suffix);
--
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, 2014/09/10
- [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 <=
- [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
- [Qemu-devel] [PATCH v9 14/30] spapr_lian: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 10/30] eepro100: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 15/30] vmxnet3: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 09/30] e1000: add bootindex to qom property, arei.gonglei, 2014/09/10