~/bend-docscommunity

src/fs/p9.bend checks

raw source on the hub · import 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9.bend as P9

6 imports
import Base
import ../lib/u64.bend as U
import ../lib/bytes.bend as B
import ../vmm/abi.bend as V
import ../virtio/queue.bend as Q
import ./p9wire.bend as W

Types

type Fid source · line 42 · raw

Data

type P9XPath source · line 45 · raw

Data

type FidMap source · line 51 · raw

Data

The fid table as a binary trie on a fid's bits, low bit first, a fid kept where its remaining bits run out (Linux numbers fids from 0 up, so 65536 fids sit at most 17 nodes deep).

type FidTable source · line 59 · raw

Data

A server's state: the msize, and its fid table, either a list (as laws, tests and snapshots write it) or a trie with its count (P9Map, what the first bind makes: a lookup costs the fid's bits, not the table's length). A trie and how many fids it holds.

type P9State source · line 62 · raw

Data

type P9Answer source · line 86 · raw

Data

type P9Walk source · line 582 · raw

Data

The outcome of a walk: an error, or the path reached, the qids found and whether every name was walked.

type P9Pass source · line 921 · raw

Data

Definitions

def P9State.new source · line 66 · raw

P9State

def P9.linux_errno source · line 72 · raw

@+e:U32 -> U32

The Linux errno for a macOS errno (equal below 35; EAGAIN 35 -> 11, ENOTEMPTY 66 -> 39, ENAMETOOLONG 63 -> 36, ELOOP 62 -> 40, ENOSYS 78 -> 38, ENOTSUP 45 -> 95, others unchanged).

def P9.config source · line 82 · raw

@tag:String -> List<&2, U32>

The config space for a mount tag.

def P9.eio source · line 90 · raw

U32

Linux errnos the server answers by itself.

def P9.ebadf source · line 93 · raw

U32

def P9.einval source · line 96 · raw

U32

def P9.eopnotsupp source · line 99 · raw

U32

def P9.emfile source · line 102 · raw

U32

def P9.max_fids source · line 106 · raw

Nat

The most fids the table holds: a new fid past it is EMFILE.

def P9.mode source · line 111 · raw

@m:U32 -> U32

The permission bits a guest may set on a host file (0777): never setuid, setgid or sticky.

def P9.max_msize source · line 116 · raw

U32

The largest msize this server accepts: reads and writes move their data on the host, so a large one costs Bend nothing per byte and saves requests.

def P9.sub_sat source · line 120 · raw

@+a:U32 -> @+b:U32 -> U32

a - b, or 0 when b is larger.

def P9State.msize source · line 123 · raw

@s:P9State -> U32

def FidMap.here source · line 130 · raw

@m:Maybe<&2, Fid> -> List<&2, Fid>

def FidMap.list source · line 138 · raw

@m:FidMap -> List<&2, Fid>

Every fid of a trie.

def P9State.fids source · line 145 · raw

@s:P9State -> List<&2, Fid>

def P9.iounit source · line 153 · raw

@s:P9State -> U32

The I/O unit Rlopen and Rlcreate answer: msize less the Rread header.

def Fid.id source · line 156 · raw

@f:Fid -> U32

def Fid.path source · line 161 · raw

@f:Fid -> String

def P9.fid_find source · line 166 · raw

@fids:List<&2, Fid> -> @+fid:U32 -> Maybe<&2, Fid>

def FidMap.side source · line 174 · raw

@b:Bool -> @+z:FidMap -> @+o:FidMap -> FidMap

The trie's node for a key's low bit (b: the bit is 1).

def FidMap.bit source · line 181 · raw

@+key:U32 -> Bool

def FidMap.get.at source · line 184 · raw

@fuel:Nat -> @m:FidMap -> @done:Bool -> @+key:U32 -> Maybe<&2, Fid>

def FidMap.get source · line 201 · raw

@m:FidMap -> @+key:U32 -> Maybe<&2, Fid>

