1. 16
  1.  

  2. 6

    Author here.

    I wanted to make this for a few reasons:

    • I noticed no one had implemented 9p in rust yet and rust is cool (although another person started working on it while I was)
    • I wanted to give everyone a standard base to build upon if they were to make differing server implementations, so there could at least be some shared code.

    I’ve still got some cleanup to do on this crate, and I have a fairly simple in-memory filesystem server that I’ve been using for testing that I’ll publish soon as a separate crate.

    1. 4

      I had also started working on my own version, but never got far. So thank you for this. Do you have a link to that other implementation?

      1. 3

        They stopped working on it a while ago, and I took over the crate name on crates.io– they’ve since deleted the repo, but you can browse the source from docs.rs:

        https://docs.rs/crate/nine/0.1.2/source/

      2. 4

        FWIW, I believe crosvm (the ChromeOS hypervisor written in Rust) has an implementation of 9p: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/refs/heads/master/p9/

        1. 3

          Interesting! I wonder what they use it for.

          1. 4

            File sharing between the host and the guest I believe. My understanding is that 9p is a relatively common choice for that, for whatever reason.

            1. 3

              Ah, that makes sense. That’s because there’s 9p support built into the linux kernel for it, and it can work with virtio to provide very low overhead for the file sharing.

      3. 2

        I always wanted to write something like this, but I never managed/bothered to assemble suitable documentation and/or existing implementations to test against.

        Well done!

        1. 2

          Thanks!

          For both documentation and implementation testing, I used plan9port. It has a one-shot client for simple reads, writes, and stats, as well as a 9p FUSE adapter. Alternatively, there’s 9p client support built into the Linux kernel.

          I might spin up a 9front VM to do some even more rigorous testing, though.