qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC][PATCH 3/6] Add support for "bootonceindex" property.


From: Janne Huttunen
Subject: [Qemu-devel] [RFC][PATCH 3/6] Add support for "bootonceindex" property.
Date: Tue, 14 Mar 2017 14:50:10 +0200

The property works just like the "bootindex" property does, but uses
a separate list. When the list of boot devices is queried, the boot
once list is consulted first. The normal list is returned only if the
boot once list is empty.

Signed-off-by: Janne Huttunen <address@hidden>
---
 bootdevice.c            | 11 ++++++++++-
 include/sysemu/sysemu.h |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/bootdevice.c b/bootdevice.c
index 30e98ae..b5515f8 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -48,6 +48,7 @@ struct FWBootEntry {
 };
 
 static FWBootList fw_boot_order = QTAILQ_HEAD_INITIALIZER(fw_boot_order);
+static FWBootList fw_boot_once = QTAILQ_HEAD_INITIALIZER(fw_boot_once);
 static QEMUBootSetHandler *boot_set_handler;
 static void *boot_set_opaque;
 
@@ -240,7 +241,7 @@ char *get_boot_devices_list(size_t *size, bool 
ignore_suffixes)
     size_t total = 0;
     char *list = NULL;
 
-    bootlist = &fw_boot_order;
+    bootlist = QTAILQ_EMPTY(&fw_boot_once) ? &fw_boot_order : &fw_boot_once;
 
     QTAILQ_FOREACH(i, bootlist, link) {
         char *devpath = NULL,  *suffix = NULL;
@@ -373,3 +374,11 @@ void device_add_bootindex_property(Object *obj, int32_t 
*bootindex,
     do_add_bootindex_prop(&fw_boot_order, obj, bootindex,
                           name, suffix, dev, errp);
 }
+
+void device_add_bootonceindex_property(Object *obj, int32_t *bootindex,
+                                       const char *name, const char *suffix,
+                                       DeviceState *dev, Error **errp)
+{
+    do_add_bootindex_prop(&fw_boot_once, obj, bootindex,
+                          name, suffix, dev, errp);
+}
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 576c7ce..9acf2d9 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -214,6 +214,9 @@ void del_boot_device_path(DeviceState *dev, const char 
*suffix);
 void device_add_bootindex_property(Object *obj, int32_t *bootindex,
                                    const char *name, const char *suffix,
                                    DeviceState *dev, Error **errp);
+void device_add_bootonceindex_property(Object *obj, int32_t *bootindex,
+                                       const char *name, const char *suffix,
+                                       DeviceState *dev, Error **errp);
 void restore_boot_order(void *opaque);
 void validate_bootdevices(const char *devices, Error **errp);
 
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]