~/bend-docscommunity

src/disk/access.bend checks

raw source on the hub · import 0x002839320e5a033b05bcedb51711713f/src/disk/access.bend as Access

1 import
import Base

Types

type Use source · line 30 · raw

Data

How an image is opened for each use, as flags for Hvf.disk_open_with: 1 read only, 2 an exclusive lock (else a shared one), 4 a regular file only. A disk the guest writes is opened read-write and locked exclusively, so a second bend-vmm can neither write nor read it (two writers corrupt a qcow2 image at once); a :ro disk only reads, with a shared lock beside other readers; a qcow2 image's backing file, named inside the image, only reads, shared, and must be a regular file (never a device or a FIFO the image points at).

type Spec source · line 55 · raw

Data

A --disk entry: an image path, then options as suffixes in any order: ":ro" (the guest only reads it) and ":nocache" (the host does not keep the image's blocks in its own page cache: the guest caches them already; 8 in the open flags, Access.flags_of). Each suffix counts once.

Definitions

def Access.eperm source · line 10 · raw

U32

def Access.eacces source · line 13 · raw

U32

def Access.erofs source · line 16 · raw

U32

def Access.fallback source · line 19 · raw

@+errno:U32 -> Bool

def Access.flags source · line 35 · raw

@u:Use -> U32

def Access.use source · line 44 · raw

@ro:Bool -> Use

def Access.strip source · line 58 · raw

@+s:String -> @+suffix:String -> String

def Access.spec.go source · line 64 · raw

@fuel:Nat -> @+s:String -> @+ro:Bool -> @+nc:Bool -> Spec

One suffix taken off per step (:ro or :nocache); with neither, the next step finds the same and the spec stands. One recursion a step: both arguments of a Bool.pick are computed.

def Access.spec source · line 74 · raw

@+s:String -> Spec

def Spec.path source · line 77 · raw

@+x:Spec -> String

def Spec.ro source · line 82 · raw

@+x:Spec -> Bool

def Spec.nocache source · line 87 · raw

@+x:Spec -> Bool

def Access.spec_path source · line 92 · raw

@+s:String -> String

def Access.spec_ro source · line 95 · raw

@+s:String -> Bool

def Access.spec_nocache source · line 98 · raw

@+s:String -> Bool

def Access.suffixes source · line 102 · raw

@+s:String -> String

The suffixes of an entry, as given back after its path.

def Access.flags_of source · line 107 · raw

@u:Use -> @+nocache:Bool -> U32

The open flags for a use, with 8 for :nocache.