---
title: plan9 FS investigations
date: 2025-01-21
---

Digested from:

- https://www.usenix.org/legacy/events/usenix05/tech/freenix/full_papers/hensbergen/hensbergen.pdf
- https://www.kernel.org/doc/Documentation/filesystems/9p.txt
- http://ericvh.github.io/9p-rfc/rfc9p2000.html
- http://ericvh.github.io/9p-rfc/rfc9p2000.u.html
- https://9fans.github.io/plan9port/man/man4/9pfuse.html
- https://github.com/pfpacket/rust-9p/tree/master/example/unpfs

# 9p2000 Opcodes

All messages take a `tag` parameter used to multiplex connections

## Session

- version
  - parameter negotiations
- auth
  - T
    - afid: auth handle??
    - uname
      - username
    - aname: mount name (root if blank)
- attach
  - establish connection to server
  - T
    - fid is file handle, chosen by client?
    - afid is an 'auth handle'
      - -1 for no auth
    - uname
    - aname
  - R:
- flush
  - abort request
- error

## File

- walk
  - lookup pathname
- open
- create
- read
- write
- clunk
  - release a file?

## Metadata

- stat
  - read metadata attrs
- wstat
  - write metadata attrs
- Requests are T-messages
- responses are R-messages
