From e28b8d21b0c8446f5e088b084e5f70e0097ca93f Mon Sep 17 00:00:00 2001 From: Mykyta Poturai Date: Tue, 2 Apr 2024 11:21:37 +0300 Subject: [PATCH] xen-shell-cmd: Add command to list available domain configurations Add a new command to list available domain configurations. Signed-off-by: Mykyta Poturai Tested-by: Grygorii Strashko --- xen-shell-cmd/src/xen_cmds.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xen-shell-cmd/src/xen_cmds.c b/xen-shell-cmd/src/xen_cmds.c index 965573e9..58d1d611 100644 --- a/xen-shell-cmd/src/xen_cmds.c +++ b/xen-shell-cmd/src/xen_cmds.c @@ -139,6 +139,28 @@ int domu_unpause(const struct shell *shell, size_t argc, char **argv) return domain_unpause(domid); } +int xen_config_list(const struct shell *shell, size_t argc, char **argv) +{ + __maybe_unused struct xen_domain_cfg *cfg; + int i; + + ARG_UNUSED(argc); + ARG_UNUSED(argv); + + for (i = 0; i < domain_get_user_cfg_count(); i++) { + cfg = domain_get_user_cfg(i); + shell_print(shell, "%s", cfg->name); + } + +#ifdef CONFIG_XEN_DOMCFG_SECTION + for (cfg = _domain_configs_start; cfg < _domain_configs_end; cfg++) { + shell_print(shell, "%s", cfg->name); + } +#endif + + return 0; +} + SHELL_STATIC_SUBCMD_SET_CREATE( subcmd_xu, SHELL_CMD_ARG(create, NULL, @@ -157,6 +179,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE( " Unpause Xen domain\n" " Usage: unpause \n", domu_unpause, 2, 0), + SHELL_CMD_ARG(config_list, NULL, + " List available domain configurations\n", + xen_config_list, 1, 0), #ifdef CONFIG_XEN_CONSOLE_SRV SHELL_CMD_ARG(console, NULL, " Attach to a domain console.\n"