The fid bound to key (fuel: 33, a key's bits and one).

def FidMap.trim source · line 205 · raw

@h:Maybe<&2, Fid> -> @+z:FidMap -> @+o:FidMap -> FidMap

A node with nothing left under it is a tip.

def FidMap.set source · line 214 · raw

@fuel:Nat -> @m:FidMap -> @done:Bool -> @bit:Bool -> @+key:U32 -> @v:Maybe<&2, Fid> -> FidMap

The trie with key bound to v (None: unbound). done: no bits of key are left; bit: its low bit is 1.

def FidMap.put source · line 241 · raw

@m:FidMap -> @+key:U32 -> @v:Maybe<&2, Fid> -> FidMap

def FidMap.count source · line 246 · raw

@+had:Bool -> @+n:U32 -> U32

A list of fids as a trie and its count (the first of a fid bound twice wins, as P9.fid_find finds it).

def FidMap.add source · line 249 · raw

@+f:Fid -> @t:FidTable -> FidTable

def FidMap.of_list source · line 254 · raw

@fs:List<&2, Fid> -> FidTable

def FidTable.state source · line 261 · raw

@+ms:U32 -> @t:FidTable -> P9State

def P9State.table source · line 267 · raw

@s:P9State -> FidTable

The table of a state, as a trie.

def P9State.find source · line 274 · raw

@s:P9State -> @+fid:U32 -> Maybe<&2, Fid>

def P9State.count source · line 281 · raw

@s:P9State -> Nat

def FidTable.put source · line 289 · raw

@t:FidTable -> @+fid:U32 -> @+v:Maybe<&2, Fid> -> FidTable

The table with fid bound to v (None: unbound).

def P9.fid_drop.go source · line 297 · raw

@hit:Bool -> @f:Fid -> @rest:List<&2, Fid> -> List<&2, Fid>

def P9.fid_drop source · line 306 · raw

@fids:List<&2, Fid> -> @+fid:U32 -> List<&2, Fid>

The table without fid. One recursive call per entry: both arms of a Bool.pick are evaluated, so recursing in each would take 2^n steps.

def P9.room source · line 315 · raw

@bound:Bool -> @n:Nat -> Bool

Whether a fid can be bound in a table of n fids: it already is (bound), or the table has room.

def P9.fid_room source · line 319 · raw

@+fids:List<&2, Fid> -> @+fid:U32 -> Bool

Whether fid can be bound in the table fids.

def P9State.room source · line 323 · raw

@+s:P9State -> @+fid:U32 -> Bool

Whether fid can be bound in s's table.

def P9.bind source · line 327 · raw

@+s:P9State -> @+f:Fid -> P9State

The state with fid bound to f (replacing any earlier binding).

def P9.unbind source · line 330 · raw

@+s:P9State -> @+fid:U32 -> P9State

def P9.strip source · line 334 · raw

@prefix:String -> @s:String -> Maybe<&2, String>

The rest of s after prefix, if s starts with it.

def P9.moved.under source · line 343 · raw

@+to:String -> @path:String -> @r:Maybe<&2, String> -> String

def P9.moved source · line 352 · raw

@+from:String -> @+to:String -> @+path:String -> String

A path after from was renamed to to: from itself and everything under it move.

def P9.move_fids source · line 355 · raw

@fids:List<&2, Fid> -> @+from:String -> @+to:String -> List<&2, Fid>

def P9.rename_fids source · line 362 · raw

@+s:P9State -> @+from:String -> @+to:String -> P9State

def P9.chars source · line 366 · raw

@bs:List<&2, U32> -> String

A name as a host path component.

def P9.no_sep source · line 373 · raw

@bs:List<&2, U32> -> Bool

def P9.is_dot source · line 380 · raw

@bs:List<&2, U32> -> Bool

def P9.is_dotdot source · line 387 · raw

@bs:List<&2, U32> -> Bool

def P9.bytes_eq source · line 394 · raw

@xs:List<&2, U32> -> @ys:List<&2, U32> -> Bool

def P9.name_ok source · line 405 · raw

@+bs:List<&2, U32> -> Bool

Whether a name may be one path component: not empty, ".", "..", and without "/" or NUL.

def P9.join source · line 409 · raw

@+dir:String -> @+name:String -> String

A name inside directory dir ("" is the root).

def P9.xpath source · line 415 · raw

@+name:String -> @+path:String -> String

A fid Txattrwalk binds reads an extended attribute: its path is a 0 byte, the attribute's name, a 0 byte, then the file's path (no real path holds a 0 byte: P9.name_ok refuses one).

def P9.is_xpath source · line 418 · raw

@p:String -> Bool

def P9.xcut.add source · line 425 · raw

@+c:Char -> @k:P9XPath -> P9XPath

def P9.xcut source · line 431 · raw

@s:String -> P9XPath

An xattr fid's attribute name and file path.

def P9.xsplit source · line 438 · raw

@p:String -> P9XPath

def P9.qid_kind source · line 446 · raw

@+mode:U32 -> U32

The qid of a file: QTDIR for a directory, QTSYMLINK for a symlink.

def P9.qid source · line 450 · raw

@a:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsAttr -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid

def P9.stat source · line 455 · raw

@a:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsAttr -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Stat

def P9.dirent_qid source · line 461 · raw

@+kind:U32 -> @ino:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid

The qid of a directory entry, from its DT_* type.

def P9.dirents source · line 466 · raw

@es:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsEntry> -> @+next:U32 -> @+room:U32 -> List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Dirent>

The entries from index next on that fit in room bytes (each takes 24 bytes plus its name).

def P9.answer source · line 478 · raw

@-R:Type -> @s:P9State -> @+tag:U32 -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Resp -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.err source · line 481 · raw

@-R:Type -> @s:P9State -> @+tag:U32 -> @e:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.fail source · line 485 · raw

@r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> U32

The Linux errno for an answer that is not the one expected.

def P9.ok_errno source · line 493 · raw

@r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> U32

The Linux errno of an answer that should be FsOk, 0 when it is.

def P9.first source · line 501 · raw

@+a:U32 -> @b:U32 -> U32

The first nonzero errno of two.

def P9.done source · line 505 · raw

@-R:Type -> @s:P9State -> @+tag:U32 -> @+e:U32 -> @resp:0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Resp -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Answers resp when errno e is 0, else Rlerror e.

def P9.with_fid.go source · line 509 · raw

@-R:Type -> @m:Maybe<&2, Fid> -> @s:P9State -> @+tag:U32 -> @k:(@_:Fid -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Continues with the fid bound to fid, or answers EBADF.

def P9.with_fid source · line 516 · raw

@-R:Type -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @k:(@_:Fid -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.with_child.go source · line 521 · raw

@-R:Type -> @ok:Bool -> @s:P9State -> @+tag:U32 -> @dir:String -> @name:List<&2, U32> -> @k:(@_:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Continues with the path of name inside the directory fid names, or answers EBADF (unknown fid) or EINVAL (bad name).

def P9.with_child source · line 528 · raw

@-R:Type -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+name:List<&2, U32> -> @k:(@_:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.on_attr source · line 532 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @s:P9State -> @+tag:U32 -> @k:(@_:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsAttr -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Continues with the attributes of a FsStat answer, or answers its error.

def P9.on_ok source · line 542 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @s:P9State -> @+tag:U32 -> @k:(@_:Unit -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Continues after an FsOk answer, or answers its error.

def P9.reply_qid source · line 550 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> @mk:(@_:0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Resp) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Stats path and answers with the response its qid makes.

def P9.version source · line 556 · raw

@-R:Type -> @+tag:U32 -> @+msize:U32 -> @version:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tversion.

def P9.with_room.go source · line 563 · raw

@-R:Type -> @room:Bool -> @s:P9State -> @+tag:U32 -> @k:(@_:P9State -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

k, when fid can be bound (P9.fid_room); else Rlerror EMFILE.

def P9.with_room source · line 570 · raw

@-R:Type -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @k:(@_:P9State -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.attach.go source · line 573 · raw

@-R:Type -> @+share:U32 -> @s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.attach source · line 577 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tattach: fid names the root (EMFILE when the table is full).

def P9.walk.stop source · line 586 · raw

@+path:String -> @+qids:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid> -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> P9Walk

def P9.walk.after source · line 591 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @+path:String -> @+next:String -> @+qids:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid> -> @k:(@_:String -> @_:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Walk>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Walk>

After stating the next path: continue the walk there with k, or stop at path with the qids found so far (reversed).

def P9.walk.go source · line 605 · raw

@names:List<&2, List<&2, U32>> -> @-R:Type -> @+share:U32 -> @+path:String -> @+qids:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Walk>

Walks names from path; qids holds the qids found so far, reversed. ".." of the root is the root; any other bad name refuses the whole walk.

def P9.walk.fin source · line 617 · raw

@-R:Type -> @w:P9Walk -> @s:P9State -> @+tag:U32 -> @+newfid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.walk.from source · line 626 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+newfid:U32 -> @names:List<&2, List<&2, U32>> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.walk source · line 630 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+newfid:U32 -> @names:List<&2, List<&2, U32>> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Twalk (EMFILE when newfid is new and the table is full).

def P9.rdev source · line 635 · raw

@+major:U32 -> @+minor:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64

A device's number as Linux packs it for 9p (new_encode_dev: the minor's low 8 bits, the major above them, the minor's high bits above that).

def P9.getattr.got source · line 638 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @+s:P9State -> @+tag:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.getattr.go source · line 645 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.getattr source · line 651 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tgetattr.

def P9.maybe_op source · line 655 · raw

@-R:Type -> @go:Bool -> @+share:U32 -> @op:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsOp -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, U32>

Runs op when go, answering the Linux errno of its result (0 for FsOk).

def P9.setattr.go source · line 664 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+path:String -> @+valid:U32 -> @mode:U32 -> @size:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.setattr source · line 671 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+valid:U32 -> @+mode:U32 -> @+size:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tsetattr: mode (valid bit 0), then size (valid bit 3); other bits ignored.

def P9.open_fid source · line 675 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+path:String -> @mk:(@_:0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.Qid -> @_:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Resp) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Binds fid to path, opened, and answers mk(qid, iounit).

def P9.lopen.go source · line 679 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+path:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.lopen source · line 683 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tlopen: marks the fid open.

def P9.lcreate.go source · line 686 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+path:String -> @mode:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.lcreate source · line 693 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+name:List<&2, U32> -> @+mode:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tlcreate: creates name in the directory fid names; fid then names the new file, opened.

def P9.mkdir.go source · line 696 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+path:String -> @mode:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.mkdir source · line 702 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+dfid:U32 -> @+name:List<&2, U32> -> @+mode:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tmkdir.

def P9.symlink.go source · line 705 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+path:String -> @target:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.readlink.go source · line 721 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.on_bytes source · line 730 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @s:P9State -> @+tag:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.read.file source · line 737 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> @offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.xread.got source · line 745 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @+s:P9State -> @+tag:U32 -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

A read on an xattr fid: the attribute's value from offset on, at most count bytes (and what fits an Rread).

def P9.xread.of source · line 753 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @x:P9XPath -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.read.go source · line 760 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+path:String -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.read source · line 764 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tread: count capped to msize - 11 (the Rread header).

def P9.on_count source · line 767 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @s:P9State -> @+tag:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.write.go source · line 774 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> @offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @data:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.write source · line 780 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+data:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Twrite.

def P9.on_entries source · line 783 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @s:P9State -> @+tag:U32 -> @+from:U32 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.index source · line 792 · raw

@o:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> U32

The entry index of a readdir offset; past 2^32 nothing is left, so the index saturates.

def P9.readdir_count source · line 798 · raw

@+msize:U32 -> @+count:U32 -> U32

A Treaddir count, at most msize - 24 (the reply must fit msize).

def P9.readdir.go source · line 801 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> @offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @count0:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.readdir source · line 810 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Treaddir: entries from index offset on, as many as fit in count bytes (count at most msize - 24).

def P9.unlinkat.go source · line 813 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> @flags:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.unlinkat source · line 820 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+dir:U32 -> @+name:List<&2, U32> -> @+flags:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tunlinkat: removes name from the directory dir names (a directory when flags has AT_REMOVEDIR 512).

def P9.renameat.go source · line 823 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+from:String -> @+to:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.renameat source · line 829 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+olddir:U32 -> @+oldname:List<&2, U32> -> @+newdir:U32 -> @+newname:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Trenameat: fids naming the old path, or a path under it, follow it.

def P9.on_statfs source · line 832 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @s:P9State -> @+tag:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.statfs.go source · line 839 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.statfs source · line 845 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tstatfs.

def P9.fsync source · line 849 · raw

@-R:Type -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tfsync: nothing is buffered here.

def P9.clunk source · line 853 · raw

@-R:Type -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Tclunk: forgets the fid.

def P9.xattrwalk.got source · line 858 · raw

@-R:Type -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @+s:P9State -> @+tag:U32 -> @+newfid:U32 -> @+xp:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Txattrwalk: newfid reads the attribute name of fid's file (name "": the list of its names); Rxattrwalk answers the value's size.

def P9.xattrwalk.go source · line 865 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+newfid:U32 -> @+path:String -> @+name:String -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.xattrwalk source · line 870 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+fid:U32 -> @+newfid:U32 -> @+name:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

def P9.serve source · line 874 · raw

@-R:Type -> @share:U32 -> @s:P9State -> @m:0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Msg -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

Serves one request on share share.

def P9.handle source · line 926 · raw

@-R:Type -> @share:U32 -> @s:P9State -> @m:Maybe<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/fs/p9wire.P9Msg> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Answer>

The answer to a request's bytes: Rlerror EINVAL with tag 65535 when they are not a message.

def P9.reply_chain source · line 935 · raw

@-R:Type -> @a:P9Answer -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Writes the reply into the chain and pushes it used with the length that fit the writable descriptors (the whole reply when they hold it).

def P9.reply_err source · line 944 · raw

@-R:Type -> @s:P9State -> @+tag:U32 -> @e:U32 -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Answers an error the generic way.

def P9.read_done.ok source · line 949 · raw

@-R:Type -> @s:P9State -> @+tag:U32 -> @+n:U32 -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

def P9.read_done source · line 959 · raw

@-R:Type -> @s:P9State -> @+tag:U32 -> @r:0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.FsResult -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Rread of the n bytes FsReadRam put in the chain's memory: its 11-byte header {size, 117, tag, count} goes in front of them. An error the generic way.

def P9.read_fast.ram source · line 966 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @path:String -> @offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

def P9.read_fast.go source · line 973 · raw

@-R:Type -> @m:Maybe<&2, Fid> -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @+offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @+count:U32 -> @+q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

def P9.read_fast source · line 987 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+hdr:List<&2, U32> -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Tread: the data goes from the file straight into the chain's memory after the Rread header (count capped to msize - 11 and to the room).

def P9.write_fast.go source · line 994 · raw

@-R:Type -> @m:Maybe<&2, Fid> -> @+share:U32 -> @+s:P9State -> @+tag:U32 -> @offset:0x8cced805dd17b3296cb7aabd2fa292bb/src/lib/u64.U64 -> @ss:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Iov> -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

def P9.write_fast source · line 1008 · raw

@-R:Type -> @+share:U32 -> @+s:P9State -> @+hdr:List<&2, U32> -> @r:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Twrite: the data goes from the chain's memory after the 23-byte header straight to the file (at most count bytes).

def P9.path source · line 1017 · raw

@+hdr:List<&2, U32> -> Nat

Which way a request is served, from its first 23 bytes: 1 Tread, 2 Twrite (both exactly 23-byte headers), else 0 (the whole message through Bend).

def P9.serve_whole source · line 1025 · raw

@-R:Type -> @long:Bool -> @+share:U32 -> @s:P9State -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @ss:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Iov> -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> @hdr:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

A request served whole: its readable bytes ss (at most msize + 1 of them) are parsed, unless they pass msize (long): Rlerror EINVAL with the tag of hdr, nothing more read.

def P9.serve_path source · line 1035 · raw

@-R:Type -> @k:Nat -> @+share:U32 -> @+s:P9State -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @+h:U32 -> @+r:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> @+w:List<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Desc> -> @+hdr:List<&2, U32> -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

def P9.serve_chain source · line 1048 · raw

@-R:Type -> @+share:U32 -> @s:P9State -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> @c:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Chain -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Serves one chain. Reads and writes move their data between the file and the chain's memory on the host; every other request is parsed whole.

def P9.step source · line 1057 · raw

@-R:Type -> @+share:U32 -> @s:P9State -> @r:Pair(0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq, Maybe<&2, 0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Chain>) -> @used:Bool -> @k:(@_:P9Pass -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>) -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

After a pop: stops on an empty queue, else serves the chain and continues with k.

def P9.go source · line 1065 · raw

@fuel:Nat -> @-R:Type -> @+share:U32 -> @p:P9Pass -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Pops and serves chains, at most fuel of them.

def P9.process source · line 1079 · raw

@-R:Type -> @share:U32 -> @s:P9State -> @q:0x8cced805dd17b3296cb7aabd2fa292bb/src/virtio/queue.Vq -> 0x8cced805dd17b3296cb7aabd2fa292bb/src/vmm/abi.Op<R, P9Pass>

Serves every available chain (at most num): the request is the chain's readable bytes, the reply goes to its writable descriptors, pushed used with the reply's length. A malformed request gets Rlerror EINVAL with tag 65535.