qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 7/8] qmp: add filtering of statistics by name


From: Markus Armbruster
Subject: Re: [PATCH 7/8] qmp: add filtering of statistics by name
Date: Wed, 25 May 2022 09:49:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 5/24/22 15:08, Markus Armbruster wrote:
>>> -typedef void SchemaRetrieveFunc(StatsSchemaList **result, Error **errp);
>>> +                              strList *names, strList *targets, Error 
>>> **errp);
>>> +typedef void SchemaRetrieveFunc(StatsSchemaList **, Error **);
>>
>> Did you drop the parameter names intentionally? 
>
> No, I didn't.

Easy enough to revert :)

>>> +                    /* No names allowed is the same as skipping the 
>>> provider.  */
>>
>> Long line.
>> 
>>> +                    return false;
>>
>> Any other elements of filter->providers that match @provider will be
>> silently ignored.  Is this what you want?
>
> Hmm, key/value pairs are ugly in QMP.

Funny, considering what JSON objects are, isn't it?

Ways to do maps in QMP:

1. You can always use a JSON array of objects.  Any combination of
members can be a key.  Any semantic constaint "keys are unique" you get
to enforce manually.

2. If the key is a string, you can use a JSON object.

In either case, you may or may not be able to define a compile-time
static schema.  If you are, then 1.'s schema can be ['UnionType'], where
the key is in the UnionType's base, and 2.'s can be a struct with
optional members.  Else, you get to play with 'any', I guess.

> I'll see if I can make it work nicely without inlining 
> stats_provider_requested() in the caller.
>
>> Uh, do we leak @p_names if earlier elements matched?
>
> No, it's not copied so there are no leaks.




reply via email to

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