~/bend-docscommunity

src/vmm/cli.bend checks

raw source on the hub · import 0x37f031982dbba38edaaee15fcde6c33d/src/vmm/cli.bend as Cli

5 imports
import Base
import ../boot/dtb.bend as T
import ../net/addr.bend as Ad
import ../lib/u64.bend as U
import ./layout.bend as Ly

Types

type LanSpec source · line 76 · raw

Data

--lan DIR[,ip=A.B.C.D/N][,mac=xx:xx:xx:xx:xx:xx] =============================================== The LAN directory (every VM on the LAN names the same one), the NIC's MAC and the address its DHCP answers give. A MAC must be unicast (its first byte even); without one it is 52:54:01 and the address's last three bytes, so a VM keeps it. An address takes a prefix of 1 to 30. One of ip= and mac= is needed.

type LanOpts source · line 128 · raw

Data

Options so far: the MAC, the address and its prefix (0: none), and whether every option parsed.

type ShareSpec source · line 242 · raw

Data

--share DIR[,quota=SIZE]: the shared directory and its quota (0: none).

type ShareOpt source · line 280 · raw

Data

--share DIR[,quota=SIZE][,inodes=N][,tag=NAME][,ro][,meta], repeatable: each share is its own virtio-9p device, mounted by its tag (mount -t 9p -o trans=virtio TAG /mnt); a share given no tag is "share", the next "share1", and so on. ro makes it read-only: the host refuses every change (src/fs/readonly.bend). meta presents Linux metadata from each directory's .bend-meta (src/fs/meta.bend), and is read-only too. inodes=N caps the entries (files, directories, symlinks) the share may hold, as quota= caps its bytes (src/fs/quota.bend): a share given it is a ShareOptN. Each option at most once, in any order.

type ShareAcc source · line 286 · raw

Data

The options so far, the ones seen (1 quota, 2 tag, 4 ro, 8 meta, 16 inodes) and the inode cap.

type ConLog source · line 454 · raw

Data

--console-log PATH,max=SIZE[,keep=N]: the console's file, the size it rotates at, and how many old ones it keeps (1 when not given; at most 99).

type ConOpts source · line 457 · raw

Data

type Fwd source · line 531 · raw

Data

type Checked source · line 626 · raw

Data

One walk over the flags: the first wrong one's message, and every --share value, one a line (as src/vmm/opts.bend keeps them).

Definitions

def Cli.flags source · line 11 · raw

List<&2, String>

def Cli.known source · line 15 · raw

@+flag:String -> @fs:List<&2, String> -> Bool

def Cli.display.fits source · line 24 · raw

@+w:U32 -> @+h:U32 -> Bool

Whether a WxH display (4 bytes a pixel) fits the framebuffer (Layout.fb_size), without overflowing 32 bits.

def Cli.display.mk source · line 29 · raw

@w:Maybe<&2, U32> -> @h:Maybe<&2, U32> -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/boot/dtb.Display>

"WxH" as a display; None for anything malformed or too large.

def Cli.display.go source · line 36 · raw

@ws:List<&2, String> -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/boot/dtb.Display>

def Cli.display.size source · line 43 · raw

@parts:List<&2, String> -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/boot/dtb.Display>

def Cli.display source · line 51 · raw

@spec:String -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/boot/dtb.Display>

"WxH" or "WxH,headless" as a display; None for "" or anything malformed.

def Cli.is_some source · line 54 · raw

@m:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/boot/dtb.Display> -> Bool

def Cli.within source · line 61 · raw

@n:Maybe<&2, U32> -> @+lo:U32 -> @+hi:U32 -> Bool

def Cli.hex source · line 79 · raw

@+c:U32 -> Maybe<&2, U32>

def Cli.byte.mk source · line 84 · raw

@a:Maybe<&2, U32> -> @b:Maybe<&2, U32> -> Maybe<&2, U32>

def Cli.byte source · line 91 · raw

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

def Cli.bytes.cons source · line 98 · raw

@b:Maybe<&2, U32> -> @rest:Maybe<&2, List<&2, U32>> -> Maybe<&2, List<&2, U32>>

def Cli.bytes source · line 105 · raw

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

def Cli.mac.check source · line 112 · raw

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

def Cli.mac source · line 120 · raw

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

xx:xx:xx:xx:xx:xx, unicast.

def Cli.mac_of_ip source · line 123 · raw

@+ip:U32 -> List<&2, U32>

def Cli.lan.ip.mk source · line 131 · raw

@a:Maybe<&2, U32> -> @p:Maybe<&2, U32> -> @o:LanOpts -> LanOpts

