~/bend-docscommunity

src/vmm/cli.bend checks

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

6 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
import ../disk/pack.bend as Pk

Types

type LanSpec source · line 77 · 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 129 · raw

Data

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

type ShareSpec source · line 243 · raw

Data

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

type ShareOpt source · line 281 · 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 287 · 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 455 · 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 458 · raw

Data

type Fwd source · line 532 · raw

Data

type Checked source · line 641 · 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 12 · raw

List<&2, String>

def Cli.known source · line 16 · raw

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

def Cli.display.fits source · line 25 · 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 30 · raw

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

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

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

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

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

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

def Cli.display source · line 52 · raw

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

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

def Cli.is_some source · line 55 · raw

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

def Cli.within source · line 62 · raw

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

def Cli.hex source · line 80 · raw

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

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

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

def Cli.byte source · line 92 · raw

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

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

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

def Cli.bytes source · line 106 · raw

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

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

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

def Cli.mac source · line 121 · raw

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

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

def Cli.mac_of_ip source · line 124 · raw

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

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

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

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

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

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

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

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

@l:LanOpts -> LanOpts

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

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

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

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

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

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

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

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

def Cli.lan source · line 186 · raw

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

def Cli.lan_ok source · line 189 · raw

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

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

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

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

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

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

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

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

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

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

def Cli.last source · line 222 · raw

@s:String -> U32

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

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

def Cli.size source · line 239 · raw

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

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

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

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

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

def Cli.share source · line 262 · raw

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

def Cli.share_ok source · line 265 · raw

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

def Cli.tag_char source · line 291 · raw

@+c:U32 -> Bool

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

def Cli.tag_chars source · line 294 · raw

@cs:String -> Bool

def Cli.tag_ok source · line 301 · raw

@+t:String -> Bool

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

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

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

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

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

@+seen:U32 -> @+o:ShareOpt -> @m:Maybe<&2, 0x2324e729258ea5021b37b97947af4c3f/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 324 · raw

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

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

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

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

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

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

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

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

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

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

def Cli.share_opt source · line 367 · raw

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

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

def Cli.share_opt_ok source · line 370 · raw

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

def Cli.nonempty source · line 378 · 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 385 · raw

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

def Cli.share_tag source · line 388 · raw

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

def Cli.share_named source · line 391 · raw

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

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

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

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

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

def Cli.shares source · line 415 · raw

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

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

def Cli.share_tag_of source · line 418 · raw

@o:ShareOpt -> String

def Cli.tag_in source · line 425 · raw

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

def Cli.tags_dup source · line 432 · raw

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

def Cli.share_tags source · line 439 · raw

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

def Cli.shares_why source · line 448 · 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 461 · raw

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

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

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

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

@c:ConOpts -> ConOpts

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

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

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

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

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

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

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

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

def Cli.conlog source · line 505 · raw

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

def Cli.conlog_ok source · line 508 · raw

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

def Cli.find source · line 516 · 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 535 · raw

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

def Fwd.port source · line 543 · raw

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

A port: 1 to 65535.

def Fwd.mk source · line 546 · raw

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

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

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

def Fwd.parse source · line 563 · raw

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

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

def Fwd.specs source · line 566 · raw

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

def Fwd.max source · line 571 · raw

U32

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

def Fwd.ok source · line 574 · raw

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

def Fwd.all_ok source · line 582 · raw

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

Every spec of one --forward value parses.

def Cli.balloon_max.of source · line 596 · raw

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

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_max source · line 606 · raw

@+v:String -> U32

--balloon auto,max=PCT: the automatic balloon holding at most PCT percent of the guest's RAM (10 to 90; src/virtio/balauto.bend's Auto.most_of). PCT, or 0 for any other value.

def Cli.balloon source · line 609 · raw

@+v:String -> Bool

def Cli.balloon_ok source · line 612 · raw

@+v:String -> Bool

def Cli.balloon_on source · line 617 · raw

@+v:String -> Bool

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

def Cli.balloon_auto source · line 623 · 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 626 · raw

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

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

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

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

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

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

@c:Checked -> String

def Cli.check source · line 668 · 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).