Re: [PATCH 08/10] qemu-replies-tool: Add mode to dump all QMP schema query strings

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

 



On Thu, Jan 25, 2024 at 10:03:52 -0800, Andrea Bolognani wrote:
> On Tue, Jan 16, 2024 at 05:12:42PM +0100, Peter Krempa wrote:
> > +# Recursively traverse the schema and print out the schema query strings for
> > +# the corresponding entries. In certain cases the schema references itself,
> > +# which is handled by passing a 'trace' list which contains the current path
> > +def dump_qmp_probe_strings_iter(name, cur, trace, schema):
> > +    obj = schema[name]
> > +
> > +    if name in trace:
> > +        print('%s (recursion)' % cur)
> > +        return
> 
> I'll openly admit that I'm pretty much completely unfamiliar with
> this specific query DLS, so it might be a silly question, but what's
> the use of printing this line? AFAICT it's just the line above it,
> with ' (recursion)' appended. Wouldn't it make sense to skip it?

This line isn't in fact a valid query even. In the query language we
don't care about the infinitely nesting types and you theoretically can
query arbitrarily deep into the recursion.

For the dumper it obviously is a problem as it has to find all
possibilities.

So it might be confusing for anyone looking for a query string, but on
the other hand it's useful when comparing two qemu versions against each
other.

Additionally IIRC (I've wrote this code some time ago already) it's
needed to display the name of the entry, so that e.g. you know that the
object has a member named that way even if it refers to a part of the
schema that was already traversed.

> 
> Other than that, the implementation looks sensible, though I might
> have overlooked some subtlety because of the aforementioned
> unfamiliarity.
> 
> -- 
> Andrea Bolognani / Red Hat / Virtualization
> 
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux