From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wen Congyang Subject: [RFC Patch 05/25] rename remus device to checkpoint device Date: Fri, 18 Jul 2014 19:38:50 +0800 Message-ID: <1405683551-12579-6-git-send-email-wency@cn.fujitsu.com> References: <1405683551-12579-1-git-send-email-wency@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1405683551-12579-1-git-send-email-wency@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen devel Cc: Ian Campbell , Wen Congyang , Ian Jackson , Jiang Yunhong , Dong Eddie , Yang Hongyang , Lai Jiangshan List-Id: xen-devel@lists.xenproject.org This patch is auto generated by the following commands: 1. git mv tools/libxl/libxl_remus_device.c tools/libxl/libxl_checkpoint_device.c 2. perl -pi -e 's/libxl_remus_device/libxl_checkpoint_device/g' tools/libxl/Makefile 3. perl -pi -e 's/libxl__remus_device/libxl__checkpoint_device/g' tools/libxl/*.[ch] 4. perl -pi -e 's/remus_device_checkpoint_api/checkpoint_device_api/g' tools/libxl/*.[ch] 5. perl -pi -e 's/\brds\b/cds/g' tools/libxl/*.[ch] 6. perl -pi -e 's/REMUS_DEVICE/CHECKPOINT_DEVICE/g' tools/libxl/*.[ch] tools/libxl/*.idl 7. perl -pi -e 's/REMUS_DEVOPS/CHECKPOINT_DEVOPS/g' tools/libxl/*.[ch] tools/libxl/*.idl 8. perl -pi -e 's/\bremus\b/checkpoint/g' tools/libxl/libxl_checkpoint_device.[ch] Signed-off-by: Wen Congyang --- tools/libxl/Makefile | 2 +- tools/libxl/libxl.c | 36 +-- ...xl_remus_device.c => libxl_checkpoint_device.c} | 258 ++++++++++----------- tools/libxl/libxl_dom.c | 46 ++-- tools/libxl/libxl_internal.h | 102 ++++---- tools/libxl/libxl_netbuffer.c | 80 +++---- tools/libxl/libxl_nonetbuffer.c | 14 +- tools/libxl/libxl_remus_disk_drbd.c | 54 ++--- tools/libxl/libxl_types.idl | 4 +- 9 files changed, 298 insertions(+), 298 deletions(-) rename tools/libxl/{libxl_remus_device.c => libxl_checkpoint_device.c} (49%) diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index ba10ab7..a33497d 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -56,7 +56,7 @@ else LIBXL_OBJS-y += libxl_nonetbuffer.o endif -LIBXL_OBJS-y += libxl_remus_device.o libxl_remus_disk_drbd.o +LIBXL_OBJS-y += libxl_checkpoint_device.o libxl_remus_disk_drbd.o LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 94087ff..fc60bb1 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -782,13 +782,13 @@ out: } static void libxl__remus_setup_done(libxl__egc *egc, - libxl__remus_device_state *rds, int rc); + libxl__checkpoint_device_state *cds, int rc); static void libxl__remus_setup_failed(libxl__egc *egc, - libxl__remus_device_state *rds, int rc); + libxl__checkpoint_device_state *cds, int rc); static void remus_failover_cb(libxl__egc *egc, libxl__domain_suspend_state *dss, int rc); -static const libxl__remus_device_subkind_ops *remus_ops[] = { +static const libxl__checkpoint_device_subkind_ops *remus_ops[] = { &remus_device_nic, &remus_device_drbd_disk, NULL, @@ -823,7 +823,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, assert(info); /* Convenience aliases */ - libxl__remus_device_state *const rds = &dss->rds; + libxl__checkpoint_device_state *const cds = &dss->cds; if (info->netbuf) { if (!libxl__netbuffer_enabled(gc)) { @@ -841,18 +841,18 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, } } - rds->ao = ao; - rds->egc = egc; - rds->domid = domid; - rds->callback = libxl__remus_setup_done; - rds->ops = remus_ops; + cds->ao = ao; + cds->egc = egc; + cds->domid = domid; + cds->callback = libxl__remus_setup_done; + cds->ops = remus_ops; if (info->diskbuf) - rds->enabled_device_kinds |= LIBXL__REMUS_DEVICE_DISK; + cds->enabled_device_kinds |= LIBXL__CHECKPOINT_DEVICE_DISK; if (info->netbuf) - rds->enabled_device_kinds |= LIBXL__REMUS_DEVICE_NIC; + cds->enabled_device_kinds |= LIBXL__CHECKPOINT_DEVICE_NIC; /* Point of no return */ - libxl__remus_devices_setup(egc, rds); + libxl__checkpoint_devices_setup(egc, cds); return AO_INPROGRESS; out: @@ -860,9 +860,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, } static void libxl__remus_setup_done(libxl__egc *egc, - libxl__remus_device_state *rds, int rc) + libxl__checkpoint_device_state *cds, int rc) { - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); STATE_AO_GC(dss->ao); if (!rc) { @@ -872,14 +872,14 @@ static void libxl__remus_setup_done(libxl__egc *egc, LOG(ERROR, "Remus: failed to setup device for guest with domid %u, rc %d", dss->domid, rc); - rds->callback = libxl__remus_setup_failed; - libxl__remus_devices_teardown(egc, rds); + cds->callback = libxl__remus_setup_failed; + libxl__checkpoint_devices_teardown(egc, cds); } static void libxl__remus_setup_failed(libxl__egc *egc, - libxl__remus_device_state *rds, int rc) + libxl__checkpoint_device_state *cds, int rc) { - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); STATE_AO_GC(dss->ao); if (rc) diff --git a/tools/libxl/libxl_remus_device.c b/tools/libxl/libxl_checkpoint_device.c similarity index 49% rename from tools/libxl/libxl_remus_device.c rename to tools/libxl/libxl_checkpoint_device.c index 2acf3bb..87ee412 100644 --- a/tools/libxl/libxl_remus_device.c +++ b/tools/libxl/libxl_checkpoint_device.c @@ -19,13 +19,13 @@ /*----- helper functions -----*/ -static int init_device_subkind(libxl__remus_device_state *rds) +static int init_device_subkind(libxl__checkpoint_device_state *cds) { int rc; - const libxl__remus_device_subkind_ops **ops; + const libxl__checkpoint_device_subkind_ops **ops; - for (ops = rds->ops; *ops; ops++) { - rc = (*ops)->init(rds); + for (ops = cds->ops; *ops; ops++) { + rc = (*ops)->init(cds); if (rc) { goto out; } @@ -37,17 +37,17 @@ out: } -static void destroy_device_subkind(libxl__remus_device_state *rds) +static void destroy_device_subkind(libxl__checkpoint_device_state *cds) { - const libxl__remus_device_subkind_ops **ops; + const libxl__checkpoint_device_subkind_ops **ops; - for (ops = rds->ops; *ops; ops++) - (*ops)->destroy(rds); + for (ops = cds->ops; *ops; ops++) + (*ops)->destroy(cds); } -static bool all_devices_handled(libxl__remus_device_state *rds) +static bool all_devices_handled(libxl__checkpoint_device_state *cds) { - return rds->num_devices == (rds->num_nics + rds->num_disks); + return cds->num_devices == (cds->num_nics + cds->num_disks); } /*----- setup() and teardown() -----*/ @@ -55,85 +55,85 @@ static bool all_devices_handled(libxl__remus_device_state *rds) /* callbacks */ static void device_match_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc); static void device_setup_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc); static void device_teardown_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc); -/* remus device setup and teardown */ +/* checkpoint device setup and teardown */ -static void libxl__remus_device_init(libxl__egc *egc, - libxl__remus_device_state *rds, - libxl__remus_device_kind kind, +static void libxl__checkpoint_device_init(libxl__egc *egc, + libxl__checkpoint_device_state *cds, + libxl__checkpoint_device_kind kind, void *libxl_dev); -void libxl__remus_devices_setup(libxl__egc *egc, libxl__remus_device_state *rds) +void libxl__checkpoint_devices_setup(libxl__egc *egc, libxl__checkpoint_device_state *cds) { int i; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); - if (!rds->ops[0]) + if (!cds->ops[0]) goto out; - rds->saved_rc = init_device_subkind(rds); - if (rds->saved_rc) + cds->saved_rc = init_device_subkind(cds); + if (cds->saved_rc) goto out; - rds->num_devices = 0; - rds->num_nics = 0; - rds->num_disks = 0; + cds->num_devices = 0; + cds->num_nics = 0; + cds->num_disks = 0; - if (rds->enabled_device_kinds & LIBXL__REMUS_DEVICE_NIC) - rds->nics = libxl_device_nic_list(CTX, rds->domid, &rds->num_nics); + if (cds->enabled_device_kinds & LIBXL__CHECKPOINT_DEVICE_NIC) + cds->nics = libxl_device_nic_list(CTX, cds->domid, &cds->num_nics); - if (rds->enabled_device_kinds & LIBXL__REMUS_DEVICE_NIC) - rds->disks = libxl_device_disk_list(CTX, rds->domid, &rds->num_disks); + if (cds->enabled_device_kinds & LIBXL__CHECKPOINT_DEVICE_NIC) + cds->disks = libxl_device_disk_list(CTX, cds->domid, &cds->num_disks); - if (rds->num_nics == 0 && rds->num_disks == 0) + if (cds->num_nics == 0 && cds->num_disks == 0) goto out; - GCNEW_ARRAY(rds->dev, rds->num_nics + rds->num_disks); + GCNEW_ARRAY(cds->dev, cds->num_nics + cds->num_disks); - for (i = 0; i < rds->num_nics; i++) { - libxl__remus_device_init(egc, rds, - LIBXL__REMUS_DEVICE_NIC, &rds->nics[i]); + for (i = 0; i < cds->num_nics; i++) { + libxl__checkpoint_device_init(egc, cds, + LIBXL__CHECKPOINT_DEVICE_NIC, &cds->nics[i]); } - for (i = 0; i < rds->num_disks; i++) { - libxl__remus_device_init(egc, rds, - LIBXL__REMUS_DEVICE_DISK, &rds->disks[i]); + for (i = 0; i < cds->num_disks; i++) { + libxl__checkpoint_device_init(egc, cds, + LIBXL__CHECKPOINT_DEVICE_DISK, &cds->disks[i]); } return; out: - rds->callback(egc, rds, rds->saved_rc); + cds->callback(egc, cds, cds->saved_rc); return; } -static void libxl__remus_device_init(libxl__egc *egc, - libxl__remus_device_state *rds, - libxl__remus_device_kind kind, +static void libxl__checkpoint_device_init(libxl__egc *egc, + libxl__checkpoint_device_state *cds, + libxl__checkpoint_device_kind kind, void *libxl_dev) { - libxl__remus_device *dev = NULL; + libxl__checkpoint_device *dev = NULL; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); GCNEW(dev); dev->backend_dev = libxl_dev; dev->kind = kind; - dev->rds = rds; + dev->cds = cds; libxl__async_exec_init(&dev->aes); libxl__ev_child_init(&dev->child); /* match the ops begin */ dev->ops_index = 0; - dev->ops = rds->ops[dev->ops_index]; - for (; dev->ops; dev->ops = rds->ops[++dev->ops_index]) { + dev->ops = cds->ops[dev->ops_index]; + for (; dev->ops; dev->ops = cds->ops[++dev->ops_index]) { if (dev->ops->kind == dev->kind) { if (dev->ops->match) { dev->callback = device_match_cb; @@ -152,41 +152,41 @@ static void libxl__remus_device_init(libxl__egc *egc, } if (!dev->ops) { - rds->num_devices++; - rds->saved_rc = ERROR_REMUS_DEVICE_NOT_SUPPORTED; - if (all_devices_handled(rds)) - rds->callback(egc, rds, rds->saved_rc); + cds->num_devices++; + cds->saved_rc = ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED; + if (all_devices_handled(cds)) + cds->callback(egc, cds, cds->saved_rc); } } static void device_match_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc) { - libxl__remus_device_state *const rds = dev->rds; + libxl__checkpoint_device_state *const cds = dev->cds; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); - if (rds->saved_rc) { + if (cds->saved_rc) { /* there's already an error happened, we do not need to continue */ - rds->num_devices++; - if (all_devices_handled(rds)) - rds->callback(egc, rds, rds->saved_rc); + cds->num_devices++; + if (all_devices_handled(cds)) + cds->callback(egc, cds, cds->saved_rc); return; } if (rc) { /* the ops does not match, try next ops */ - dev->ops = rds->ops[++dev->ops_index]; - if (!dev->ops || rc != ERROR_REMUS_DEVOPS_NOT_MATCH) { + dev->ops = cds->ops[++dev->ops_index]; + if (!dev->ops || rc != ERROR_CHECKPOINT_DEVOPS_NOT_MATCH) { /* the device can not be matched */ - rds->num_devices++; - rds->saved_rc = ERROR_REMUS_DEVICE_NOT_SUPPORTED; - if (all_devices_handled(rds)) - rds->callback(egc, rds, rds->saved_rc); + cds->num_devices++; + cds->saved_rc = ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED; + if (all_devices_handled(cds)) + cds->callback(egc, cds, cds->saved_rc); return; } - for ( ; dev->ops; dev->ops = rds->ops[++dev->ops_index]) { + for ( ; dev->ops; dev->ops = cds->ops[++dev->ops_index]) { if (dev->ops->kind == dev->kind) { /* * we have entered match process, that means this *kind* of @@ -205,15 +205,15 @@ static void device_match_cb(libxl__egc *egc, } static void device_setup_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc) { /* Convenience aliases */ - libxl__remus_device_state *const rds = dev->rds; + libxl__checkpoint_device_state *const cds = dev->cds; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); - rds->num_devices++; + cds->num_devices++; /* * the netbuf script was designed as below: * 1. when setup failed, the script won't teardown the device itself. @@ -222,36 +222,36 @@ static void device_setup_cb(libxl__egc *egc, * we add devices that have been set up to the array no matter * the setup process succeed or failed because we need to ensure * the device been teardown while setup failed. If any of the - * device setup failed, we will quit remus, but before we exit, + * device setup failed, we will quit checkpoint, but before we exit, * we will teardown the devices that have been added to **dev */ - rds->dev[rds->num_set_up++] = dev; + cds->dev[cds->num_set_up++] = dev; /* we preserve the first error that happened */ - if (rc && !rds->saved_rc) - rds->saved_rc = rc; + if (rc && !cds->saved_rc) + cds->saved_rc = rc; - if (all_devices_handled(rds)) - rds->callback(egc, rds, rds->saved_rc); + if (all_devices_handled(cds)) + cds->callback(egc, cds, cds->saved_rc); } -void libxl__remus_devices_teardown(libxl__egc *egc, libxl__remus_device_state *rds) +void libxl__checkpoint_devices_teardown(libxl__egc *egc, libxl__checkpoint_device_state *cds) { int i, num_set_up; - libxl__remus_device *dev; + libxl__checkpoint_device *dev; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); - rds->saved_rc = 0; + cds->saved_rc = 0; - if (rds->num_set_up == 0) { - destroy_device_subkind(rds); + if (cds->num_set_up == 0) { + destroy_device_subkind(cds); goto out; } - /* we will decrease rds->num_set_up in the teardown callback */ - num_set_up = rds->num_set_up; + /* we will decrease cds->num_set_up in the teardown callback */ + num_set_up = cds->num_set_up; for (i = 0; i < num_set_up; i++) { - dev = rds->dev[i]; + dev = cds->dev[i]; dev->callback = device_teardown_cb; dev->ops->teardown(dev); } @@ -259,43 +259,43 @@ void libxl__remus_devices_teardown(libxl__egc *egc, libxl__remus_device_state *r return; out: - rds->callback(egc, rds, rds->saved_rc); + cds->callback(egc, cds, cds->saved_rc); return; } static void device_teardown_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc) { int i; - libxl__remus_device_state *const rds = dev->rds; + libxl__checkpoint_device_state *const cds = dev->cds; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); /* we preserve the first error that happened */ - if (rc && !rds->saved_rc) - rds->saved_rc = rc; + if (rc && !cds->saved_rc) + cds->saved_rc = rc; /* ignore teardown errors to teardown as many devs as possible*/ - rds->num_set_up--; + cds->num_set_up--; - if (rds->num_set_up == 0) { + if (cds->num_set_up == 0) { /* clean nic */ - for (i = 0; i < rds->num_nics; i++) - libxl_device_nic_dispose(&rds->nics[i]); - free(rds->nics); - rds->nics = NULL; - rds->num_nics = 0; + for (i = 0; i < cds->num_nics; i++) + libxl_device_nic_dispose(&cds->nics[i]); + free(cds->nics); + cds->nics = NULL; + cds->num_nics = 0; /* clean disk */ - for (i = 0; i < rds->num_disks; i++) - libxl_device_disk_dispose(&rds->disks[i]); - free(rds->disks); - rds->disks = NULL; - rds->num_disks = 0; - - destroy_device_subkind(rds); - rds->callback(egc, rds, rds->saved_rc); + for (i = 0; i < cds->num_disks; i++) + libxl_device_disk_dispose(&cds->disks[i]); + free(cds->disks); + cds->disks = NULL; + cds->num_disks = 0; + + destroy_device_subkind(cds); + cds->callback(egc, cds, cds->saved_rc); } } @@ -304,64 +304,64 @@ static void device_teardown_cb(libxl__egc *egc, /* callbacks */ static void device_checkpoint_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc); /* API implementations */ -#define define_remus_device_checkpoint_api(api) \ -void libxl__remus_devices_##api(libxl__egc *egc, \ - libxl__remus_device_state *rds) \ +#define define_checkpoint_device_api(api) \ +void libxl__checkpoint_devices_##api(libxl__egc *egc, \ + libxl__checkpoint_device_state *cds) \ { \ int i; \ - libxl__remus_device *dev; \ + libxl__checkpoint_device *dev; \ \ - STATE_AO_GC(rds->ao); \ + STATE_AO_GC(cds->ao); \ \ - rds->num_devices = 0; \ - rds->saved_rc = 0; \ + cds->num_devices = 0; \ + cds->saved_rc = 0; \ \ - if (rds->num_set_up == 0) \ + if (cds->num_set_up == 0) \ goto out; \ \ - for (i = 0; i < rds->num_set_up; i++) { \ - dev = rds->dev[i]; \ + for (i = 0; i < cds->num_set_up; i++) { \ + dev = cds->dev[i]; \ dev->callback = device_checkpoint_cb; \ if (dev->ops->api) { \ dev->ops->api(dev); \ } else { \ - rds->num_devices++; \ - if (rds->num_devices == rds->num_set_up) \ - rds->callback(egc, rds, rds->saved_rc); \ + cds->num_devices++; \ + if (cds->num_devices == cds->num_set_up) \ + cds->callback(egc, cds, cds->saved_rc); \ } \ } \ \ return; \ \ out: \ - rds->callback(egc, rds, rds->saved_rc); \ + cds->callback(egc, cds, cds->saved_rc); \ } -define_remus_device_checkpoint_api(postsuspend); +define_checkpoint_device_api(postsuspend); -define_remus_device_checkpoint_api(preresume); +define_checkpoint_device_api(preresume); -define_remus_device_checkpoint_api(commit); +define_checkpoint_device_api(commit); static void device_checkpoint_cb(libxl__egc *egc, - libxl__remus_device *dev, + libxl__checkpoint_device *dev, int rc) { /* Convenience aliases */ - libxl__remus_device_state *const rds = dev->rds; + libxl__checkpoint_device_state *const cds = dev->cds; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); - rds->num_devices++; + cds->num_devices++; if (rc) - rds->saved_rc = ERROR_FAIL; + cds->saved_rc = ERROR_FAIL; - if (rds->num_devices == rds->num_set_up) - rds->callback(egc, rds, rds->saved_rc); + if (cds->num_devices == cds->num_set_up) + cds->callback(egc, cds, cds->saved_rc); } diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 6eabd4c..cf79b74 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1462,10 +1462,10 @@ static void domain_suspend_callback_common_done(libxl__egc *egc, static void remus_domain_suspend_callback_common_done(libxl__egc *egc, libxl__domain_suspend_state *dss, int ok); static void remus_device_postsuspend_cb(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc); static void remus_device_preresume_cb(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc); static void libxl__remus_domain_suspend_callback(void *data) @@ -1484,9 +1484,9 @@ static void remus_domain_suspend_callback_common_done(libxl__egc *egc, if (!ok) goto out; - libxl__remus_device_state *const rds = &dss->rds; - rds->callback = remus_device_postsuspend_cb; - libxl__remus_devices_postsuspend(egc, rds); + libxl__checkpoint_device_state *const cds = &dss->cds; + cds->callback = remus_device_postsuspend_cb; + libxl__checkpoint_devices_postsuspend(egc, cds); return; out: @@ -1494,11 +1494,11 @@ out: } static void remus_device_postsuspend_cb(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc) { int ok = 0; - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); if (!rc) ok = 1; @@ -1512,17 +1512,17 @@ static void libxl__remus_domain_resume_callback(void *data) libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs); STATE_AO_GC(dss->ao); - libxl__remus_device_state *const rds = &dss->rds; - rds->callback = remus_device_preresume_cb; - libxl__remus_devices_preresume(egc, rds); + libxl__checkpoint_device_state *const cds = &dss->cds; + cds->callback = remus_device_preresume_cb; + libxl__checkpoint_devices_preresume(egc, cds); } static void remus_device_preresume_cb(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc) { int ok = 0; - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); STATE_AO_GC(dss->ao); if (!rc) { @@ -1538,7 +1538,7 @@ static void remus_device_preresume_cb(libxl__egc *egc, static void remus_checkpoint_dm_saved(libxl__egc *egc, libxl__domain_suspend_state *dss, int rc); static void remus_device_commit_cb(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc); static void remus_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev, const struct timeval *requested_abs); @@ -1562,7 +1562,7 @@ static void remus_checkpoint_dm_saved(libxl__egc *egc, libxl__domain_suspend_state *dss, int rc) { /* Convenience aliases */ - libxl__remus_device_state *const rds = &dss->rds; + libxl__checkpoint_device_state *const cds = &dss->cds; STATE_AO_GC(dss->ao); @@ -1571,8 +1571,8 @@ static void remus_checkpoint_dm_saved(libxl__egc *egc, goto out; } - rds->callback = remus_device_commit_cb; - libxl__remus_devices_commit(egc, rds); + cds->callback = remus_device_commit_cb; + libxl__checkpoint_devices_commit(egc, cds); return; @@ -1581,10 +1581,10 @@ out: } static void remus_device_commit_cb(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc) { - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); STATE_AO_GC(dss->ao); @@ -1833,7 +1833,7 @@ static void save_device_model_datacopier_done(libxl__egc *egc, } static void libxl__remus_teardown_done(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc); static void domain_suspend_done(libxl__egc *egc, libxl__domain_suspend_state *dss, int rc) @@ -1858,8 +1858,8 @@ static void domain_suspend_done(libxl__egc *egc, */ LOGE(WARN, "Domain suspend terminated with rc %d, \ teardown Remus devices...", rc); - dss->rds.callback = libxl__remus_teardown_done; - libxl__remus_devices_teardown(egc, &dss->rds); + dss->cds.callback = libxl__remus_teardown_done; + libxl__checkpoint_devices_teardown(egc, &dss->cds); return; } @@ -1867,10 +1867,10 @@ static void domain_suspend_done(libxl__egc *egc, } static void libxl__remus_teardown_done(libxl__egc *egc, - libxl__remus_device_state *rds, + libxl__checkpoint_device_state *cds, int rc) { - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); STATE_AO_GC(dss->ao); if (rc) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index e327604..f18503e 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2478,13 +2478,13 @@ typedef struct libxl__save_helper_state { /*----- remus device related state structure -----*/ /* remus device is an abstract layer of remus devices(nic, disk, * etc).It provides the following APIs for libxl: - * >libxl__remus_devices_setup + * >libxl__checkpoint_devices_setup * setup remus devices, like attach qdisc, enable disk buffering, etc - * >libxl__remus_devices_teardown + * >libxl__checkpoint_devices_teardown * teardown devices - * >libxl__remus_devices_postsuspend - * >libxl__remus_devices_preresume - * >libxl__remus_devices_commit + * >libxl__checkpoint_devices_postsuspend + * >libxl__checkpoint_devices_preresume + * >libxl__checkpoint_devices_commit * above three are for checkpoint. * through remus device layer, the remus execution flow will be like * this: @@ -2493,7 +2493,7 @@ typedef struct libxl__save_helper_state { * ... * |-> remus device teardown, failover or abort * the remus device layer provides an interface - * libxl__remus_device_subkind_ops + * libxl__checkpoint_device_subkind_ops * which a remus device must implement. the whole remus structure: * |remus| * | @@ -2501,21 +2501,21 @@ typedef struct libxl__save_helper_state { * | * |nic| |drbd disks| |qemu disks| ... * a device(nic, drbd disks, qemu disks, etc) must implement - * libxl__remus_device_subkind_ops to support remus. + * libxl__checkpoint_device_subkind_ops to support remus. */ -typedef enum libxl__remus_device_kind { - LIBXL__REMUS_DEVICE_NIC = (1 << 0), - LIBXL__REMUS_DEVICE_DISK= (1 << 1), -} libxl__remus_device_kind; +typedef enum libxl__checkpoint_device_kind { + LIBXL__CHECKPOINT_DEVICE_NIC = (1 << 0), + LIBXL__CHECKPOINT_DEVICE_DISK= (1 << 1), +} libxl__checkpoint_device_kind; -typedef struct libxl__remus_device libxl__remus_device; -typedef struct libxl__remus_device_state libxl__remus_device_state; -typedef struct libxl__remus_device_subkind_ops libxl__remus_device_subkind_ops; +typedef struct libxl__checkpoint_device libxl__checkpoint_device; +typedef struct libxl__checkpoint_device_state libxl__checkpoint_device_state; +typedef struct libxl__checkpoint_device_subkind_ops libxl__checkpoint_device_subkind_ops; -struct libxl__remus_device_subkind_ops { +struct libxl__checkpoint_device_subkind_ops { /* the device kind this ops belongs to... */ - libxl__remus_device_kind kind; + libxl__checkpoint_device_kind kind; /* * init() and destroy() APIs are produced by a device subkind and @@ -2524,8 +2524,8 @@ struct libxl__remus_device_subkind_ops { * the APIs init/destroy device subkind's private data which stored * in CTX. must implement. */ - int (*init)(libxl__remus_device_state *rds); - void (*destroy)(libxl__remus_device_state *rds); + int (*init)(libxl__checkpoint_device_state *cds); + void (*destroy)(libxl__checkpoint_device_state *cds); /* * checkpoint callbacks, these are async ops, call dev->callback @@ -2535,9 +2535,9 @@ struct libxl__remus_device_subkind_ops { * These callbacks can be implemented synchronously, call * dev->callback at last directly. */ - void (*postsuspend)(libxl__remus_device *dev); - void (*preresume)(libxl__remus_device *dev); - void (*commit)(libxl__remus_device *dev); + void (*postsuspend)(libxl__checkpoint_device *dev); + void (*preresume)(libxl__checkpoint_device *dev); + void (*commit)(libxl__checkpoint_device *dev); /* * This API determines whether the subkind matchs the specific device. In @@ -2553,7 +2553,7 @@ struct libxl__remus_device_subkind_ops { * It's an async op and must be implemented asynchronously, * call dev->callback when done. */ - void (*match)(libxl__remus_device *dev); + void (*match)(libxl__checkpoint_device *dev); /* * setup() and teardown() are refer to the actual remus device, @@ -2562,31 +2562,31 @@ struct libxl__remus_device_subkind_ops { * These callbacks can be implemented synchronously, call * dev->callback at last directly. */ - void (*setup)(libxl__remus_device *dev); - void (*teardown)(libxl__remus_device *dev); + void (*setup)(libxl__checkpoint_device *dev); + void (*teardown)(libxl__checkpoint_device *dev); }; typedef void libxl__remus_callback(libxl__egc *, - libxl__remus_device_state *, int rc); + libxl__checkpoint_device_state *, int rc); /* * This structure is for remus device layer, it records remus devices * that have been set up. */ -struct libxl__remus_device_state { - /* must set by caller of libxl__remus_device_(setup|teardown) */ +struct libxl__checkpoint_device_state { + /* must set by caller of libxl__checkpoint_device_(setup|teardown) */ libxl__ao *ao; libxl__egc *egc; uint32_t domid; libxl__remus_callback *callback; /* the last ops must be NULL */ - const libxl__remus_device_subkind_ops **ops; + const libxl__checkpoint_device_subkind_ops **ops; int enabled_device_kinds; /* private */ /* devices that have been set up */ int saved_rc; - libxl__remus_device **dev; + libxl__checkpoint_device **dev; libxl_device_nic *nics; int num_nics; @@ -2599,19 +2599,19 @@ struct libxl__remus_device_state { int num_set_up; }; -typedef void libxl__remus_device_callback(libxl__egc *, - libxl__remus_device *, +typedef void libxl__checkpoint_device_callback(libxl__egc *, + libxl__checkpoint_device *, int rc); /* * This structure is init and setup by remus device abstruct layer, * and pass to remus device ops */ -struct libxl__remus_device { +struct libxl__checkpoint_device { /*----- shared between abstract and concrete layers -----*/ /* set by remus device abstruct layer */ /* libxl__device_* which this remus device related to */ const void *backend_dev; - libxl__remus_device_kind kind; + libxl__checkpoint_device_kind kind; /*----- private for abstract layer only -----*/ /* @@ -2619,9 +2619,9 @@ struct libxl__remus_device { * for the device. */ int ops_index; - const libxl__remus_device_subkind_ops *ops; - libxl__remus_device_callback *callback; - libxl__remus_device_state *rds; + const libxl__checkpoint_device_subkind_ops *ops; + libxl__checkpoint_device_callback *callback; + libxl__checkpoint_device_state *cds; /*----- private for concrete (device-specific) layer -----*/ /* *kind* of device's private data */ @@ -2636,20 +2636,20 @@ struct libxl__remus_device { libxl__ev_child child; }; -/* the following 5 APIs are async ops, call rds->callback when done */ -_hidden void libxl__remus_devices_setup(libxl__egc *egc, - libxl__remus_device_state *rds); -_hidden void libxl__remus_devices_teardown(libxl__egc *egc, - libxl__remus_device_state *rds); -_hidden void libxl__remus_devices_postsuspend(libxl__egc *egc, - libxl__remus_device_state *rds); -_hidden void libxl__remus_devices_preresume(libxl__egc *egc, - libxl__remus_device_state *rds); -_hidden void libxl__remus_devices_commit(libxl__egc *egc, - libxl__remus_device_state *rds); - -extern const libxl__remus_device_subkind_ops remus_device_nic; -extern const libxl__remus_device_subkind_ops remus_device_drbd_disk; +/* the following 5 APIs are async ops, call cds->callback when done */ +_hidden void libxl__checkpoint_devices_setup(libxl__egc *egc, + libxl__checkpoint_device_state *cds); +_hidden void libxl__checkpoint_devices_teardown(libxl__egc *egc, + libxl__checkpoint_device_state *cds); +_hidden void libxl__checkpoint_devices_postsuspend(libxl__egc *egc, + libxl__checkpoint_device_state *cds); +_hidden void libxl__checkpoint_devices_preresume(libxl__egc *egc, + libxl__checkpoint_device_state *cds); +_hidden void libxl__checkpoint_devices_commit(libxl__egc *egc, + libxl__checkpoint_device_state *cds); + +extern const libxl__checkpoint_device_subkind_ops remus_device_nic; +extern const libxl__checkpoint_device_subkind_ops remus_device_drbd_disk; _hidden int libxl__netbuffer_enabled(libxl__gc *gc); @@ -2693,7 +2693,7 @@ struct libxl__domain_suspend_state { const char *dm_savefile; /* for Remus */ struct { - libxl__remus_device_state rds; + libxl__checkpoint_device_state cds; const char *netbufscript; /* used for Remus checkpoint */ libxl__ev_time checkpoint_timeout; diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c index 2387563..c9a6b6f 100644 --- a/tools/libxl/libxl_netbuffer.c +++ b/tools/libxl/libxl_netbuffer.c @@ -34,12 +34,12 @@ struct libxl__remus_netbuf_state { struct nl_cache *qdisc_cache; }; -typedef struct libxl__remus_device_nic { +typedef struct libxl__checkpoint_device_nic { int devid; const char *vif; const char *ifb; struct rtnl_qdisc *qdisc; -} libxl__remus_device_nic; +} libxl__checkpoint_device_nic; int libxl__netbuffer_enabled(libxl__gc *gc) { @@ -48,13 +48,13 @@ int libxl__netbuffer_enabled(libxl__gc *gc) /*----- init() and destroy() -----*/ -static int nic_init(libxl__remus_device_state *rds) +static int nic_init(libxl__checkpoint_device_state *cds) { int rc, ret; libxl__remus_netbuf_state *ns; - libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds); + libxl__domain_suspend_state *dss = CONTAINER_OF(cds, *dss, cds); - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); GCNEW(ns); CTX->rns = ns; @@ -83,8 +83,8 @@ static int nic_init(libxl__remus_device_state *rds) goto out; } - ns->ao = rds->ao; - ns->domid = rds->domid; + ns->ao = cds->ao; + ns->domid = cds->domid; ns->netbufscript = dss->netbufscript; rc = 0; @@ -93,9 +93,9 @@ out: return rc; } -static void nic_destroy(libxl__remus_device_state *rds) +static void nic_destroy(libxl__checkpoint_device_state *cds) { - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); libxl__remus_netbuf_state *ns = CTX->rns; if (!ns) @@ -126,14 +126,14 @@ static void nic_destroy(libxl__remus_device_state *rds) * it must ONLY be used for remus because if driver domains * were in use it would constitute a security vulnerability. */ -static const char *get_vifname(libxl__remus_device *dev, +static const char *get_vifname(libxl__checkpoint_device *dev, const libxl_device_nic *nic) { const char *vifname = NULL; const char *path; int rc; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); /* Convenience aliases */ libxl__remus_netbuf_state *netbuf_state = CTX->rns; @@ -151,7 +151,7 @@ static const char *get_vifname(libxl__remus_device *dev, return vifname; } -static void free_qdisc(libxl__remus_device_nic *remus_nic) +static void free_qdisc(libxl__checkpoint_device_nic *remus_nic) { if (remus_nic->qdisc == NULL) return; @@ -161,7 +161,7 @@ static void free_qdisc(libxl__remus_device_nic *remus_nic) } static int init_qdisc(libxl__remus_netbuf_state *netbuf_state, - libxl__remus_device_nic *remus_nic) + libxl__checkpoint_device_nic *remus_nic) { int rc, ret, ifindex; struct rtnl_link *ifb = NULL; @@ -251,13 +251,13 @@ static void netbuf_teardown_script_cb(libxl__egc *egc, * $REMUS_IFB (for teardown) * setup/teardown as command line arg. */ -static void setup_async_exec(libxl__remus_device *dev, char *op) +static void setup_async_exec(libxl__checkpoint_device *dev, char *op) { int arraysize, nr = 0; char **env = NULL, **args = NULL; libxl__async_exec_state *aes = &dev->aes; - libxl__remus_device_nic *remus_nic = dev->data; - STATE_AO_GC(dev->rds->ao); + libxl__checkpoint_device_nic *remus_nic = dev->data; + STATE_AO_GC(dev->cds->ao); /* Convenience aliases */ libxl__remus_netbuf_state *ns = CTX->rns; @@ -288,7 +288,7 @@ static void setup_async_exec(libxl__remus_device *dev, char *op) args[nr++] = NULL; assert(nr == arraysize); - aes->ao = dev->rds->ao; + aes->ao = dev->cds->ao; aes->what = GCSPRINTF("%s %s", args[0], args[1]); aes->env = env; aes->args = args; @@ -305,13 +305,13 @@ static void setup_async_exec(libxl__remus_device *dev, char *op) /* setup() and teardown() */ -static void nic_setup(libxl__remus_device *dev) +static void nic_setup(libxl__checkpoint_device *dev) { int rc; - libxl__remus_device_nic *remus_nic; + libxl__checkpoint_device_nic *remus_nic; const libxl_device_nic *nic = dev->backend_dev; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); GCNEW(remus_nic); dev->data = remus_nic; @@ -330,7 +330,7 @@ static void nic_setup(libxl__remus_device *dev) return; out: - dev->callback(dev->rds->egc, dev, rc); + dev->callback(dev->cds->egc, dev, rc); } /* @@ -341,12 +341,12 @@ static void netbuf_setup_script_cb(libxl__egc *egc, libxl__async_exec_state *aes, int status) { - libxl__remus_device *dev = CONTAINER_OF(aes, *dev, aes); - libxl__remus_device_nic *remus_nic = dev->data; + libxl__checkpoint_device *dev = CONTAINER_OF(aes, *dev, aes); + libxl__checkpoint_device_nic *remus_nic = dev->data; const char *out_path_base, *hotplug_error = NULL; int rc; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); /* Convenience aliases */ libxl__remus_netbuf_state *netbuf_state = CTX->rns; @@ -401,10 +401,10 @@ out: dev->callback(egc, dev, rc); } -static void nic_teardown(libxl__remus_device *dev) +static void nic_teardown(libxl__checkpoint_device *dev) { int rc; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); setup_async_exec(dev, "teardown"); @@ -415,7 +415,7 @@ static void nic_teardown(libxl__remus_device *dev) return; out: - dev->callback(dev->rds->egc, dev, rc); + dev->callback(dev->cds->egc, dev, rc); } static void netbuf_teardown_script_cb(libxl__egc *egc, @@ -423,8 +423,8 @@ static void netbuf_teardown_script_cb(libxl__egc *egc, int status) { int rc; - libxl__remus_device *dev = CONTAINER_OF(aes, *dev, aes); - libxl__remus_device_nic *remus_nic = dev->data; + libxl__checkpoint_device *dev = CONTAINER_OF(aes, *dev, aes); + libxl__checkpoint_device_nic *remus_nic = dev->data; if (status) rc = ERROR_FAIL; @@ -446,7 +446,7 @@ enum { /* API implementations */ -static int remus_netbuf_op(libxl__remus_device_nic *remus_nic, +static int remus_netbuf_op(libxl__checkpoint_device_nic *remus_nic, libxl__remus_netbuf_state *netbuf_state, int buffer_op) { @@ -483,30 +483,30 @@ out: return rc; } -static void nic_postsuspend(libxl__remus_device *dev) +static void nic_postsuspend(libxl__checkpoint_device *dev) { int rc; - libxl__remus_device_nic *remus_nic = dev->data; - STATE_AO_GC(dev->rds->ao); + libxl__checkpoint_device_nic *remus_nic = dev->data; + STATE_AO_GC(dev->cds->ao); libxl__remus_netbuf_state *ns = CTX->rns; rc = remus_netbuf_op(remus_nic, ns, tc_buffer_start); - dev->callback(dev->rds->egc, dev, rc); + dev->callback(dev->cds->egc, dev, rc); } -static void nic_commit(libxl__remus_device *dev) +static void nic_commit(libxl__checkpoint_device *dev) { int rc; - libxl__remus_device_nic *remus_nic = dev->data; - STATE_AO_GC(dev->rds->ao); + libxl__checkpoint_device_nic *remus_nic = dev->data; + STATE_AO_GC(dev->cds->ao); libxl__remus_netbuf_state *ns = CTX->rns; rc = remus_netbuf_op(remus_nic, ns, tc_buffer_release); - dev->callback(dev->rds->egc, dev, rc); + dev->callback(dev->cds->egc, dev, rc); } -const libxl__remus_device_subkind_ops remus_device_nic = { - .kind = LIBXL__REMUS_DEVICE_NIC, +const libxl__checkpoint_device_subkind_ops remus_device_nic = { + .kind = LIBXL__CHECKPOINT_DEVICE_NIC, .init = nic_init, .destroy = nic_destroy, .setup = nic_setup, diff --git a/tools/libxl/libxl_nonetbuffer.c b/tools/libxl/libxl_nonetbuffer.c index fc29c36..b4a067e 100644 --- a/tools/libxl/libxl_nonetbuffer.c +++ b/tools/libxl/libxl_nonetbuffer.c @@ -22,25 +22,25 @@ int libxl__netbuffer_enabled(libxl__gc *gc) return 0; } -static void nic_match(libxl__remus_device *dev) +static void nic_match(libxl__checkpoint_device *dev) { - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); - dev->callback(dev->rds->egc, dev, ERROR_FAIL); + dev->callback(dev->cds->egc, dev, ERROR_FAIL); } -static int nic_init(libxl__remus_device_state *rds) +static int nic_init(libxl__checkpoint_device_state *cds) { return 0; } -static void nic_destroy(libxl__remus_device_state *rds) +static void nic_destroy(libxl__checkpoint_device_state *cds) { return; } -const libxl__remus_device_subkind_ops remus_device_nic = { - .kind = LIBXL__REMUS_DEVICE_NIC, +const libxl__checkpoint_device_subkind_ops remus_device_nic = { + .kind = LIBXL__CHECKPOINT_DEVICE_NIC, .init = nic_init, .destroy = nic_destroy, .match = nic_match, diff --git a/tools/libxl/libxl_remus_disk_drbd.c b/tools/libxl/libxl_remus_disk_drbd.c index ae5a9d6..dd47286 100644 --- a/tools/libxl/libxl_remus_disk_drbd.c +++ b/tools/libxl/libxl_remus_disk_drbd.c @@ -33,12 +33,12 @@ typedef struct libxl__remus_drbd_disk { } libxl__remus_drbd_disk; /*----- helper functions, for async calls -----*/ -static void drbd_async_call(libxl__remus_device *dev, - void func(libxl__remus_device *), +static void drbd_async_call(libxl__checkpoint_device *dev, + void func(libxl__checkpoint_device *), libxl__ev_child_callback callback) { int pid = -1; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); /* Fork and call */ pid = libxl__ev_child_fork(gc, &dev->child, callback); @@ -57,15 +57,15 @@ static void drbd_async_call(libxl__remus_device *dev, return; out: - dev->callback(dev->rds->egc, dev, ERROR_FAIL); + dev->callback(dev->cds->egc, dev, ERROR_FAIL); } /*----- init() and destroy() -----*/ -static int drbd_init(libxl__remus_device_state *rds) +static int drbd_init(libxl__checkpoint_device_state *cds) { libxl__remus_drbd_state *drbd_state; - STATE_AO_GC(rds->ao); + STATE_AO_GC(cds->ao); GCNEW(drbd_state); CTX->drbd_state = drbd_state; @@ -76,7 +76,7 @@ static int drbd_init(libxl__remus_device_state *rds) return 0; } -static void drbd_destroy(libxl__remus_device_state *rds) +static void drbd_destroy(libxl__checkpoint_device_state *cds) { return; } @@ -90,12 +90,12 @@ static void match_async_exec_cb(libxl__egc *egc, /* implementations */ -static void match_async_exec(libxl__egc *egc, libxl__remus_device *dev) +static void match_async_exec(libxl__egc *egc, libxl__checkpoint_device *dev) { int arraysize, nr = 0; const libxl_device_disk *disk = dev->backend_dev; libxl__async_exec_state *aes = &dev->aes; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); libxl__remus_drbd_state *drbd_state = CTX->drbd_state; /* setup env & args */ @@ -129,29 +129,29 @@ out: dev->callback(egc, dev, ERROR_FAIL); } -static void drbd_match(libxl__remus_device *dev) +static void drbd_match(libxl__checkpoint_device *dev) { - match_async_exec(dev->rds->egc, dev); + match_async_exec(dev->cds->egc, dev); } static void match_async_exec_cb(libxl__egc *egc, libxl__async_exec_state *aes, int status) { - libxl__remus_device *dev = CONTAINER_OF(aes, *dev, aes); + libxl__checkpoint_device *dev = CONTAINER_OF(aes, *dev, aes); if (status) { - dev->callback(egc, dev, ERROR_REMUS_DEVOPS_NOT_MATCH); + dev->callback(egc, dev, ERROR_CHECKPOINT_DEVOPS_NOT_MATCH); } else { dev->callback(egc, dev, 0); } } -static void drbd_setup(libxl__remus_device *dev) +static void drbd_setup(libxl__checkpoint_device *dev) { libxl__remus_drbd_disk *drbd_disk; const libxl_device_disk *disk = dev->backend_dev; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); GCNEW(drbd_disk); dev->data = drbd_disk; @@ -159,17 +159,17 @@ static void drbd_setup(libxl__remus_device *dev) drbd_disk->ackwait = 0; drbd_disk->ctl_fd = open(drbd_disk->path, O_RDONLY); if (drbd_disk->ctl_fd < 0) - dev->callback(dev->rds->egc, dev, ERROR_FAIL); + dev->callback(dev->cds->egc, dev, ERROR_FAIL); else - dev->callback(dev->rds->egc, dev, 0); + dev->callback(dev->cds->egc, dev, 0); } -static void drbd_teardown(libxl__remus_device *dev) +static void drbd_teardown(libxl__checkpoint_device *dev) { libxl__remus_drbd_disk *drbd_disk = dev->data; close(drbd_disk->ctl_fd); - dev->callback(dev->rds->egc, dev, 0); + dev->callback(dev->cds->egc, dev, 0); } /*----- checkpointing APIs -----*/ @@ -182,7 +182,7 @@ static void chekpoint_async_call_done(libxl__egc *egc, /* API implementations */ /* this op will not wait and block, so implement as sync op */ -static void drbd_postsuspend(libxl__remus_device *dev) +static void drbd_postsuspend(libxl__checkpoint_device *dev) { libxl__remus_drbd_disk *rdd = dev->data; @@ -191,10 +191,10 @@ static void drbd_postsuspend(libxl__remus_device *dev) rdd->ackwait = 1; } - dev->callback(dev->rds->egc, dev, 0); + dev->callback(dev->cds->egc, dev, 0); } -static void drbd_preresume_async(libxl__remus_device *dev) +static void drbd_preresume_async(libxl__checkpoint_device *dev) { libxl__remus_drbd_disk *rdd = dev->data; int ackwait = rdd->ackwait; @@ -207,7 +207,7 @@ static void drbd_preresume_async(libxl__remus_device *dev) _exit(ackwait); } -static void drbd_preresume(libxl__remus_device *dev) +static void drbd_preresume(libxl__checkpoint_device *dev) { drbd_async_call(dev, drbd_preresume_async, chekpoint_async_call_done); } @@ -216,9 +216,9 @@ static void chekpoint_async_call_done(libxl__egc *egc, libxl__ev_child *child, pid_t pid, int status) { - libxl__remus_device *dev = CONTAINER_OF(child, *dev, child); + libxl__checkpoint_device *dev = CONTAINER_OF(child, *dev, child); libxl__remus_drbd_disk *rdd = dev->data; - STATE_AO_GC(dev->rds->ao); + STATE_AO_GC(dev->cds->ao); if (WIFEXITED(status)) { rdd->ackwait = WEXITSTATUS(status); @@ -228,8 +228,8 @@ static void chekpoint_async_call_done(libxl__egc *egc, } } -const libxl__remus_device_subkind_ops remus_device_drbd_disk = { - .kind = LIBXL__REMUS_DEVICE_DISK, +const libxl__checkpoint_device_subkind_ops remus_device_drbd_disk = { + .kind = LIBXL__CHECKPOINT_DEVICE_DISK, .init = drbd_init, .destroy = drbd_destroy, .match = drbd_match, diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 6551109..dc9f78e 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -58,8 +58,8 @@ libxl_error = Enumeration("error", [ (-12, "OSEVENT_REG_FAIL"), (-13, "BUFFERFULL"), (-14, "UNKNOWN_CHILD"), - (-15, "REMUS_DEVOPS_NOT_MATCH"), - (-16, "REMUS_DEVICE_NOT_SUPPORTED"), + (-15, "CHECKPOINT_DEVOPS_NOT_MATCH"), + (-16, "CHECKPOINT_DEVICE_NOT_SUPPORTED"), ], value_namespace = "") libxl_domain_type = Enumeration("domain_type", [ -- 1.9.3