1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# lib9p/idl/1996-Styx.9p - Definitions of Styx messages
#
# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# Styx was a variant of the 9P protocol used by the Inferno operating
# system (before it switched to 9P2000 in 4th edition). It looks
# exactly like 9P1 but with different message-type numbers and without
# `clwalk` or `session`, and no authentication in `attach`.
#
# There do not appear to be Styx protocol differences between Inferno
# 1e, 2e, or 3e.
#
# - 1996 beta https://github.com/inferno-os/inferno-1e0/blob/main/ see `man/html/proto*.htm`, `include/styx.h`, and `Linux/386/include/lib9.h`
# - 1997 1e https://github.com/inferno-os/inferno-1e1/blob/master/ see `man/html/mpgs{113..124}.htm`, `include/styx.h`, `os/port/lib.h`, and `os/fs/fs.c`
# - 1999 2e https://github.com/inferno-os/inferno-2e/blob/master/ see `include/styx.h`, `os/port/lib.h`, and `os/kfs/fs.c` (no public manpages)
# - 2001 3e https://github.com/inferno-os/inferno-3e/blob/master/ see `include/man/5/`, `include/styx.h`, `os/port/lib.h`, and `os/kfs/fs.c`
version "Styx"
from ./1992-9P1.9p import tag, fid, qid, name, errstr, o, ch, stat
# A Styx session goes:
#
# [nop()]
# attach()
# ...
msg Tnop = "typ[1,val=0] tag[tag,val=0xFFFF]"
msg Rnop = "typ[1,val=1] tag[tag,val=0xFFFF]"
#msg Terror = "typ[1,val=2] illegal"
msg Rerror = "typ[1,val=3] tag[tag] ename[errstr]"
msg Tflush = "typ[1,val=4] tag[tag] oldtag[tag]"
msg Rflush = "typ[1,val=5] tag[tag]"
msg Tclone = "typ[1,val=6] tag[tag] fid[fid] newfid[fid]"
msg Rclone = "typ[1,val=7] tag[tag] fid[fid]"
msg Twalk = "typ[1,val=8] tag[tag] fid[fid] name[name]"
msg Rwalk = "typ[1,val=9] tag[tag] fid[fid] qid[qid]"
msg Topen = "typ[1,val=10] tag[tag] fid[fid] mode[o]"
msg Ropen = "typ[1,val=11] tag[tag] fid[fid] qid[qid]"
msg Tcreate = "typ[1,val=12] tag[tag] fid[fid] name[name] perm[ch] mode[o]"
msg Rcreate = "typ[1,val=13] tag[tag] fid[fid] qid[qid]"
# For `offset:max`, see `fs.c` `f_read()` and `f_write()`.
# For `count:max`, see `styx.h:MAXFDATA'.
msg Tread = "typ[1,val=14] tag[tag] fid[fid] offset[8,max=s64_max] count[2,max=8192]"
msg Rread = "typ[1,val=15] tag[tag] fid[fid] count[2,max=8192] pad[1] count*(data[1])"
msg Twrite = "typ[1,val=16] tag[tag] fid[fid] offset[8,max=s64_max] count[2,max=8192] pad[1] count*(data[1])"
msg Rwrite = "typ[1,val=17] tag[tag] fid[fid] count[2,max=8192]"
msg Tclunk = "typ[1,val=18] tag[tag] fid[fid]"
msg Rclunk = "typ[1,val=19] tag[tag] fid[fid]"
msg Tremove = "typ[1,val=20] tag[tag] fid[fid]"
msg Rremove = "typ[1,val=21] tag[tag] fid[fid]"
msg Tstat = "typ[1,val=22] tag[tag] fid[fid]"
msg Rstat = "typ[1,val=23] tag[tag] fid[fid] stat[stat]"
msg Twstat = "typ[1,val=24] tag[tag] fid[fid] stat[stat]"
msg Rwstat = "typ[1,val=25] tag[tag] fid[fid]"
#msg Tsession = "typ[1,val=26]" # The 1e kernel used Tsession in structs internally, but never transmitted it.
#msg Rsession = "typ[1,val=27]" # Implied by Tsession.
msg Tattach = "typ[1,val=28] tag[tag] fid[fid] uid[name] aname[name]"
msg Rattach = "typ[1,val=29] tag[tag] fid[fid] qid[qid]"
|