tools/libxl: Drop xc_domain_configuration_t from libxl__domain_build_state

The data it stores is initialised and exclusively used within
libxl__domain_make(), with the important details written back elsewhere by
libxl__arch_domain_save_config().  Prepare xc_config on libxl__domain_make()'s
stack, and drop the parameter.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Andrew Cooper committed 2018-04-05 10:43:13 +01:00
1 parent 4510046032
commit 74fd984ae6
3 files changed
+8 -12

No files matched your search

+6 -6
View File
@@ -538,7 +538,7 @@ out:
}
int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
uint32_t *domid, xc_domain_configuration_t *xc_config)
uint32_t *domid)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
int flags, ret, rc, nb_vm;
@@ -551,6 +551,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
xs_transaction_t t = 0;
xen_domain_handle_t handle;
libxl_vminfo *vm_list;
xc_domain_configuration_t xc_config = {};
/* convenience aliases */
libxl_domain_create_info *info = &d_config->c_info;
@@ -571,7 +572,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
/* Ultimately, handle is an array of 16 uint8_t, same as uuid */
libxl_uuid_copy(ctx, (libxl_uuid *)handle, &info->uuid);
ret = libxl__arch_domain_prepare_config(gc, d_config, xc_config);
ret = libxl__arch_domain_prepare_config(gc, d_config, &xc_config);
if (ret < 0) {
LOGED(ERROR, *domid, "fail to get domain config");
rc = ERROR_FAIL;
@@ -581,7 +582,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
/* Valid domid here means we're soft resetting. */
if (!libxl_domid_valid_guest(*domid)) {
ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid,
xc_config);
&xc_config);
if (ret < 0) {
LOGED(ERROR, *domid, "domain creation fail");
rc = ERROR_FAIL;
@@ -589,7 +590,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
}
}
rc = libxl__arch_domain_save_config(gc, d_config, xc_config);
rc = libxl__arch_domain_save_config(gc, d_config, &xc_config);
if (rc < 0)
goto out;
@@ -822,7 +823,6 @@ static void initiate_domain_create(libxl__egc *egc,
/* convenience aliases */
libxl_domain_config *const d_config = dcs->guest_config;
libxl__domain_build_state *const state = &dcs->build_state;
const int restore_fd = dcs->restore_fd;
domid = dcs->domid_soft_reset;
@@ -957,7 +957,7 @@ static void initiate_domain_create(libxl__egc *egc,
goto error_out;
}
ret = libxl__domain_make(gc, d_config, &domid, &state->config);
ret = libxl__domain_make(gc, d_config, &domid);
if (ret) {
LOGD(ERROR, domid, "cannot make domain: %d", ret);
dcs->guest_domid = domid;
+1 -2
View File
@@ -1960,8 +1960,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
stubdom_state->pv_ramdisk.path = "";
/* fixme: this function can leak the stubdom if it fails */
ret = libxl__domain_make(gc, dm_config, &sdss->pvqemu.guest_domid,
&stubdom_state->config);
ret = libxl__domain_make(gc, dm_config, &sdss->pvqemu.guest_domid);
if (ret)
goto out;
uint32_t dm_domid = sdss->pvqemu.guest_domid;
+1 -4
View File
@@ -1145,8 +1145,6 @@ typedef struct {
xen_vmemrange_t *vmemranges;
uint32_t num_vmemranges;
xc_domain_configuration_t config;
xen_pfn_t vuart_gfn;
evtchn_port_t vuart_port;
} libxl__domain_build_state;
@@ -1657,8 +1655,7 @@ _hidden void libxl__exec(libxl__gc *gc, int stdinfd, int stdoutfd,
* on exit (even error exit), domid may be valid and refer to a domain */
_hidden int libxl__domain_make(libxl__gc *gc,
libxl_domain_config *d_config,
uint32_t *domid,
xc_domain_configuration_t *xc_config);
uint32_t *domid);
_hidden int libxl__domain_build(libxl__gc *gc,
libxl_domain_config *d_config,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.