def Cli.lan.ip source · line 138 · raw

@parts:List<&2, String> -> @o:LanOpts -> LanOpts

def Cli.lan.mac source · line 147 · raw

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

def Cli.lan.fail source · line 154 · raw

@l:LanOpts -> LanOpts

def Cli.lan.opt source · line 159 · raw

@+o:String -> @+l:LanOpts -> LanOpts

def Cli.lan.opts source · line 164 · raw

@os:List<&2, String> -> @l:LanOpts -> LanOpts

def Cli.lan.make source · line 171 · raw

@+dir:String -> @l:LanOpts -> Maybe<&2, LanSpec>

def Cli.lan.parts source · line 178 · raw

@ps:List<&2, String> -> Maybe<&2, LanSpec>

def Cli.lan source · line 185 · raw

@spec:String -> Maybe<&2, LanSpec>

def Cli.lan_ok source · line 188 · raw

@m:Maybe<&2, LanSpec> -> Bool

def Cli.u64.times10 source · line 197 · raw

@+x:0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64 -> 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64

Sizes: decimal bytes, or K, M or G (KiB, MiB, GiB) after the number.

def Cli.u64.digit source · line 200 · raw

@+c:U32 -> @acc:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64> -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64>

def Cli.u64.digits source · line 207 · raw

@cs:String -> @acc:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64> -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64>

def Cli.u64.scale source · line 214 · raw

@m:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64> -> @+k:Nat -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64>

def Cli.last source · line 221 · raw

@s:String -> U32

def Cli.size.by source · line 230 · raw

@+s:String -> @+last:U32 -> Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64>

def Cli.size source · line 238 · raw

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

def Cli.share.opt source · line 245 · raw

@+dir:String -> @m:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64> -> Maybe<&2, ShareSpec>

def Cli.share.parts source · line 252 · raw

@ps:List<&2, String> -> Maybe<&2, ShareSpec>

def Cli.share source · line 261 · raw

@spec:String -> Maybe<&2, ShareSpec>

def Cli.share_ok source · line 264 · raw

@m:Maybe<&2, ShareSpec> -> Bool

def Cli.tag_char source · line 290 · raw

@+c:U32 -> Bool

A tag: 1 to 31 bytes of letters, digits, "-", "_" and ".".

def Cli.tag_chars source · line 293 · raw

@cs:String -> Bool

def Cli.tag_ok source · line 300 · raw

@+t:String -> Bool

def Cli.share_acc.set source · line 304 · raw

@+bit:U32 -> @+seen:U32 -> @ok:Bool -> @+next:ShareOpt -> @+n:U32 -> Maybe<&2, ShareAcc>

def Cli.share_acc.quota source · line 307 · raw

@+seen:U32 -> @+d:String -> @m:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64> -> @+t:String -> @+r:Bool -> @+mt:Bool -> @+n:U32 -> Maybe<&2, ShareAcc>

def Cli.share_acc.inodes source · line 316 · raw

@+seen:U32 -> @+o:ShareOpt -> @m:Maybe<&2, 0x37f031982dbba38edaaee15fcde6c33d/src/lib/u64.U64> -> Maybe<&2, ShareAcc>

inodes=N: a count from 1 to 2^32 - 1 (K, M and G scale it by 1024s, as a size).

def Cli.share_acc.step source · line 323 · raw

@a:Maybe<&2, ShareAcc> -> @+o:String -> Maybe<&2, ShareAcc>

def Cli.share_acc.all source · line 335 · raw

@os:List<&2, String> -> @a:Maybe<&2, ShareAcc> -> Maybe<&2, ShareAcc>

def Cli.share_opt.with source · line 343 · raw

@o:ShareOpt -> @+n:U32 -> ShareOpt

The options, as a ShareOptN when inodes= was given.

def Cli.share_opt.of source · line 350 · raw

@a:Maybe<&2, ShareAcc> -> Maybe<&2, ShareOpt>

def Cli.share_opt.parts source · line 357 · raw

@ps:List<&2, String> -> Maybe<&2, ShareOpt>

def Cli.share_opt source · line 366 · raw

@+spec:String -> Maybe<&2, ShareOpt>

One --share value (tag "" when it names none).

def Cli.share_opt_ok source · line 369 · raw

@m:Maybe<&2, ShareOpt> -> Bool

def Cli.nonempty source · line 377 · raw

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

Opts keeps every --share value, one a line (src/vmm/opts.bend).

def Cli.share_lines source · line 384 · raw

@+all:String -> List<&2, String>

