mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
tools/libxl: remove unused function libxl__domain_save_device_model()
After the commit d77570e7, libxl__domain_save_device_model() is
completely unused and can be dropped.
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
8bb1c7abda
commit
fa86649c48
3 files changed
-101
No files matched your search
@@ -1550,10 +1550,6 @@ static void stubdom_destroy_callback(libxl__egc *egc,
|
||||
dds->stubdom_finished = 1;
|
||||
savefile = libxl__device_model_savefile(gc, dis->domid);
|
||||
rc = libxl__remove_file(gc, savefile);
|
||||
/*
|
||||
* On suspend libxl__domain_save_device_model will have already
|
||||
* unlinked the save file.
|
||||
*/
|
||||
if (rc) {
|
||||
LOG(ERROR, "failed to remove device-model savefile %s", savefile);
|
||||
}
|
||||
|
||||
@@ -1785,97 +1785,6 @@ static void stream_done(libxl__egc *egc,
|
||||
domain_save_done(egc, sws->dss, rc);
|
||||
}
|
||||
|
||||
static void save_device_model_datacopier_done(libxl__egc *egc,
|
||||
libxl__datacopier_state *dc, int rc, int onwrite, int errnoval);
|
||||
|
||||
void libxl__domain_save_device_model(libxl__egc *egc,
|
||||
libxl__domain_suspend_state *dss,
|
||||
libxl__save_device_model_cb *callback)
|
||||
{
|
||||
STATE_AO_GC(dss->ao);
|
||||
struct stat st;
|
||||
uint32_t qemu_state_len;
|
||||
int rc;
|
||||
|
||||
dss->save_dm_callback = callback;
|
||||
|
||||
/* Convenience aliases */
|
||||
const char *const filename = dss->dm_savefile;
|
||||
const int fd = dss->fd;
|
||||
|
||||
libxl__datacopier_state *dc = &dss->save_dm_datacopier;
|
||||
memset(dc, 0, sizeof(*dc));
|
||||
dc->readwhat = GCSPRINTF("qemu save file %s", filename);
|
||||
dc->ao = ao;
|
||||
dc->readfd = -1;
|
||||
dc->writefd = fd;
|
||||
dc->maxsz = INT_MAX;
|
||||
dc->bytes_to_read = -1;
|
||||
dc->copywhat = GCSPRINTF("qemu save file for domain %"PRIu32, dss->domid);
|
||||
dc->writewhat = "save/migration stream";
|
||||
dc->callback = save_device_model_datacopier_done;
|
||||
|
||||
dc->readfd = open(filename, O_RDONLY);
|
||||
if (dc->readfd < 0) {
|
||||
LOGE(ERROR, "unable to open %s", dc->readwhat);
|
||||
rc = ERROR_FAIL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fstat(dc->readfd, &st))
|
||||
{
|
||||
LOGE(ERROR, "unable to fstat %s", dc->readwhat);
|
||||
rc = ERROR_FAIL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!S_ISREG(st.st_mode)) {
|
||||
LOG(ERROR, "%s is not a plain file!", dc->readwhat);
|
||||
rc = ERROR_FAIL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
qemu_state_len = st.st_size;
|
||||
LOG(DEBUG, "%s is %d bytes", dc->readwhat, qemu_state_len);
|
||||
|
||||
rc = libxl__datacopier_start(dc);
|
||||
if (rc) goto out;
|
||||
|
||||
libxl__datacopier_prefixdata(egc, dc,
|
||||
QEMU_SIGNATURE, strlen(QEMU_SIGNATURE));
|
||||
|
||||
libxl__datacopier_prefixdata(egc, dc,
|
||||
&qemu_state_len, sizeof(qemu_state_len));
|
||||
return;
|
||||
|
||||
out:
|
||||
save_device_model_datacopier_done(egc, dc, rc, -1, EIO);
|
||||
}
|
||||
|
||||
static void save_device_model_datacopier_done(libxl__egc *egc,
|
||||
libxl__datacopier_state *dc, int our_rc, int onwrite, int errnoval)
|
||||
{
|
||||
libxl__domain_suspend_state *dss =
|
||||
CONTAINER_OF(dc, *dss, save_dm_datacopier);
|
||||
STATE_AO_GC(dss->ao);
|
||||
|
||||
/* Convenience aliases */
|
||||
const char *const filename = dss->dm_savefile;
|
||||
int rc;
|
||||
|
||||
libxl__datacopier_kill(dc);
|
||||
|
||||
if (dc->readfd >= 0) {
|
||||
close(dc->readfd);
|
||||
dc->readfd = -1;
|
||||
}
|
||||
|
||||
rc = libxl__remove_file(gc, filename);
|
||||
if (!our_rc) our_rc = rc;
|
||||
|
||||
dss->save_dm_callback(egc, dss, our_rc);
|
||||
}
|
||||
|
||||
static void libxl__remus_teardown(libxl__egc *egc,
|
||||
libxl__domain_suspend_state *dss,
|
||||
int rc);
|
||||
|
||||
@@ -3103,9 +3103,6 @@ struct libxl__domain_suspend_state {
|
||||
libxl__logdirty_switch logdirty;
|
||||
void (*callback_common_done)(libxl__egc*,
|
||||
struct libxl__domain_suspend_state*, int ok);
|
||||
/* private for libxl__domain_save_device_model */
|
||||
libxl__save_device_model_cb *save_dm_callback;
|
||||
libxl__datacopier_state save_dm_datacopier;
|
||||
};
|
||||
|
||||
|
||||
@@ -3498,9 +3495,6 @@ static inline bool libxl__save_helper_inuse(const libxl__save_helper_state *shs)
|
||||
/* Each time the dm needs to be saved, we must call suspend and then save */
|
||||
_hidden int libxl__domain_suspend_device_model(libxl__gc *gc,
|
||||
libxl__domain_suspend_state *dss);
|
||||
_hidden void libxl__domain_save_device_model(libxl__egc *egc,
|
||||
libxl__domain_suspend_state *dss,
|
||||
libxl__save_device_model_cb *callback);
|
||||
|
||||
_hidden const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid);
|
||||
|
||||
|
||||