Pure Erlang implementation of 9p2000 protocol
filesystem fs 9p2000 erlang 9p

Conform to 9p specs when walking through directories

First step must always succeed, otherwise return error. Subsequent steps
can end without failure.

hauleth.dev 03d53e06 e8ab7c8c

verified
+6 -1
+6 -1
src/e9p_fs.erl
··· 8 8 9 9 -export([ 10 10 init/1, 11 - root/2, 11 + root/3, 12 12 walk/3, 13 13 open/3, 14 14 create/5, ··· 121 121 {ok, {QID, lists:reverse(Acc)}, State}; 122 122 do_walk(Mod, QID0, [P | Rest], State0, Acc) -> 123 123 case Mod:walk(QID0, P, State0) of 124 + {false, State} when Acc =:= [] -> 125 + % Per specification walk to first entry in name list must succeed 126 + % (if any) otherwise return error. In subsequent steps we return 127 + % successful list and last succeeded QID 128 + {error, io_lib:format("Failed walk to ~p", [P]), State}; 124 129 {false, State} -> 125 130 {ok, {QID0, lists:reverse(Acc)}, State}; 126 131 {QID, State} ->