summaryrefslogtreecommitdiffstats
path: root/bootdevice.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-10-07 16:00:06 +0800
committerGerd Hoffmann <kraxel@redhat.com>2014-10-15 09:49:48 +0200
commit694fb857abd770db623b6df5475291797b86187c (patch)
treec3b8381b876c001be446d93541dacd0b682992ba /bootdevice.c
parentbc74112f7e857a662b1802145ca4cb9230de2f5c (diff)
downloadhqemu-694fb857abd770db623b6df5475291797b86187c.zip
hqemu-694fb857abd770db623b6df5475291797b86187c.tar.gz
bootindex: add check bootindex function
Determine whether a given bootindex exists or not. If exists, we report an error. Signed-off-by: Gonglei <arei.gonglei@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.c15
1 files changed, 15 insertions, 0 deletions
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)
{
OpenPOWER on IntegriCloud