qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.5] block: make 'stats-intervals' a list of


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH for-2.5] block: make 'stats-intervals' a list of integers
Date: Wed, 11 Nov 2015 08:32:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/11/2015 06:17 AM, Alberto Garcia wrote:
> This is the natural JSON representation and prevents us from having to
> decode the list manually.
> 
> Signed-off-by: Alberto Garcia <address@hidden>
> ---
>  blockdev.c             | 64 
> ++++++++++++++++++++++++++++++++++----------------
>  qapi/block-core.json   |  7 +++---
>  tests/qemu-iotests/136 |  2 +-
>  3 files changed, 48 insertions(+), 25 deletions(-)
> 

> +        for (entry = qlist_first(interval_list); entry;
> +             entry = qlist_next(entry)) {
> +            unsigned length;
> +            switch (qobject_type(entry->value)) {
>  
> -            if (*stats_intervals == '\0') {
> -                error_setg(&error, "stats-intervals can't have an empty 
> value");
> -            }
> -
> -            for (i = 0; !error && intervals[i] != NULL; i++) {
> +            case QTYPE_QSTRING: {

> +            case QTYPE_QINT: {

Why are we accepting both string and int here, but typing it as 'int' in
qapi?  I guess its due to how command line parsing passes in strings
rather than ints?

But that should be okay.

Reviewed-by: Eric Blake <address@hidden>

We may eventually want to add an alternate type that takes both int and
string from QMP (parsing the port number of server addresses is another
spot that could benefit from such an alternate), but that's a project
for 2.6.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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