diff options
author | Dominik Dingel <dingel@linux.vnet.ibm.com> | 2013-04-26 02:12:49 +0000 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-04-26 20:18:24 +0200 |
commit | 7dc5af5545bb72e1343cc959b3f0e5cdd8758f1f (patch) | |
tree | fd4d335c9a8454fcb8fc617e4e5e79bcd785a0b6 /vl.c | |
parent | ba747cc8f31a1de7e0a20e7f0cf97965be338e70 (diff) |
Common: Add quick access to first boot device
Instead of manually parsing the boot_list as character stream,
we can access the nth boot device, specified by the position in the
boot order.
Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1222,6 +1222,24 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev, QTAILQ_INSERT_TAIL(&fw_boot_order, node, link); } +DeviceState *get_boot_device(uint32_t position) +{ + uint32_t counter = 0; + FWBootEntry *i = NULL; + DeviceState *res = NULL; + + if (!QTAILQ_EMPTY(&fw_boot_order)) { + QTAILQ_FOREACH(i, &fw_boot_order, link) { + if (counter == position) { + res = i->dev; + break; + } + counter++; + } + } + return res; +} + /* * This function returns null terminated string that consist of new line * separated device paths. |