rc = ERROR_INVAL;
goto out;
}
- libxl__xc_domain_restore(egc, dcs,
+ libxl__xc_domain_restore(egc, dcs, &dcs->shs,
hvm, pae, superpages);
return;
unsigned long console_mfn, void *user)
{
libxl__save_helper_state *shs = user;
- libxl__domain_create_state *dcs = CONTAINER_OF(shs, *dcs, shs);
+ libxl__domain_create_state *dcs = shs->caller_state;
STATE_AO_GC(dcs->ao);
libxl__domain_build_state *const state = &dcs->build_state;
uint32_t size, void *user)
{
libxl__save_helper_state *shs = user;
- libxl__domain_create_state *dcs = CONTAINER_OF(shs, *dcs, shs);
+ libxl__domain_create_state *dcs = shs->caller_state;
STATE_AO_GC(dcs->ao);
int ret;
uint32_t version = 0, bufsize;
libxl__save_helper_state *shs)
{
libxl__egc *egc = shs->egc;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__domain_suspend_state *dss = shs->caller_state;
libxl__logdirty_switch *lds = &dss->logdirty;
STATE_AO_GC(dss->ao);
int rc;
libxl__save_helper_state *shs)
{
libxl__egc *egc = shs->egc;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__domain_suspend_state *dss = shs->caller_state;
STATE_AO_GC(dss->ao);
int rc;
{
libxl__save_helper_state *shs = user;
libxl__egc *egc = shs->egc;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__domain_suspend_state *dss = shs->caller_state;
STATE_AO_GC(dss->ao);
switch (libxl__device_model_version_running(gc, domid)) {
{
libxl__save_helper_state *shs = data;
libxl__egc *egc = shs->egc;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__domain_suspend_state *dss = shs->caller_state;
dss->callback_common_done = domain_suspend_callback_common_done;
domain_suspend_callback_common(egc, dss);
{
libxl__save_helper_state *shs = data;
libxl__egc *egc = shs->egc;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__domain_suspend_state *dss = shs->caller_state;
dss->callback_common_done = remus_domain_suspend_callback_common_done;
domain_suspend_callback_common(egc, dss);
{
libxl__save_helper_state *shs = data;
libxl__egc *egc = shs->egc;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__domain_suspend_state *dss = shs->caller_state;
STATE_AO_GC(dss->ao);
libxl__remus_devices_state *const rds = &dss->rds;
static void libxl__remus_domain_checkpoint_callback(void *data)
{
libxl__save_helper_state *shs = data;
- libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
- libxl__egc *egc = dss->shs.egc;
+ libxl__domain_suspend_state *dss = shs->caller_state;
+ libxl__egc *egc = shs->egc;
STATE_AO_GC(dss->ao);
/* This would go into tailbuf. */
callbacks->switch_qemu_logdirty = libxl__domain_suspend_common_switch_qemu_logdirty;
dss->shs.callbacks.save.toolstack_save = libxl__toolstack_save;
- libxl__xc_domain_save(egc, dss);
+ libxl__xc_domain_save(egc, dss, &dss->shs);
return;
out:
/* calls libxl__xc_domain_suspend_done when done */
-_hidden void libxl__xc_domain_save(libxl__egc*, libxl__domain_suspend_state*);
+_hidden void libxl__xc_domain_save(libxl__egc *egc,
+ libxl__domain_suspend_state *dss,
+ libxl__save_helper_state *shs);
/* If rc==0 then retval is the return value from xc_domain_save
* and errnoval is the errno value it provided.
* If rc!=0, retval and errnoval are undefined. */
/* calls libxl__xc_domain_restore_done when done */
_hidden void libxl__xc_domain_restore(libxl__egc *egc,
libxl__domain_create_state *dcs,
+ libxl__save_helper_state *shs,
int hvm, int pae, int superpages);
/* If rc==0 then retval is the return value from xc_domain_save
* and errnoval is the errno value it provided.
/*----- entrypoints -----*/
void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs,
+ libxl__save_helper_state *shs,
int hvm, int pae, int superpages)
{
STATE_AO_GC(dcs->ao);
const int restore_fd = dcs->libxc_fd;
libxl__domain_build_state *const state = &dcs->build_state;
- unsigned cbflags = libxl__srm_callout_enumcallbacks_restore
- (&dcs->shs.callbacks.restore.a);
+ unsigned cbflags =
+ libxl__srm_callout_enumcallbacks_restore(&shs->callbacks.restore.a);
const unsigned long argnums[] = {
domid,
cbflags, dcs->restore_params.checkpointed_stream,
};
- dcs->shs.ao = ao;
- dcs->shs.domid = domid;
- dcs->shs.recv_callback = libxl__srm_callout_received_restore;
- dcs->shs.completion_callback = libxl__xc_domain_restore_done;
- dcs->shs.caller_state = dcs;
- dcs->shs.need_results = 1;
- dcs->shs.toolstack_data_file = 0;
+ shs->ao = ao;
+ shs->domid = domid;
+ shs->recv_callback = libxl__srm_callout_received_restore;
+ shs->completion_callback = libxl__xc_domain_restore_done;
+ shs->caller_state = dcs;
+ shs->need_results = 1;
+ shs->toolstack_data_file = 0;
- run_helper(egc, &dcs->shs, "--restore-domain", restore_fd, 0,0,
+ run_helper(egc, shs, "--restore-domain", restore_fd, 0, 0,
argnums, ARRAY_SIZE(argnums));
}
-void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss)
+void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss,
+ libxl__save_helper_state *shs)
{
STATE_AO_GC(dss->ao);
int r, rc, toolstack_data_fd = -1;
/* Resources we need to free */
uint8_t *toolstack_data_buf = 0;
- unsigned cbflags = libxl__srm_callout_enumcallbacks_save
- (&dss->shs.callbacks.save.a);
+ unsigned cbflags =
+ libxl__srm_callout_enumcallbacks_save(&shs->callbacks.save.a);
- if (dss->shs.callbacks.save.toolstack_save) {
- r = dss->shs.callbacks.save.toolstack_save
+ if (shs->callbacks.save.toolstack_save) {
+ r = shs->callbacks.save.toolstack_save
(dss->domid, &toolstack_data_buf, &toolstack_data_len, dss);
if (r) { rc = ERROR_FAIL; goto out; }
- dss->shs.toolstack_data_file = tmpfile();
- if (!dss->shs.toolstack_data_file) {
+ shs->toolstack_data_file = tmpfile();
+ if (!shs->toolstack_data_file) {
LOGE(ERROR, "cannot create toolstack data tmpfile");
rc = ERROR_FAIL;
goto out;
}
- toolstack_data_fd = fileno(dss->shs.toolstack_data_file);
+ toolstack_data_fd = fileno(shs->toolstack_data_file);
r = libxl_write_exactly(CTX, toolstack_data_fd,
toolstack_data_buf, toolstack_data_len,
cbflags,
};
- dss->shs.ao = ao;
- dss->shs.domid = dss->domid;
- dss->shs.recv_callback = libxl__srm_callout_received_save;
- dss->shs.completion_callback = libxl__xc_domain_save_done;
- dss->shs.caller_state = dss;
- dss->shs.need_results = 0;
+ shs->ao = ao;
+ shs->domid = dss->domid;
+ shs->recv_callback = libxl__srm_callout_received_save;
+ shs->completion_callback = libxl__xc_domain_save_done;
+ shs->caller_state = dss;
+ shs->need_results = 0;
free(toolstack_data_buf);
- run_helper(egc, &dss->shs, "--save-domain", dss->fd,
+ run_helper(egc, shs, "--save-domain", dss->fd,
&toolstack_data_fd, 1,
argnums, ARRAY_SIZE(argnums));
return;
out:
free(toolstack_data_buf);
- if (dss->shs.toolstack_data_file) fclose(dss->shs.toolstack_data_file);
+ if (shs->toolstack_data_file) fclose(shs->toolstack_data_file);
libxl__xc_domain_save_done(egc, dss, rc, 0, 0);
}