allow using labels with fdtget/fdtput#150
Conversation
|
nice |
|
Sorry, finally looking at this after far too long. The description of the first patch is misleading. Although, yes, this does allow use of I'm happy enough to allow the new feature for fdtget/fdtput. I'm much more hesitant to change the path semantics for every libfdt application. Especially since IEEE1275 already includes aliases as a mechanism for shortening paths (the entire creation of I'd prefer to see this reworked to add this explicitly as a feature for fdtput and fdtget only. A helper function to look up symbols in libfdt would be fine (which should share most of its code with the alias lookup path), but it should be invoked explicitly, not used for all path lookups. |
|
Well, first of all, that would be massively more complicated, as essentially all code paths ("subcommands" if you will) in the fdtget/fdtput utils would need to be taught to use a new helper. But more than that, I really intend for this to actually work for all users of libfdt - today I might have my logic in shell scripts caling fdtget/fdtput, but if I ever change that to a Python script because that ends up being nicer, I'd expect to still be able to use the same path spec via the python bindings to libfdt. |
Ok, that's a reasonable position, but the commit message needs to pitch it as such, not describe it purely in terms of the effect on fdtget/fdtput. I'm continuing to think about whether generally extending the path syntax in this way is ok. One basic requirement is that it's not ambiguous with existing syntax. That would arise if it was possible to have an alias beginning with However IEEE1275 does not forbid |
When using the CLI tools fdtget and fdtput, or other tools built on top of libfdt (such as perhaps scripts written in Python), it can be convenient to refer to a node by a label rather than having to know the full path from the root. Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
We obviously need to build some dtbs with -@ to do these tests. In order to still test all the old functionality on blobs built without -@, simply run all fdtget/fdtput tests twice, with/without -@, and for the few new test cases that rely on -@, check that they fail when the blob is not built with -@. Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
|
I've updated the commit message to talk more generally about tools using libfdt. |
It can be convenient and more readable to use
&labelsyntax withfdtgetandfdtput, rather than having to know the full path. This small series adds that support by hooking intofdt_path_offset_namelen()in the same place where we already allow the first component to be an alias. Of course this only works for blobs that have been built with-@, but it shouldn't affect existing use cases.[This is a re-opening of #89 which I managed to implicitly close in the process of rebasing the branch to current main.]