Hi,
2015-06-05 12:57 keltezéssel, Gerd Hoffmann írta:
Yeah, I've already hit a problem. The opts_visitor doesn't really handle
nested structs (it just flattens it into a single, non hierarchic
namespace), which is a problem because of the input and output options.
First I need to make them required (the in and out in Audiodev) if I
want the current visitor to visit them at all, but it's still not enough.
I think we should improve the visitor instead of making in & out
mandatory just because the current implementation (which simply
implements the stuff needed for Netdev) can't handle it.
It's not that simple I think. The visit_optional only receives a field
name, but no info about the type of the field, but it has to decide if
it wants the field using only this info. So sort of hacking an if
(strcmp(name, "in") == 0 || strcmp(name, "out") == 0) ... into the
option visitor code, the only way is probably to add a type parameter to
visit_optional (struct/union/uint32/whatever) and in the opts visitor if
type is struct or union, force visiting it. Is it ok?
There is always the option to be more specific (in.frequency=...) if
setting all parameters named 'frequency' doesn't do what you want. Also
I wouldn't worry too much about possible cases which don't exist right
now. I'd suggest to go for (0).
Alright.
Thanks,
Zoltan