diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-11-30 14:49:57 +0100 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-12-20 17:56:48 +0100 |
commit | e79c624cddb09c6051ae3682269058ef02fe386e (patch) | |
tree | b91524a0bb4f8b2702bb2c8407f6add543aee1e5 | |
parent | e977f3e512684a7ed70156023c269b7f3ea01c20 (diff) | |
download | SLOF-e79c624cddb09c6051ae3682269058ef02fe386e.zip SLOF-e79c624cddb09c6051ae3682269058ef02fe386e.tar.gz SLOF-e79c624cddb09c6051ae3682269058ef02fe386e.tar.bz2 |
Print phandle when listing the device tree
Printing the phandle of each node is quite handy when searching for a specific
phandle value.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
-rw-r--r-- | slof/fs/node.fs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/slof/fs/node.fs b/slof/fs/node.fs index 6b8f03a..7e1bed2 100644 --- a/slof/fs/node.fs +++ b/slof/fs/node.fs @@ -295,13 +295,27 @@ defer find-node : +indent ( not-last? -- ) IF s" | " ELSE s" " THEN $indent indent @ + swap move 4 indent +! ; : -indent ( -- ) -4 indent +! ; + +: ls-phandle ( node -- ) . ." : " ; + : ls-node ( node -- ) - cr $indent indent @ type - dup peer IF ." |-- " ELSE ." +-- " THEN node>qname type ; + cr dup ls-phandle + $indent indent @ type + dup peer IF ." |-- " ELSE ." +-- " THEN + node>qname type +; + : (ls) ( node -- ) child BEGIN dup WHILE dup ls-node dup child IF dup peer +indent dup recurse -indent THEN peer REPEAT drop ; -: ls ( -- ) get-node dup cr node>path type (ls) 0 indent ! ; + +: ls ( -- ) + get-node cr + dup ls-phandle + dup node>path type + (ls) + 0 indent ! +; : show-devs ( {device-specifier}<eol> -- ) skipws 0 parse dup IF de-alias ELSE 2drop s" /" THEN ( str len ) |