4 ms·
In general, 9P2000 is simple and fairly elegant. If you don't need POSIX semantics (and fs metadata), it's really quite simple to implement. For a bit more cost
by jsolson 6y ago
In general, 9P2000 is simple and fairly elegant. If you don't need POSIX semantics (and fs metadata), it's really quite simple to implement. For a bit more cost in terms of complexity you can go for 9P2000.u which makes things POSIXy enough if you've got a single client (as you do with VM -> host). This is great if you want to provide virtual filesystems, either proxied from the host or backed by something more exotic. In addition to QEMU, the gVisor folks (https://gvisor.dev/ https://gvisor.dev/) have made heavy use of 9P (with enhancements) for similar reasons (in addition to Google being generally populated with Plan 9 aficionados).
Then, there's 9P2000.L... This has that "let's just take the filesystem vtable and export it as a protocol" flavor. This works well enough on Linux if you're just looking to translate the calls over into syscalls. I wouldn't recommend implementing a bespoke server for it, though. You're better off just implementing things with FUSE.