Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | usage(int code) | ||||
" -C: include guest memory in core file\n" | " -C: include guest memory in core file\n" | ||||
" -c: number of CPUs and/or topology specification\n" | " -c: number of CPUs and/or topology specification\n" | ||||
" -D: destroy on power-off\n" | " -D: destroy on power-off\n" | ||||
" -e: exit on unhandled I/O access\n" | " -e: exit on unhandled I/O access\n" | ||||
" -G: start a debug server\n" | " -G: start a debug server\n" | ||||
" -H: vmexit from the guest on HLT\n" | " -H: vmexit from the guest on HLT\n" | ||||
" -h: help\n" | " -h: help\n" | ||||
" -k: key=value flat config file\n" | " -k: key=value flat config file\n" | ||||
" -K: PS2 keyboard layout\n" | |||||
" -l: LPC device configuration\n" | " -l: LPC device configuration\n" | ||||
" -m: memory size in MB\n" | " -m: memory size in MB\n" | ||||
" -o: set config 'var' to 'value'\n" | " -o: set config 'var' to 'value'\n" | ||||
" -P: vmexit from the guest on pause\n" | " -P: vmexit from the guest on pause\n" | ||||
" -p: pin 'vcpu' to 'hostcpu'\n" | " -p: pin 'vcpu' to 'hostcpu'\n" | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
" -r: path to checkpoint file\n" | " -r: path to checkpoint file\n" | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 997 Lines • ▼ Show 20 Lines | #ifdef BHYVE_SNAPSHOT | ||||
restore_file = NULL; | restore_file = NULL; | ||||
#endif | #endif | ||||
init_config(); | init_config(); | ||||
set_defaults(); | set_defaults(); | ||||
progname = basename(argv[0]); | progname = basename(argv[0]); | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:r:"; | optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:r:"; | ||||
#else | #else | ||||
optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:"; | optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:"; | ||||
#endif | #endif | ||||
while ((c = getopt(argc, argv, optstr)) != -1) { | while ((c = getopt(argc, argv, optstr)) != -1) { | ||||
switch (c) { | switch (c) { | ||||
case 'a': | case 'a': | ||||
set_config_bool("x86.x2apic", false); | set_config_bool("x86.x2apic", false); | ||||
break; | break; | ||||
case 'A': | case 'A': | ||||
set_config_bool("acpi_tables", true); | set_config_bool("acpi_tables", true); | ||||
break; | break; | ||||
case 'D': | case 'D': | ||||
set_config_bool("destroy_on_poweroff", true); | set_config_bool("destroy_on_poweroff", true); | ||||
break; | break; | ||||
case 'p': | case 'p': | ||||
if (pincpu_parse(optarg) != 0) { | if (pincpu_parse(optarg) != 0) { | ||||
errx(EX_USAGE, "invalid vcpu pinning " | errx(EX_USAGE, "invalid vcpu pinning " | ||||
"configuration '%s'", optarg); | "configuration '%s'", optarg); | ||||
} | } | ||||
jhb: This should be setting a config variable instead so that config files can set it, and the code… | |||||
break; | break; | ||||
case 'c': | case 'c': | ||||
if (topology_parse(optarg) != 0) { | if (topology_parse(optarg) != 0) { | ||||
errx(EX_USAGE, "invalid cpu topology " | errx(EX_USAGE, "invalid cpu topology " | ||||
"'%s'", optarg); | "'%s'", optarg); | ||||
} | } | ||||
break; | break; | ||||
case 'C': | case 'C': | ||||
set_config_bool("memory.guest_in_core", true); | set_config_bool("memory.guest_in_core", true); | ||||
break; | break; | ||||
case 'G': | case 'G': | ||||
parse_gdb_options(optarg); | parse_gdb_options(optarg); | ||||
break; | break; | ||||
case 'k': | case 'k': | ||||
parse_simple_config_file(optarg); | parse_simple_config_file(optarg); | ||||
break; | |||||
case 'K': | |||||
set_config_value("keyboard.layout", optarg); | |||||
break; | break; | ||||
case 'l': | case 'l': | ||||
if (strncmp(optarg, "help", strlen(optarg)) == 0) { | if (strncmp(optarg, "help", strlen(optarg)) == 0) { | ||||
lpc_print_supported_devices(); | lpc_print_supported_devices(); | ||||
exit(0); | exit(0); | ||||
} else if (lpc_device_parse(optarg) != 0) { | } else if (lpc_device_parse(optarg) != 0) { | ||||
errx(EX_USAGE, "invalid lpc device " | errx(EX_USAGE, "invalid lpc device " | ||||
"configuration '%s'", optarg); | "configuration '%s'", optarg); | ||||
▲ Show 20 Lines • Show All 306 Lines • Show Last 20 Lines |
This should be setting a config variable instead so that config files can set it, and the code to fetch it should not use the global variable, but fetch the relevant config setting instead. You'd also need to document the new config variable in bhyve_config.5.