diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-10-07 16:00:07 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-10-15 09:49:48 +0200 |
commit | 9d27572d626be35aea079df1ea690215fea0598a (patch) | |
tree | b568413095fa1897595f7b2e9a47f03c0dd885ee /bootdevice.c | |
parent | 694fb857abd770db623b6df5475291797b86187c (diff) | |
download | qemu-9d27572d626be35aea079df1ea690215fea0598a.zip qemu-9d27572d626be35aea079df1ea690215fea0598a.tar.gz qemu-9d27572d626be35aea079df1ea690215fea0598a.tar.bz2 |
bootindex: add del_boot_device_path function
Introduce del_boot_device_path() to clean up fw_cfg content when
hot-unplugging a device that refers to a bootindex or update a
existent devcie's bootindex.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'bootdevice.c')
-rw-r--r-- | bootdevice.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bootdevice.c b/bootdevice.c index f5399df..7167fbc 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -51,6 +51,26 @@ void check_boot_index(int32_t bootindex, Error **errp) } } +void del_boot_device_path(DeviceState *dev, const char *suffix) +{ + FWBootEntry *i; + + if (dev == NULL) { + return; + } + + QTAILQ_FOREACH(i, &fw_boot_order, link) { + if ((!suffix || !g_strcmp0(i->suffix, suffix)) && + 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) { |