Blob


1 # constants
3 const notag = -1:u16
4 const msize = 4194304:u32 # 4*1024*1024
5 const np2000 = "9P2000"
9 # 9p protocol
11 proc version(msize, version) {
12 send(Tversion, notag, msize:u32, version:str)
13 }
15 proc attach(fid, afid, uname, aname) {
16 send(Tversion, iota, fid:u32, afid:u32, uname:str, aname:str)
17 }
19 proc walk(fid, newfid, ...) {
20 send(Twalk, iota, fid:u32, newfid:u32, ...:str)
21 }
25 # useful functions
27 proc mount(fid, path) {
28 version(msize, np2000)
30 m = recv()
31 assert(
32 m.type == Tversion,
33 m.tag == notag,
34 m.msize == msize,
35 m.version == version,
36 )
38 attach(fid, nofid, testuser, path)
40 m = recv()
41 assert (
42 m.type == Rattach
43 m.qid.type == QTDIR
44 )
45 }
47 proc should-fail() {
48 m = recv()
49 assert m.type == Rerror
50 debug("got expected error %s", m)
51 }