qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 02/10] Common: Add quick access to first boot de


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 02/10] Common: Add quick access to first boot device
Date: Fri, 26 Apr 2013 11:37:18 -0500
User-agent: Notmuch/0.15.2+77~g661dcf8 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)

Dominik Dingel <address@hidden> writes:

> 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 <address@hidden>
>

Reviewed-by: Anthony Liguori <address@hidden>

Regards,

Anthony Liguori

> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 6578782..43b961c 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -181,6 +181,8 @@ void add_boot_device_path(int32_t bootindex, DeviceState 
> *dev,
>                            const char *suffix);
>  char *get_boot_devices_list(size_t *size);
>  
> +DeviceState *get_boot_device(uint32_t position);
> +
>  bool usb_enabled(bool default_usb);
>  
>  extern QemuOptsList qemu_drive_opts;
> diff --git a/vl.c b/vl.c
> index 84d7031..429e6ea 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1247,6 +1247,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.
> -- 
> 1.7.9.5



reply via email to

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