Commits


allow directory to be read again using offset 0 The documentation says explicitly that the offset is *either* 0 or the last offset plus count; that means that after some read a client can require *again* an offset 0 (i.e. doing a rewinding the directory.)


implement Tread against directories To do so it was needed to modify the np_* functions so they take an explicit evbuffer.


PATH_MAX already accounts for NUL


free evp only if it was allocated apparently, evbuffer_free doesn't like NULLs


typo spotted by cage, thanks!


initialize evbuffer only for dirs


first half of the tread implementation done, no new tests yet


allow opening directories (for reading only)


fix walk fid check: look at fd not iomode to see if it was opened


ensure we don't call openat(2) with "" as path


fix Tattach handling The previous implementation assumed that you can't attach more than once. This is clearly wrong, Tattach and Twalk are the two ways to obtain new fids. This drops the error on subsequential attach and making the test "multiple attach" passes.


don't let nwqid become negative at the start of the loop nwqid is 0, so if the first component can't be opened nwqid becomes -1 and since it's not 0, we end up calling np_walk with -1 as length. This in turns converts it back to uint16_t and we generate an invalid packet. The solution is to not decrement nwqid at all, it fixes all the current tests case and is the correct behaviour that the rest of the code expects.


Twalk: validate path component disallow empty path, the dot or components which contains the path separator ('/'). The current implementation transforms these into a "can't open" type of failure, I'm unsure if we want to turn these into hard Rerror.


Topen implemented Implement Topen plus some basic testing. ORCLOSE (remove file when the fid is clunked) is mapped to O_CLOEXEC and tried to be honoured on fid_free. "vanilla" 9P2000 uses reads on directories to list the entries while 9P2000.L (and .U too possibly) introduces an explicit Treaddir. I'm planning to support 9P2000-style read-on-dir but not yet.


initialize to -1 fid' fd