On Fri, 8 Sept 2023 at 13:22, Kevin Wolf <kw...@redhat.com> wrote: > > Am 08.09.2023 um 11:53 hat Peter Maydell geschrieben: > > On Fri, 8 Sept 2023 at 10:26, Kevin Wolf <kw...@redhat.com> wrote: > > > I have a patch to use QList (i.e. JSON lists) that seems to work for the > > > rocker case. Now I need to find and update all of those internal > > > callers. Should grepping for '"len-' find all instances that need to be > > > changed or are you aware of other ways to access the feature? > > > > AFAIK the only way to use the feature is to set the len-foo and > > then foo[0], foo[1], ... properties, using any of the usual APIs. > > So git grep '\<len-[^-]' should find them all. > > > > If you want a cross-check, the devices that use it are easy > > to find (search for DEFINE_PROP_ARRAY), and almost all of them > > picked property names that are easy to grep for. > > > > But as Daniel says, if you haven't changed the behaviour for > > "code sets the properties in the right order" they may not > > need updating. > > I'm replacing the 'len-foo' and 'foo[0]' etc. properties with a single > 'foo' property that takes a list, so the callers need to be adjusted. > The devices can stay unchanged, though. > > > (I would be happy to see the rather hacky implementation replaced > > with true support for list properties at the qom/qdev level. > > But the hack is there because it was simpler :-)) > > It's not really that hard, but it would probably have been even easier > if we had just used the list support in the visitor interface from the > beginning instead of adding this hack. (Though obviously that wouldn't > have worked for user creatable devices before we added JSON support to > -device.)
If you'd suggested it back in 2013 I'd have been happy to do array properties a different way :-) thanks -- PMM