Re: [libvirt] [PATCH 2/4] snapshot: s/current/parent/ as prep for virObject

2019-05-09 Thread Peter Krempa
On Wed, May 08, 2019 at 17:24:10 -0500, Eric Blake wrote:
> VIR_CLASS_NEW insists that descendents of virObject have 'parent' as
> the name of their inherited member at offset 0. While it would be
> possible to write a new class-creation macro that takes the actual
> field name 'current', and rewrite VIR_CLASS_NEW to call the new macro
> with the hard-coded name 'parent', it seems less confusing if all
> object code uses similar naming. Thus, this is a mechanical rename in
> preparation of making virDomainSnapshotDef a descendent of virObject.
> 
> Signed-off-by: Eric Blake 
> ---
>  src/conf/snapshot_conf.h|   2 +-
>  src/conf/snapshot_conf.c| 120 ++--
>  src/conf/virdomainsnapshotobjlist.c |   2 +-
>  src/esx/esx_driver.c|  16 ++--
>  src/qemu/qemu_domain.c  |   2 +-
>  src/qemu/qemu_driver.c  |  12 +--
>  src/test/test_driver.c  |   2 +-
>  src/vbox/vbox_common.c  |  88 ++--
>  src/vz/vz_driver.c  |   2 +-
>  src/vz/vz_sdk.c |  10 +--
>  10 files changed, 128 insertions(+), 128 deletions(-)

ACK


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/4] snapshot: s/current/parent/ as prep for virObject

2019-05-08 Thread Eric Blake
VIR_CLASS_NEW insists that descendents of virObject have 'parent' as
the name of their inherited member at offset 0. While it would be
possible to write a new class-creation macro that takes the actual
field name 'current', and rewrite VIR_CLASS_NEW to call the new macro
with the hard-coded name 'parent', it seems less confusing if all
object code uses similar naming. Thus, this is a mechanical rename in
preparation of making virDomainSnapshotDef a descendent of virObject.

Signed-off-by: Eric Blake 
---
 src/conf/snapshot_conf.h|   2 +-
 src/conf/snapshot_conf.c| 120 ++--
 src/conf/virdomainsnapshotobjlist.c |   2 +-
 src/esx/esx_driver.c|  16 ++--
 src/qemu/qemu_domain.c  |   2 +-
 src/qemu/qemu_driver.c  |  12 +--
 src/test/test_driver.c  |   2 +-
 src/vbox/vbox_common.c  |  88 ++--
 src/vz/vz_driver.c  |   2 +-
 src/vz/vz_sdk.c |  10 +--
 10 files changed, 128 insertions(+), 128 deletions(-)

diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index 5a762ccd96..f54be11619 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -74,7 +74,7 @@ struct _virDomainSnapshotDiskDef {

 /* Stores the complete snapshot metadata */
 struct _virDomainSnapshotDef {
-virDomainMomentDef common;
+virDomainMomentDef parent;

 /* Additional public XML.  */
 int state; /* virDomainSnapshotState */
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index b571c5cc41..dd281d57fe 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -88,7 +88,7 @@ void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
 if (!def)
 return;

-virDomainMomentDefClear(&def->common);
+virDomainMomentDefClear(&def->parent);
 VIR_FREE(def->file);
 for (i = 0; i < def->ndisks; i++)
 virDomainSnapshotDiskDefClear(&def->disks[i]);
@@ -208,8 +208,8 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
 if (VIR_ALLOC(def) < 0)
 goto cleanup;

-def->common.name = virXPathString("string(./name)", ctxt);
-if (def->common.name == NULL) {
+def->parent.name = virXPathString("string(./name)", ctxt);
+if (def->parent.name == NULL) {
 if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) {
 virReportError(VIR_ERR_XML_ERROR, "%s",
_("a redefined snapshot must have a name"));
@@ -217,17 +217,17 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
 }
 }

-def->common.description = virXPathString("string(./description)", ctxt);
+def->parent.description = virXPathString("string(./description)", ctxt);

 if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) {
 if (virXPathLongLong("string(./creationTime)", ctxt,
- &def->common.creationTime) < 0) {
+ &def->parent.creationTime) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing creationTime from existing snapshot"));
 goto cleanup;
 }

-def->common.parent_name = virXPathString("string(./parent/name)", 
ctxt);
+def->parent.parent_name = virXPathString("string(./parent/name)", 
ctxt);

 state = virXPathString("string(./state)", ctxt);
 if (state == NULL) {
@@ -263,14 +263,14 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
_("missing domain in snapshot"));
 goto cleanup;
 }
-def->common.dom = virDomainDefParseNode(ctxt->node->doc, 
domainNode,
+def->parent.dom = virDomainDefParseNode(ctxt->node->doc, 
domainNode,
 caps, xmlopt, NULL, 
domainflags);
-if (!def->common.dom)
+if (!def->parent.dom)
 goto cleanup;
 } else {
 VIR_WARN("parsing older snapshot that lacks domain");
 }
-} else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->common) < 0) 
{
+} else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->parent) < 0) 
{
 goto cleanup;
 }

@@ -422,7 +422,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,


 /* Perform sanity checking on a redefined snapshot definition. If
- * @other is non-NULL, this may include swapping def->common.dom from other
+ * @other is non-NULL, this may include swapping def->parent.dom from other
  * into def. */
 int
 virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr def,
@@ -440,17 +440,17 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr 
def,
 virReportError(VIR_ERR_INVALID_ARG,
_("disk-only flag for snapshot %s requires "
  "disk-snapshot state"),
-   def->common.name);
+   def->parent.name);
 return -1