[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 02/30] bootindex: add check bootindex function
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v8 02/30] bootindex: add check bootindex function |
Date: |
Wed, 10 Sep 2014 20:03:56 +0800 |
From: Gonglei <address@hidden>
Determine whether a given bootindex exists or not.
If exists, we report an error.
Signed-off-by: Gonglei <address@hidden>
---
bootdevice.c | 15 +++++++++++++++
include/sysemu/sysemu.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/bootdevice.c b/bootdevice.c
index d5b8789..f5399df 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -36,6 +36,21 @@ struct FWBootEntry {
static QTAILQ_HEAD(, FWBootEntry) fw_boot_order =
QTAILQ_HEAD_INITIALIZER(fw_boot_order);
+void check_boot_index(int32_t bootindex, Error **errp)
+{
+ FWBootEntry *i;
+
+ if (bootindex >= 0) {
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ if (i->bootindex == bootindex) {
+ error_setg(errp, "The bootindex %d has already been used",
+ bootindex);
+ return;
+ }
+ }
+ }
+}
+
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 8de5100..72463de 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -213,6 +213,7 @@ void add_boot_device_path(int32_t bootindex, DeviceState
*dev,
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);
QemuOpts *qemu_get_machine_opts(void);
--
1.7.12.4
- [Qemu-devel] [PATCH v8 00/30] modify boot order of guest, and take effect after rebooting, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 01/30] bootdevice: move bootdevice related code to new file bootdevice.c, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 03/30] bootindex: add del_boot_device_path function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 02/30] bootindex: add check bootindex function,
arei.gonglei <=
- [Qemu-devel] [PATCH v8 08/30] virtio-net: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 04/30] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 06/30] bootindex: support to set a existent device's bootindex to -1, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 05/30] bootindex: rework add_boot_device_path function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 09/30] e1000: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 15/30] vmxnet3: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 10/30] eepro100: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 18/30] virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 16/30] usb-net: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v8 19/30] host-libusb: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/10