~/bend-docscommunity

host/fs.bend relies on unsafe/foreign

raw source on the hub · import 0x7fea7bfac3f0390a60760e0485feacff/host/fs.bend as Fs

11 imports
import Base
import ../src/lib/u64.bend as U
import ../src/vmm/abi.bend as V
import ./hvf.bend as H
import ../src/fs/quota.bend as Qt
import ../src/fs/contain.bend as Ct
import ../src/fs/listing.bend as Ls
import ../src/fs/entry.bend as En
import ../src/host/fdcache.bend as Fc
import ../src/fs/readonly.bend as Ro
import ../src/fs/meta.bend as Mt

Definitions

def Fs.w source · line 15 · raw

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

def Fs.w64 source · line 18 · raw

@+ws:List<&2, U32> -> @i:Nat -> 0x7fea7bfac3f0390a60760e0485feacff/src/lib/u64.U64

def Fs.chars source · line 22 · raw

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

def Fs.entries source · line 30 · raw

@fuel:Nat -> @ws:List<&2, U32> -> List<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsEntry>

Entries: (ino hi, ino lo, type, name length, name bytes)*.

def Fs.attr source · line 44 · raw

@+ws:List<&2, U32> -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsAttr

def Fs.ename source · line 47 · raw

@e:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsEntry -> String

def Fs.decode.go source · line 52 · raw

@+tag:U32 -> @+ws:List<&2, U32> -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

def Fs.tag source · line 64 · raw

@+t:U32 -> U32

(tags 8 and 9 are 3 and 4 when the host opened a file for the operation)

def Fs.decode source · line 67 · raw

@+ws:List<&2, U32> -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

def Fs.placed source · line 72 · raw

@opened:Bool -> @+ws:List<&2, U32> -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

A file the host opened for an operation takes the slot Bend picks (src/host/fdcache.bend: the least recently used).

def Fs.run source · line 85 · raw

@sh:U32 -> @+op:U32 -> @p:String -> @p2:String -> @a:0x7fea7bfac3f0390a60760e0485feacff/src/lib/u64.U64 -> @b:U32 -> @bytes:List<&2, U32> -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

A host operation on a share: its paths' names vetted first (src/fs/contain.bend: no empty part, no "." or ".."; the host walks them without following a symlink).

def Fs.call source · line 93 · raw

@+sh:U32 -> @+op:U32 -> @+p:String -> @+p2:String -> @+a:0x7fea7bfac3f0390a60760e0485feacff/src/lib/u64.U64 -> @+b:U32 -> @+bytes:List<&2, U32> -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Fs.paged source · line 99 · raw

@r:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult -> @+from:U32 -> @+max:U32 -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

The page of a listing the guest asked for (src/fs/entry.bend: which entries, with what type; src/fs/listing.bend: in what order).

def Host.fs.do source · line 106 · raw

@sh:U32 -> @op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Host.fs.quota source · line 143 · raw

@ok:Bool -> @sh:U32 -> @op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

A write past the share's quota (src/fs/quota.bend) fails with ENOSPC before it happens.

def Host.fs.grows source · line 150 · raw

@none:Bool -> @+growth:0x7fea7bfac3f0390a60760e0485feacff/src/lib/u64.U64 -> @+sh:U32 -> @op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Host.fs.rw source · line 159 · raw

@+sh:U32 -> @+op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Host.meta.bytes source · line 170 · raw

@r:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult -> List<&2, U32>

A sidecar's text: read in 64 KiB pieces until one comes short.

def Host.meta.read source · line 177 · raw

@fuel:Nat -> @+idx:U32 -> @+path:String -> @+off:0x7fea7bfac3f0390a60760e0485feacff/src/lib/u64.U64 -> @+acc:List<&2, U32> -> IO(List<&2, U32>)

def Host.meta.load source · line 190 · raw

@+sh:U32 -> @+gdir:String -> @+hostdir:String -> IO(U32)

Loads the table of the guest directory gdir, whose host path is hostdir.

def Host.meta.load_need source · line 196 · raw

@+sh:U32 -> @+p:String -> @r:0x7fea7bfac3f0390a60760e0485feacff/src/fs/meta.Found -> IO(Bool)

Loads the table a resolve asked for; True when it did (ask again).

def Host.meta.resolve source · line 207 · raw

@fuel:Nat -> @+sh:U32 -> @+p:String -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/fs/meta.Found)

A guest path's host path and record line (Missing: no such name); each directory along it loaded first (fuel: the path's depth, and some).

def Host.meta.depth source · line 218 · raw

@+p:String -> Nat

def Host.meta.stat.rec source · line 221 · raw

@m:Maybe<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/fs/meta.Rec> -> @a:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsAttr -> @+p:String -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

def Host.meta.stat.got source · line 230 · raw

@r:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult -> @line:Maybe<&2, String> -> @+p:String -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

The attributes of what a resolved path names.

def Host.meta.xattr.val source · line 241 · raw

@m:Maybe<&2, List<&2, U32>> -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

def Host.meta.xattr.rec source · line 248 · raw

@m:Maybe<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/fs/meta.Rec> -> @+name:String -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

def Host.meta.xattr source · line 256 · raw

@line:Maybe<&2, String> -> @+name:String -> 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult

def Host.meta.list.got source · line 265 · raw

@es:Maybe<&2, List<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsEntry>> -> @+idx:U32 -> @+host:String -> @+from:U32 -> @+max:U32 -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

A directory's listing: its records, or the host's when it has none.

def Host.meta.list source · line 272 · raw

@+sh:U32 -> @+p:String -> @+host:String -> @+from:U32 -> @+max:U32 -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Host.meta.on source · line 278 · raw

@+idx:U32 -> @+sh:U32 -> @op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> @+host:String -> @line:Maybe<&2, String> -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Host.meta.op source · line 298 · raw

@+sh:U32 -> @op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> @r:0x7fea7bfac3f0390a60760e0485feacff/src/fs/meta.Found -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

One operation, once its path resolved.

def Host.meta.path source · line 307 · raw

@op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> String

def Host.meta source · line 324 · raw

@+sh:U32 -> @+op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

def Host.fs source · line 331 · raw

@+sh:U32 -> @+op:0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsOp -> IO(0x7fea7bfac3f0390a60760e0485feacff/src/vmm/abi.FsResult)

A share's operation: on a read-only share (src/fs/readonly.bend) every change is refused with EROFS before the host sees it; the host gets the share's index.