aboutsummaryrefslogtreecommitdiff
path: root/slof/fs/node.fs
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2011-12-22 13:59:08 +0100
committerThomas Huth <thuth@linux.vnet.ibm.com>2011-12-22 16:59:04 +0100
commit46b5160777477efaeea6aacc6a790581c1da92dc (patch)
tree720db1060a31637451b89e9250f0b33a28ab41d9 /slof/fs/node.fs
parentd249d1b5d3a1fa96ac0af826507459b697b3a775 (diff)
downloadSLOF-46b5160777477efaeea6aacc6a790581c1da92dc.zip
SLOF-46b5160777477efaeea6aacc6a790581c1da92dc.tar.gz
SLOF-46b5160777477efaeea6aacc6a790581c1da92dc.tar.bz2
Fixed yet another bug in open-node
When the "open" method of the target node failed, the open-node function did not correctly restore the previous value of "my-self" (it was using my-parent of the new node to restore the previous value, but that did not work when the new node could not be opened). Now the old value of "my-self" is saved on the return stack instead and then always correctly restored. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Diffstat (limited to 'slof/fs/node.fs')
-rw-r--r--slof/fs/node.fs34
1 files changed, 22 insertions, 12 deletions
diff --git a/slof/fs/node.fs b/slof/fs/node.fs
index 76915e9..d800c41 100644
--- a/slof/fs/node.fs
+++ b/slof/fs/node.fs
@@ -326,18 +326,28 @@ defer find-node
VARIABLE interpose-node
2VARIABLE interpose-args
: interpose ( arg len phandle -- ) interpose-node ! interpose-args 2! ;
-: open-node ( arg len phandle -- ihandle | 0 )
- current-node @ >r set-node create-instance set-my-args
- ( and set unit-addr )
- \ Execute "open" method if available, and assume default of
- \ success (=TRUE) for nodes without open method:
- s" open" get-node find-method IF execute ELSE TRUE THEN
- 0= IF my-self destroy-instance 0 to my-self THEN
- my-self my-parent to my-self r> set-node
- \ Handle interposition.
- interpose-node @ IF my-self >r to my-self
- interpose-args 2@ interpose-node @
- interpose-node off recurse r> to my-self THEN ;
+
+: open-node ( arg len phandle -- ihandle|0 )
+ current-node @ >r my-self >r \ Save current node and instance
+ \ TODO: also set a default unit-addr ?
+ set-node create-instance set-my-args
+ \ Execute "open" method if available, and assume default of
+ \ success (=TRUE) for nodes without open method:
+ s" open" get-node find-method IF execute ELSE TRUE THEN
+ 0= IF
+ my-self destroy-instance 0 to my-self
+ THEN
+ my-self ( ihandle|0 )
+ r> to my-self r> set-node \ Restore current node and instance
+ \ Handle interposition:
+ interpose-node @ IF
+ my-self >r to my-self
+ interpose-args 2@ interpose-node @
+ interpose-node off recurse
+ r> to my-self
+ THEN
+;
+
: close-node ( ihandle -- )
my-self >r to my-self
s" close" ['] $call-my-method CATCH IF 2drop THEN