aboutsummaryrefslogtreecommitdiff
path: root/slof/fs/node.fs
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-05-13 11:04:29 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-05-13 11:13:14 +1000
commitd285aed0993cf94b7c38f60411354ac08f29abf4 (patch)
treef96b9cd982ce7ba771561b15ce05cf97efe58117 /slof/fs/node.fs
parentf2199038bf4acd01c2421604671e891911e3188c (diff)
downloadSLOF-d285aed0993cf94b7c38f60411354ac08f29abf4.zip
SLOF-d285aed0993cf94b7c38f60411354ac08f29abf4.tar.gz
SLOF-d285aed0993cf94b7c38f60411354ac08f29abf4.tar.bz2
Fix instance>path to contain unit address for wildcard nodes
instance>path (and instance>qpath) which are used among others by the client interface "instance-to-path" are broken when dealing with wildcard nodes (node with no unit address which obtain one when opened). This fixes this by properly using the instance address when building instance path. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'slof/fs/node.fs')
-rw-r--r--slof/fs/node.fs28
1 files changed, 25 insertions, 3 deletions
diff --git a/slof/fs/node.fs b/slof/fs/node.fs
index 437f765..5877ded 100644
--- a/slof/fs/node.fs
+++ b/slof/fs/node.fs
@@ -216,6 +216,22 @@ CREATE $indent 100 allot VARIABLE indent 0 indent !
THEN
;
+: $cat-instance-unit
+ dup parent 0= IF drop EXIT THEN
+ dup instance>#units 0= IF drop EXIT THEN
+ dup >r push-my-self
+ ['] my-unit CATCH IF pop-my-self r> drop EXIT THEN
+ pop-my-self
+ s" encode-unit"
+ r> ihandle>phandle parent
+ $call-static
+ dup IF
+ dup >r here swap move s" @" $cat here r> $cat
+ ELSE
+ 2drop
+ THEN
+;
+
\ Getting basic info about a node.
: node>name dup >r s" name" rot get-property IF r> (u.) ELSE 1- r> drop THEN ;
: node>qname dup node>name rot ['] $cat-unit CATCH IF drop THEN ;
@@ -238,9 +254,15 @@ CREATE $indent 100 allot VARIABLE indent 0 indent !
\ open-dev and friends, if there were no interposition.
dup instance>parent @ dup 0= IF 2drop false EXIT THEN
ihandle>phandle swap ihandle>phandle parent <> ;
-: instance>qname dup >r interposed? IF s" %" ELSE 0 0 THEN
- r@ ihandle>phandle node>qname $cat r> instance>args 2@
- dup IF 2>r s" :" $cat 2r> $cat ELSE 2drop THEN ;
+
+: instance>qname
+ dup >r interposed? IF s" %" ELSE 0 0 THEN
+ r@ dup ihandle>phandle node>name
+ rot ['] $cat-instance-unit CATCH IF drop THEN
+ $cat r> instance>args 2@
+ dup IF 2>r s" :" $cat 2r> $cat ELSE 2drop THEN
+;
+
: instance>qpath \ With interposed nodes.
here 0 rot BEGIN dup WHILE dup instance>parent @ REPEAT 2drop
dup 0= IF [char] / c, THEN