diff --git a/xen-dom-mgmt/include/xen_dom_mgmt.h b/xen-dom-mgmt/include/xen_dom_mgmt.h index 07633742..0d02412c 100644 --- a/xen-dom-mgmt/include/xen_dom_mgmt.h +++ b/xen-dom-mgmt/include/xen_dom_mgmt.h @@ -19,6 +19,8 @@ int domain_pause(uint32_t domid); int domain_unpause(uint32_t domid); int domain_post_create(const struct xen_domain_cfg *domcfg, uint32_t domid); struct xen_domain_cfg *domain_find_config(char *name); +int domain_get_user_cfg_count(void); +struct xen_domain_cfg *domain_get_user_cfg(int index); #ifdef CONFIG_XEN_DOMCFG_SECTION #define DECL_CONFIG static __section(".domain_configs") __used diff --git a/xen-dom-mgmt/src/xen-dom-mgmt.c b/xen-dom-mgmt/src/xen-dom-mgmt.c index 62917e5e..02fec1ff 100644 --- a/xen-dom-mgmt/src/xen-dom-mgmt.c +++ b/xen-dom-mgmt/src/xen-dom-mgmt.c @@ -901,6 +901,28 @@ int domain_post_create(const struct xen_domain_cfg *domcfg, uint32_t domid) return rc; } +/** + * This function returns the count of user configurations for a domain. + * + * @return The count of user configurations. + */ +__weak int domain_get_user_cfg_count(void) +{ + return 0; +} + +/** + * This function returns the user configuration for a domain specified by the given index. + * + * @param id The ID of the domain. + * @return The user configuration for the domain, or NULL if not found. + */ +__weak struct xen_domain_cfg *domain_get_user_cfg(int index) +{ + ARG_UNUSED(index); + return NULL; +} + /** * Find the configuration for a Xen domain by name. * @@ -910,6 +932,14 @@ int domain_post_create(const struct xen_domain_cfg *domcfg, uint32_t domid) struct xen_domain_cfg *domain_find_config(char *name) { __maybe_unused struct xen_domain_cfg *cfg = NULL; + int i; + + for (i = 0; i < domain_get_user_cfg_count(); i++) { + cfg = domain_get_user_cfg(i); + if (strncmp(cfg->name, name, CONTAINER_NAME_SIZE) == 0) { + return cfg; + } + } #ifdef CONFIG_XEN_DOMCFG_SECTION for (cfg = _domain_configs_start; cfg < _domain_configs_end; cfg++) {