mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-07 09:41:30 +00:00
DM: VMcfg: support --dump options
run 'acrn-dm --dump <index>' to show build-in parameters Tracked-On: #1528 Acked-by: Yin Fengwei <fengwei.yin@intel.com> Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
This commit is contained in:
committed by
wenlingz
parent
67d7292081
commit
c86da0034e
@@ -6,6 +6,7 @@
|
||||
#include <vmcfg_config.h>
|
||||
#include <vmcfg.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
|
||||
void vmcfg_list(void)
|
||||
{
|
||||
@@ -18,6 +19,39 @@ void vmcfg_list(void)
|
||||
}
|
||||
}
|
||||
|
||||
void vmcfg_dump(int index, struct option *long_options, char *optstr)
|
||||
{
|
||||
char **argv;
|
||||
int argc;
|
||||
int c, option_idx = 0;
|
||||
int i = 1;
|
||||
|
||||
if ((index <= 0) || (index > num_args_buildin)) {
|
||||
fprintf(stderr, "%s(%d) index should be 1~%d\n", __FUNCTION__,
|
||||
index, num_args_buildin);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args_buildin[index - 1]->setup)
|
||||
args_buildin[index - 1]->setup();
|
||||
|
||||
argv = args_buildin[index - 1]->argv;
|
||||
argc = args_buildin[index - 1]->argc;
|
||||
|
||||
printf("%s build-in args:\n", argv[argc - 1]);
|
||||
|
||||
optind = 0;
|
||||
|
||||
while ((c = getopt_long(argc, argv, optstr, long_options,
|
||||
&option_idx)) != -1) {
|
||||
if (optarg)
|
||||
printf("%s %s\n", argv[i], optarg);
|
||||
else
|
||||
printf("%s\n", argv[i]);
|
||||
i = optind;
|
||||
}
|
||||
}
|
||||
|
||||
static struct vmcfg_arg *vmcfg_buildin_args[] = {
|
||||
#ifdef CONFIG_MRB_VM1
|
||||
&mrb_vm1_args,
|
||||
|
||||
Reference in New Issue
Block a user