~/bend-docscommunity

src/vmm/cli.bend checks

raw source on the hub · import 0x9e6d2577f67543fbccdbfe8fd1789f27/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 ConLog source · line 273 · 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 276 · raw

Data

type Fwd source · line 350 · raw

Data

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, 0x9e6d2577f67543fbccdbfe8fd1789f27/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, 0x9e6d2577f67543fbccdbfe8fd1789f27/src/boot/dtb.Display>

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

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

def Cli.display source · line 51 · raw

@spec:String -> Maybe<&2, 0x9e6d2577f67543fbccdbfe8fd1789f27/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, 0x9e6d2577f67543fbccdbfe8fd1789f27/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:0x9e6d2577f67543fbccdbfe8fd1789f27/src/lib/u64.U64 -> 0x9e6d2577f67543fbccdbfe8fd1789f27/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, 0x9e6d2577f67543fbccdbfe8fd1789f27/src/lib/u64.U64> -> Maybe<&2, 0x9e6d2577f67543fbccdbfe8fd1789f27/src/lib/u64.U64>

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

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

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

@m:Maybe<&2, 0x9e6d2577f67543fbccdbfe8fd1789f27/src/lib/u64.U64> -> @+k:Nat -> Maybe<&2, 0x9e6d2577f67543fbccdbfe8fd1789f27/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, 0x9e6d2577f67543fbccdbfe8fd1789f27/src/lib/u64.U64>

def Cli.size source · line 238 · raw

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

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

@+dir:String -> @m:Maybe<&2, 0x9e6d2577f67543fbccdbfe8fd1789f27/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.con.keep source · line 279 · raw

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

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

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

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

@c:ConOpts -> ConOpts

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

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

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

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

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

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

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

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

def Cli.conlog source · line 323 · raw

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

def Cli.conlog_ok source · line 326 · raw

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

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

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

def Fwd.port source · line 361 · raw

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

A port: 1 to 65535.

def Fwd.mk source · line 364 · raw

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

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

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

def Fwd.parse source · line 381 · raw

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

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

def Fwd.specs source · line 384 · raw

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

def Fwd.max source · line 389 · raw

U32

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

def Fwd.ok source · line 392 · raw

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

def Fwd.all_ok source · line 400 · raw

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

Every spec of one --forward value parses.

def Cli.balloon source · line 414 · 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 417 · raw

@+v:String -> Bool

def Cli.balloon_on source · line 422 · raw

@+v:String -> Bool

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

def Cli.why source · line 425 · raw

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

def Cli.check source · line 438 · raw

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

The first thing wrong with the arguments (flag and value pairs), or "".