~/bend-docscommunity

src/fs/meta.bend checks

raw source on the hub · import 0x44d563db508054425e12f3226cb92a4f/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 24 · raw

Data

type Rec source · line 29 · 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.

type Cut source · line 110 · 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).

type Table source · line 336 · raw

Data

A table: how many records, and their words (guest name, host name, the line itself, each a length and its bytes).

type Found source · line 399 · raw

Data

What Hvf.meta_resolve answered.

Definitions

def Meta.file source · line 32 · raw

String

def Meta.header source · line 35 · raw

String

def Meta.empty source · line 38 · raw

Rec

def Meta.hexval source · line 42 · raw

@+c:U32 -> U32

Hex and percent decoding.

def Meta.hex source · line 47 · raw

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

def Meta.pct source · line 57 · raw

@s:String -> String

"%41" is "A"; any other character is itself (a name's bytes as chars).

def Meta.dec.go source · line 71 · raw

@s:String -> @+acc:U32 -> @+ok:Bool -> Maybe<&2, U32>

Numbers: decimal (U32 and U64) and octal.

def Meta.dec source · line 79 · raw

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

def Meta.oct.go source · line 82 · raw

@s:String -> @+acc:U32 -> @+ok:Bool -> Maybe<&2, U32>

def Meta.oct source · line 90 · raw

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

def Meta.dec64.step source · line 94 · raw

@+acc:0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64 -> @+d:U32 -> 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64

acc * 10 + d in 64 bits (10x is 8x + 2x).

def Meta.dec64.go source · line 97 · raw

@s:String -> @+acc:0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64 -> @+ok:Bool -> Maybe<&2, 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64>

def Meta.dec64 source · line 105 · raw

@s:String -> Maybe<&2, 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64>

def Cut.before source · line 113 · raw

@k:Cut -> String

def Cut.after source · line 118 · raw

@k:Cut -> String

def Meta.cut.add source · line 123 · raw

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

def Meta.cut source · line 128 · raw

@s:String -> @+c:Char -> Cut

def Meta.kind source · line 135 · raw

@+v:String -> U32

def Meta.num source · line 143 · raw

@m:Maybe<&2, U32> -> U32

def Meta.got source · line 146 · raw

@m:Maybe<&2, U32> -> @+bit:U32 -> U32

def Meta.got64 source · line 153 · raw

@m:Maybe<&2, 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64> -> @+bit:U32 -> U32

def Meta.num64 source · line 160 · raw

@m:Maybe<&2, 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64> -> 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64

def Meta.token.kv source · line 164 · raw

@r:Rec -> @+k:String -> @+v:String -> Rec

One key=value token on a record.

def Meta.token.cut source · line 182 · raw

@r:Rec -> @k:Cut -> Rec

def Meta.token source · line 187 · raw

@r:Rec -> @tok:String -> Rec

def Meta.tokens source · line 190 · raw

@ts:List<&2, String> -> @r:Rec -> Rec

def Rec.name source · line 197 · raw

@r:Rec -> String

def Rec.has source · line 202 · raw

@r:Rec -> U32

def Meta.hosted source · line 208 · raw

@r:Rec -> Rec

A record's host name defaults to its name.

def Meta.line.of source · line 214 · 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 217 · raw

@+l:String -> Maybe<&2, Rec>

def Meta.lines.add source · line 220 · raw

@m:Maybe<&2, Rec> -> @rest:List<&2, Rec> -> List<&2, Rec>

def Meta.lines source · line 227 · raw

@ls:List<&2, String> -> List<&2, Rec>

def Meta.parse.go source · line 234 · raw

@ls:List<&2, String> -> Maybe<&2, List<&2, Rec>>

def Meta.parse source · line 243 · 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 249 · raw

@+h:0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64 -> 0x44d563db508054425e12f3226cb92a4f/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 252 · raw

@s:String -> @+h:0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64 -> 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64

def Meta.fnv source · line 259 · raw

@s:String -> 0x44d563db508054425e12f3226cb92a4f/src/lib/u64.U64

def Meta.type_bits source · line 263 · raw

@+kind:U32 -> U32

The file type bits of st_mode for a kind (0: none given).

def Meta.dtype source · line 272 · raw

@+mode:U32 -> U32

A directory entry's type (DT_*) for st_mode's type bits.

def Meta.bit source · line 275 · raw

@+has:U32 -> @+b:U32 -> Bool

def Meta.attr source · line 281 · raw

@r:Rec -> @h:0x44d563db508054425e12f3226cb92a4f/src/vmm/abi.FsAttr -> @+path:String -> 0x44d563db508054425e12f3226cb92a4f/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 300 · 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 303 · raw

@+share:U32 -> Bool

def Meta.bytes source · line 306 · raw

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

def Meta.wstr source · line 313 · raw

@+s:String -> List<&2, U32>

def Meta.name_ok.chars source · line 319 · 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 326 · raw

@+s:String -> Bool

def Rec.host source · line 329 · raw

@r:Rec -> String

def Meta.table.put source · line 339 · raw

@t:Table -> @+l:String -> @+r:Rec -> Table

def Meta.table.add source · line 346 · raw

@t:Table -> @+l:String -> @m:Maybe<&2, Rec> -> Table

def Meta.table.go source · line 353 · raw

@ls:List<&2, String> -> Table

def Meta.table.words source · line 360 · raw

@t:Table -> List<&2, U32>

def Meta.table.of source · line 365 · raw

@m:Maybe<&2, List<&2, String>> -> List<&2, U32>

def Meta.table.lines source · line 372 · raw

@ls:List<&2, String> -> Maybe<&2, List<&2, String>>

def Meta.table source · line 381 · 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 384 · raw

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

def Meta.at source · line 391 · raw

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

def Meta.str_at source · line 395 · 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 406 · raw

@+ws:List<&2, U32> -> @+at:Nat -> Maybe<&2, String>

def Meta.found source · line 409 · raw

@+ws:List<&2, U32> -> Found

def Meta.prefix.go source · line 415 · raw

@ps:List<&2, String> -> @+k:Nat -> String

The guest path of p's first k parts ("" for none).

def Meta.prefix source · line 428 · raw

@p:String -> @+k:U32 -> String

def Meta.join source · line 431 · raw

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

def Meta.entry source · line 436 · raw

@+dir:String -> @+name:String -> @m:Maybe<&2, Rec> -> 0x44d563db508054425e12f3226cb92a4f/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 443 · raw

@+dir:String -> @+n:Nat -> @+ws:List<&2, U32> -> List<&2, 0x44d563db508054425e12f3226cb92a4f/src/vmm/abi.FsEntry>

def Meta.entries source · line 456 · raw

@+dir:String -> @+ws:List<&2, U32> -> Maybe<&2, List<&2, 0x44d563db508054425e12f3226cb92a4f/src/vmm/abi.FsEntry>>

A directory's entries from Hvf.meta_list's words, or none when it has no table or a plain one (then the host lists it).

def Meta.xattr.find source · line 462 · 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 469 · raw

@xs:List<&2, Xattr> -> List<&2, U32>

def Meta.xattr source · line 476 · raw

@r:Rec -> @+name:String -> Maybe<&2, List<&2, U32>>