src/fs/meta.bend checks
raw source on the hub · import 0x2740e30df705f4fb9b9db637023eca00/src/fs/meta.bend as Meta
3 imports
import Base import ../lib/u64.bend as U import ../vmm/abi.bend as V
Types
type Xattr source · line 25 · raw
Data
Xattr@name:String -> @value:List<&2, U32> -> Xattr
type Rec source · line 30 · raw
Data
has: which keys a record gave (1 type, 2 mode, 4 uid, 8 gid, 16 rdev, 32 mtime, 64 ino, 128 nlink, 256 host). kind: 1 f, 2 d, 3 l, 4 c, 5 b, 6 p.
Rec@name:String -> @host:String -> @kind:U32 -> @mode:U32 -> @uid:U32 -> @gid:U32 -> @major:U32 -> @minor:U32 -> @mtime:0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64 -> @mnsec:U32 -> @ino:0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64 -> @nlink:U32 -> @has:U32 -> @xattrs:List<&2, Xattr> -> Rec
type Cut source · line 111 · raw
Data
A string split at its first c: the part before and the part after ("", when there is no c: then the whole is before).
Cut@before:String -> @after:String -> Cut
type Table source · line 337 · raw
Data
A table: how many records, and their words (guest name, host name, the line itself, each a length and its bytes).
Table@n:U32 -> @words:List<&2, U32> -> Table
type Found source · line 400 · raw
Data
What Hvf.meta_resolve answered.
Resolved@host:String -> @line:Maybe<&2, String> -> Found
the host path, and its record's line when it has one
NeedTable@k:U32 -> @hostdir:String -> Found
the directory of the path's first k parts has no table; its host path
MissingFound
Definitions
def Meta.file source · line 33 · raw
String
def Meta.header source · line 36 · raw
String
def Meta.empty source · line 39 · raw
Rec
def Meta.hexval source · line 43 · raw
@+c:U32 -> U32
Hex and percent decoding.
def Meta.hex source · line 48 · raw
@s:String -> List<&2, U32>
def Meta.pct source · line 58 · raw
@s:String -> String
"%41" is "A"; any other character is itself (a name's bytes as chars).
def Meta.dec.go source · line 72 · raw
@s:String -> @+acc:U32 -> @+ok:Bool -> Maybe<&2, U32>
Numbers: decimal (U32 and U64) and octal.
def Meta.dec source · line 80 · raw
@s:String -> Maybe<&2, U32>
def Meta.oct.go source · line 83 · raw
@s:String -> @+acc:U32 -> @+ok:Bool -> Maybe<&2, U32>
def Meta.oct source · line 91 · raw
@s:String -> Maybe<&2, U32>
def Meta.dec64.step source · line 95 · raw
@+acc:0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64 -> @+d:U32 -> 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64
acc * 10 + d in 64 bits (10x is 8x + 2x).
def Meta.dec64.go source · line 98 · raw
@s:String -> @+acc:0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64 -> @+ok:Bool -> Maybe<&2, 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64>
def Meta.dec64 source · line 106 · raw
@s:String -> Maybe<&2, 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64>
def Cut.before source · line 114 · raw
@k:Cut -> String
def Cut.after source · line 119 · raw
@k:Cut -> String
def Meta.cut.add source · line 124 · raw
@+c:Char -> @k:Cut -> Cut
def Meta.cut source · line 129 · raw
@s:String -> @+c:Char -> Cut
def Meta.kind source · line 136 · raw
@+v:String -> U32
def Meta.num source · line 144 · raw
@m:Maybe<&2, U32> -> U32
def Meta.got source · line 147 · raw
@m:Maybe<&2, U32> -> @+bit:U32 -> U32
def Meta.got64 source · line 154 · raw
@m:Maybe<&2, 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64> -> @+bit:U32 -> U32
def Meta.num64 source · line 161 · raw
@m:Maybe<&2, 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64> -> 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64
def Meta.token.kv source · line 165 · raw
@r:Rec -> @+k:String -> @+v:String -> Rec
One key=value token on a record.
def Meta.token.cut source · line 183 · raw
@r:Rec -> @k:Cut -> Rec
def Meta.token source · line 188 · raw
@r:Rec -> @tok:String -> Rec
def Meta.tokens source · line 191 · raw
@ts:List<&2, String> -> @r:Rec -> Rec
def Rec.name source · line 198 · raw
@r:Rec -> String
def Rec.has source · line 203 · raw
@r:Rec -> U32
def Meta.hosted source · line 209 · raw
@r:Rec -> Rec
A record's host name defaults to its name.
def Meta.line.of source · line 215 · raw
@+r:Rec -> Maybe<&2, Rec>
One line: a record, or none (a blank line, or one with no name).
def Meta.line source · line 218 · raw
@+l:String -> Maybe<&2, Rec>
def Meta.lines.add source · line 221 · raw
@m:Maybe<&2, Rec> -> @rest:List<&2, Rec> -> List<&2, Rec>
def Meta.lines source · line 228 · raw
@ls:List<&2, String> -> List<&2, Rec>
def Meta.parse.go source · line 235 · raw
@ls:List<&2, String> -> Maybe<&2, List<&2, Rec>>
def Meta.parse source · line 244 · raw
@text:String -> Maybe<&2, List<&2, Rec>>
A .bend-meta file's records, or none when its first line is not
bend-meta 1 (another version, or not one at all).
def Meta.fnv.mul source · line 250 · raw
@+h:0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64 -> 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64
64-bit FNV-1a of a path's bytes: offset 0xcbf29ce484222325, prime 0x100000001b3 (2^40 + 435; 435 = 256 + 128 + 32 + 16 + 2 + 1), each byte XORed in, then the product kept to 64 bits.
def Meta.fnv.go source · line 253 · raw
@s:String -> @+h:0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64 -> 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64
def Meta.fnv source · line 260 · raw
@s:String -> 0x2740e30df705f4fb9b9db637023eca00/src/lib/u64.U64
def Meta.type_bits source · line 264 · raw
@+kind:U32 -> U32
The file type bits of st_mode for a kind (0: none given).
def Meta.dtype source · line 273 · raw
@+mode:U32 -> U32
A directory entry's type (DT_*) for st_mode's type bits.
def Meta.bit source · line 276 · raw
@+has:U32 -> @+b:U32 -> Bool
def Meta.attr source · line 282 · raw
@r:Rec -> @h:0x2740e30df705f4fb9b9db637023eca00/src/vmm/abi.FsAttr -> @+path:String -> 0x2740e30df705f4fb9b9db637023eca00/src/vmm/abi.FsResult
What the guest sees of a path: the host's attributes (h), with what its record gives in their place; its inode is the record's, else the FNV-1a hash of its share-relative path; a device or FIFO is 0 bytes long.
def Meta.bit_meta source · line 301 · raw
U32
A share marked meta carries Meta.bit() in its number (as Ro.bit(), src/fs/readonly.bend; a meta share is read-only too).
def Meta.is_meta source · line 304 · raw
@+share:U32 -> Bool
def Meta.bytes source · line 307 · raw
@s:String -> List<&2, U32>
def Meta.wstr source · line 314 · raw
@+s:String -> List<&2, U32>
def Meta.name_ok.chars source · line 320 · raw
@s:String -> Bool
A host name stays inside its directory: not empty, ".", "..", nor holding "/" or a 0 byte; a record naming another is left out.
def Meta.name_ok source · line 327 · raw
@+s:String -> Bool
def Rec.host source · line 330 · raw
@r:Rec -> String
def Meta.table.put source · line 340 · raw
@t:Table -> @+l:String -> @+r:Rec -> Table
def Meta.table.add source · line 347 · raw
@t:Table -> @+l:String -> @m:Maybe<&2, Rec> -> Table
def Meta.table.go source · line 354 · raw
@ls:List<&2, String> -> Table
def Meta.table.words source · line 361 · raw
@t:Table -> List<&2, U32>
def Meta.table.of source · line 366 · raw
@m:Maybe<&2, List<&2, String>> -> List<&2, U32>
def Meta.table.lines source · line 373 · raw
@ls:List<&2, String> -> Maybe<&2, List<&2, String>>
def Meta.table source · line 382 · raw
@text:String -> List<&2, U32>
The words Hvf.meta_load takes for a directory: [1, 0] (plain: no .bend-meta, or not version 1), else [0, n, records].
def Meta.chars source · line 385 · raw
@bs:List<&2, U32> -> String
def Meta.at source · line 392 · raw
@+ws:List<&2, U32> -> @+i:Nat -> U32
def Meta.str_at source · line 396 · raw
@+ws:List<&2, U32> -> @+i:Nat -> String
A length-prefixed string at word i (its length, then its bytes).
def Meta.found.line source · line 407 · raw
@+ws:List<&2, U32> -> @+at:Nat -> Maybe<&2, String>
def Meta.found source · line 410 · raw
@+ws:List<&2, U32> -> Found
def Meta.prefix.go source · line 416 · raw
@ps:List<&2, String> -> @+k:Nat -> String
The guest path of p's first k parts ("" for none).
def Meta.prefix source · line 429 · raw
@p:String -> @+k:U32 -> String
def Meta.join source · line 432 · raw
@+dir:String -> @+name:String -> String
def Meta.entry source · line 437 · raw
@+dir:String -> @+name:String -> @m:Maybe<&2, Rec> -> 0x2740e30df705f4fb9b9db637023eca00/src/vmm/abi.FsEntry
A record as a directory entry: its inode (the record's, else the hash of its path) and its type (DT_*; 0, unknown, when the record gives none).
def Meta.entries.go source · line 444 · raw
@+dir:String -> @+n:Nat -> @+ws:List<&2, U32> -> List<&2, 0x2740e30df705f4fb9b9db637023eca00/src/vmm/abi.FsEntry>
def Meta.entries source · line 459 · raw
@+dir:String -> @+ws:List<&2, U32> -> @+from:U32 -> @+max:U32 -> Maybe<&2, List<&2, 0x2740e30df705f4fb9b9db637023eca00/src/vmm/abi.FsEntry>>
A page of a directory's entries, [from, from + max) in the order of its records (stable: the share is read-only), from Hvf.meta_list's words for that page (n, the records in all, then the page's records). None when the directory has no table or a plain one (then the host lists it, by name).
def Meta.xattr.find source · line 467 · raw
@xs:List<&2, Xattr> -> @+name:String -> Maybe<&2, List<&2, U32>>
An extended attribute of a record: its value, or none (ENODATA). Name "" lists every name, each followed by a 0 byte.
def Meta.xattr.names source · line 474 · raw
@xs:List<&2, Xattr> -> List<&2, U32>
def Meta.xattr source · line 481 · raw
@r:Rec -> @+name:String -> Maybe<&2, List<&2, U32>>