Libxl has now been fully adjusted not to need them.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
callbacks->suspend = libxl__domain_suspend_callback;
callbacks->switch_qemu_logdirty = libxl__domain_suspend_common_switch_qemu_logdirty;
- dss->sws.shs.callbacks.save.toolstack_save = libxl__toolstack_save;
dss->sws.ao = dss->ao;
dss->sws.dss = dss;
typedef struct libxl__srm_save_callbacks {
libxl__srm_save_autogen_callbacks a;
- int (*toolstack_save)(uint32_t domid, uint8_t **buf,
- uint32_t *len, void *data);
} libxl__srm_save_callbacks;
typedef struct libxl__srm_restore_callbacks {
libxl__save_helper_state *shs)
{
STATE_AO_GC(dss->ao);
- int r, rc, toolstack_data_fd = -1;
- uint32_t toolstack_data_len = 0;
-
- /* Resources we need to free */
- uint8_t *toolstack_data_buf = 0;
unsigned cbflags =
libxl__srm_callout_enumcallbacks_save(&shs->callbacks.save.a);
- 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; }
-
- 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(shs->toolstack_data_file);
-
- r = libxl_write_exactly(CTX, toolstack_data_fd,
- toolstack_data_buf, toolstack_data_len,
- "toolstack data tmpfile", 0);
- if (r) { rc = ERROR_FAIL; goto out; }
-
- /* file position must be reset before passing to libxl-save-helper. */
- r = lseek(toolstack_data_fd, 0, SEEK_SET);
- if (r) { rc = ERROR_FAIL; goto out; }
- }
-
const unsigned long argnums[] = {
dss->domid, 0, 0, dss->xcflags, dss->hvm,
- toolstack_data_fd, toolstack_data_len,
cbflags,
};
shs->caller_state = dss;
shs->need_results = 0;
- free(toolstack_data_buf);
-
run_helper(egc, shs, "--save-domain", dss->fd,
- &toolstack_data_fd, 1,
+ NULL, 0,
argnums, ARRAY_SIZE(argnums));
return;
-
- out:
- free(toolstack_data_buf);
- if (shs->toolstack_data_file) fclose(shs->toolstack_data_file);
-
- libxl__xc_domain_save_done(egc, dss, rc, 0, 0);
}
/*----- other callbacks -----*/
-static int toolstack_save_fd;
-static uint32_t toolstack_save_len;
static struct save_callbacks helper_save_callbacks;
-static int toolstack_save_cb(uint32_t domid, uint8_t **buf,
- uint32_t *len, void *data)
-{
- int r;
-
- assert(toolstack_save_fd > 0);
-
- /* This is a hack for remus */
- if (helper_save_callbacks.checkpoint) {
- r = lseek(toolstack_save_fd, 0, SEEK_SET);
- if (r) fail(errno,"rewind toolstack data tmpfile");
- }
-
- *buf = xmalloc(toolstack_save_len);
- r = read_exactly(toolstack_save_fd, *buf, toolstack_save_len);
- if (r<0) fail(errno,"read toolstack data");
- if (r==0) fail(0,"read toolstack data eof");
-
- *len = toolstack_save_len;
- return 0;
-}
-
static void startup(const char *op) {
xtl_log(&logger,XTL_DEBUG,0,program,"starting %s",op);
uint32_t max_factor = strtoul(NEXTARG,0,10);
uint32_t flags = strtoul(NEXTARG,0,10);
int hvm = atoi(NEXTARG);
- toolstack_save_fd = atoi(NEXTARG);
- toolstack_save_len = strtoul(NEXTARG,0,10);
unsigned cbflags = strtoul(NEXTARG,0,10);
assert(!*++argv);
- if (toolstack_save_fd >= 0)
- helper_save_callbacks.toolstack_save = toolstack_save_cb;
-
helper_setcallbacks_save(&helper_save_callbacks, cbflags);
startup("save");
[ 5, 'srcxA', "checkpoint", [] ],
[ 6, 'scxA', "switch_qemu_logdirty", [qw(int domid
unsigned enable)] ],
- # toolstack_save done entirely `by hand'
- [ 7, 'rcxW', "toolstack_restore", [qw(uint32_t domid
- BLOCK tsdata)] ],
- [ 8, 'r', "restore_results", ['unsigned long', 'store_mfn',
+ [ 7, 'r', "restore_results", ['unsigned long', 'store_mfn',
'unsigned long', 'console_mfn'] ],
- [ 9, 'srW', "complete", [qw(int retval
+ [ 8, 'srW', "complete", [qw(int retval
int errnoval)] ],
);