Skip to content

Commit 7315515

Browse files
taoyuhongacrnsi
authored andcommitted
DM: Cleanup vmcfg APIs usage for removing the entire vmcfg
Vmcfg is useless and should be removed. Before removing vmcfg code, cleanup vmcfg APIs in core/main.c Tracked-On: #3192 Acked-by: Anthony Xu <anthony.xu@intel.com> Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
1 parent a307317 commit 7315515

File tree

1 file changed

+1
-56
lines changed

1 file changed

+1
-56
lines changed

devicemodel/core/main.c

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
#include "ioc.h"
6363
#include "pm.h"
6464
#include "atomic.h"
65-
#include "vmcfg_config.h"
66-
#include "vmcfg.h"
6765
#include "tpm.h"
6866
#include "virtio.h"
6967
#include "log.h"
@@ -748,8 +746,6 @@ static struct option long_options[] = {
748746

749747
/* Following cmd option only has long option */
750748
#ifdef CONFIG_VM_CFG
751-
{"vmcfg", required_argument, 0, CMD_OPT_VMCFG},
752-
{"dump", required_argument, 0, CMD_OPT_DUMP},
753749
#endif
754750
{"vsbl", required_argument, 0, CMD_OPT_VSBL},
755751
{"ovmf", required_argument, 0, CMD_OPT_OVMF},
@@ -772,7 +768,7 @@ static struct option long_options[] = {
772768
static char optstr[] = "hAWYvE:k:r:B:p:c:s:m:l:U:G:i:";
773769

774770
int
775-
dm_run(int argc, char *argv[])
771+
main(int argc, char *argv[])
776772
{
777773
int c, error, err;
778774
int max_vcpus, mptgen;
@@ -1069,54 +1065,3 @@ dm_run(int argc, char *argv[])
10691065
vm_destroy(ctx);
10701066
exit(0);
10711067
}
1072-
1073-
int main(int argc, char *argv[])
1074-
{
1075-
int c;
1076-
int option_idx = 0;
1077-
int dm_options = 0, vmcfg = 0;
1078-
int index = -1;
1079-
1080-
while ((c = getopt_long(argc, argv, optstr, long_options,
1081-
&option_idx)) != -1) {
1082-
switch (c) {
1083-
case CMD_OPT_VMCFG:
1084-
vmcfg = 1;
1085-
dm_strtoi(optarg, NULL, 0, &index);
1086-
break;
1087-
case CMD_OPT_DUMP:
1088-
dm_strtoi(optarg, NULL, 0, &index);
1089-
vmcfg_dump(index, long_options, optstr);
1090-
return 0;
1091-
default:
1092-
dm_options++;
1093-
}
1094-
}
1095-
1096-
if (!vmcfg) {
1097-
optind = 0;
1098-
return dm_run(argc, argv);
1099-
}
1100-
1101-
if (dm_options)
1102-
fprintf(stderr, "Waring: --vmcfg override optional args\n");
1103-
1104-
if (index <= 0) {
1105-
vmcfg_list();
1106-
return -1;
1107-
}
1108-
1109-
if (index > num_args_buildin) {
1110-
fprintf(stderr, "Error: --vmcfg %d, max index is %d\n",
1111-
index, num_args_buildin);
1112-
return -1;
1113-
}
1114-
1115-
optind = 0;
1116-
index--;
1117-
args_buildin[index]->argv[0] = argv[0];
1118-
if (args_buildin[index]->setup)
1119-
args_buildin[index]->setup();
1120-
1121-
return dm_run(args_buildin[index]->argc, args_buildin[index]->argv);
1122-
}

0 commit comments

Comments
 (0)