def Cli.share_tag source · line 387 · raw

@+given:String -> @+i:U32 -> String

def Cli.share_named source · line 390 · raw

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

def Cli.shares.one source · line 399 · raw

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

def Cli.shares.go source · line 406 · raw

@ls:List<&2, String> -> @+i:U32 -> List<&2, ShareOpt>

def Cli.shares source · line 414 · raw

@+all:String -> List<&2, ShareOpt>

Every share, its tag given or made, in the order given.

def Cli.share_tag_of source · line 417 · raw

@o:ShareOpt -> String

def Cli.tag_in source · line 424 · raw

@+t:String -> @ts:List<&2, String> -> Bool

def Cli.tags_dup source · line 431 · raw

@ts:List<&2, String> -> Bool

def Cli.share_tags source · line 438 · raw

@os:List<&2, ShareOpt> -> List<&2, String>

def Cli.shares_why source · line 447 · raw

@+all:String -> String

What is wrong with the shares as a whole ("" when nothing): at most 8, and no two with one tag.

def Cli.con.keep source · line 460 · raw

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

def Cli.con.max source · line 467 · raw

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

def Cli.con.fail source · line 474 · raw

@c:ConOpts -> ConOpts

def Cli.con.opt source · line 479 · raw

@+o:String -> @+c:ConOpts -> ConOpts

def Cli.con.opts source · line 483 · raw

@os:List<&2, String> -> @c:ConOpts -> ConOpts

def Cli.con.make source · line 490 · raw

@+path:String -> @c:ConOpts -> Maybe<&2, ConLog>

def Cli.con.parts source · line 497 · raw

@ps:List<&2, String> -> Maybe<&2, ConLog>

def Cli.conlog source · line 504 · raw

@spec:String -> Maybe<&2, ConLog>

def Cli.conlog_ok source · line 507 · raw

@m:Maybe<&2, ConLog> -> Bool

def Cli.find source · line 515 · raw

@args:List<&1, String> -> @+flag:String -> String

The last value given for flag in the arguments (flag and value pairs), or "".

def Fwd.port.ok source · line 534 · raw

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

def Fwd.port source · line 542 · raw

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

A port: 1 to 65535.

def Fwd.mk source · line 545 · raw

@addr:String -> @h:Maybe<&2, U32> -> @g:Maybe<&2, U32> -> Maybe<&2, Fwd>

def Fwd.parse.parts source · line 552 · raw

@parts:List<&2, String> -> Maybe<&2, Fwd>

def Fwd.parse source · line 562 · raw

@spec:String -> Maybe<&2, Fwd>

"[ADDR:]HOSTPORT:GUESTPORT" as a forward; None for anything malformed.

def Fwd.specs source · line 565 · raw

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

def Fwd.max source · line 570 · raw

U32

The most forwards (the host keeps as many listeners).

def Fwd.ok source · line 573 · raw

@m:Maybe<&2, Fwd> -> Bool

def Fwd.all_ok source · line 581 · raw

@ss:List<&2, String> -> Bool

Every spec of one --forward value parses.

def Cli.balloon source · line 595 · raw

@+v:String -> Bool

What is wrong with one flag and its value ("" when nothing): an unknown flag; --mem other than 1..1048576 MiB (1 TiB, what a snapshot holds); --cpus other than 1..64; a malformed --display. The virtio-balloon device (src/virtio/balloon.bend: the guest hands back the RAM it frees, and the host can ask for more) is on by default; --balloon off leaves it out. --balloon free-page-reporting is accepted and changes nothing (it was the switch before the default).

def Cli.balloon_ok source · line 598 · raw

@+v:String -> Bool

def Cli.balloon_on source · line 603 · raw

@+v:String -> Bool

Whether a VM gets the balloon, from its --balloon value ("" when not given).

def Cli.balloon_auto source · line 609 · raw

@+v:String -> Bool

Whether the balloon is the automatic one (src/virtio/balauto.bend): the default, and --balloon auto; --balloon free-page-reporting keeps free page reporting alone.

def Cli.why source · line 612 · raw

@+flag:String -> @+v:String -> String

def Cli.check.next source · line 629 · raw

@+flag:String -> @+v:String -> @c:Checked -> Checked

def Cli.check.go source · line 635 · raw

@args:List<&1, String> -> Checked

def Cli.check.fin source · line 646 · raw

@c:Checked -> String

def Cli.check source · line 653 · raw

@args:List<&1, String> -> String

The first thing wrong with the arguments (flag and value pairs), or ""; then the shares as a whole (Cli.shares_why).