3e5111
From 3d7186eefc7db60a5f33776eb1873ea18b9c501a Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <3d7186eefc7db60a5f33776eb1873ea18b9c501a@dist-git>
3e5111
From: Jiri Denemark <jdenemar@redhat.com>
3e5111
Date: Tue, 23 May 2017 20:32:07 +0200
3e5111
Subject: [PATCH] qemu: Rename xml_len in virQEMUSaveHeader as data_len
3e5111
3e5111
Since virQEMUSaveHeader will be followed by more than just domain XML,
3e5111
the old name would be confusing as it was designed to describe the
3e5111
length of all data following the save image header.
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
(cherry picked from commit ec3e4bb75a8d06644ca5b758c5f04041cecc9d20)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1441662
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_driver.c | 20 ++++++++++----------
3e5111
 1 file changed, 10 insertions(+), 10 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
3e5111
index 2688c3eec7..c8a84503c1 100644
3e5111
--- a/src/qemu/qemu_driver.c
3e5111
+++ b/src/qemu/qemu_driver.c
3e5111
@@ -2810,7 +2810,7 @@ typedef virQEMUSaveHeader *virQEMUSaveHeaderPtr;
3e5111
 struct _virQEMUSaveHeader {
3e5111
     char magic[sizeof(QEMU_SAVE_MAGIC)-1];
3e5111
     uint32_t version;
3e5111
-    uint32_t xml_len;
3e5111
+    uint32_t data_len;
3e5111
     uint32_t was_running;
3e5111
     uint32_t compressed;
3e5111
     uint32_t unused[15];
3e5111
@@ -2820,7 +2820,7 @@ static inline void
3e5111
 bswap_header(virQEMUSaveHeaderPtr hdr)
3e5111
 {
3e5111
     hdr->version = bswap_32(hdr->version);
3e5111
-    hdr->xml_len = bswap_32(hdr->xml_len);
3e5111
+    hdr->data_len = bswap_32(hdr->data_len);
3e5111
     hdr->was_running = bswap_32(hdr->was_running);
3e5111
     hdr->compressed = bswap_32(hdr->compressed);
3e5111
 }
3e5111
@@ -2841,7 +2841,7 @@ qemuDomainSaveHeader(int fd, const char *path, const char *xml,
3e5111
         goto endjob;
3e5111
     }
3e5111
 
3e5111
-    if (safewrite(fd, xml, header->xml_len) != header->xml_len) {
3e5111
+    if (safewrite(fd, xml, header->data_len) != header->data_len) {
3e5111
         ret = -errno;
3e5111
         virReportError(VIR_ERR_OPERATION_FAILED,
3e5111
                        _("failed to write xml to '%s'"), path);
3e5111
@@ -3068,7 +3068,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
3e5111
     header.version = QEMU_SAVE_VERSION;
3e5111
     header.was_running = was_running ? 1 : 0;
3e5111
     header.compressed = compressed;
3e5111
-    header.xml_len = strlen(domXML) + 1;
3e5111
+    header.data_len = strlen(domXML) + 1;
3e5111
 
3e5111
     /* Obtain the file handle.  */
3e5111
     if ((flags & VIR_DOMAIN_SAVE_BYPASS_CACHE)) {
3e5111
@@ -6270,16 +6270,16 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
3e5111
         goto error;
3e5111
     }
3e5111
 
3e5111
-    if (header.xml_len <= 0) {
3e5111
+    if (header.data_len <= 0) {
3e5111
         virReportError(VIR_ERR_OPERATION_FAILED,
3e5111
-                       _("invalid XML length: %d"), header.xml_len);
3e5111
+                       _("invalid XML length: %d"), header.data_len);
3e5111
         goto error;
3e5111
     }
3e5111
 
3e5111
-    if (VIR_ALLOC_N(xml, header.xml_len) < 0)
3e5111
+    if (VIR_ALLOC_N(xml, header.data_len) < 0)
3e5111
         goto error;
3e5111
 
3e5111
-    if (saferead(fd, xml, header.xml_len) != header.xml_len) {
3e5111
+    if (saferead(fd, xml, header.data_len) != header.data_len) {
3e5111
         virReportError(VIR_ERR_OPERATION_FAILED,
3e5111
                        "%s", _("failed to read XML"));
3e5111
         goto error;
3e5111
@@ -6623,12 +6623,12 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
3e5111
         goto cleanup;
3e5111
     len = strlen(xml) + 1;
3e5111
 
3e5111
-    if (len > header.xml_len) {
3e5111
+    if (len > header.data_len) {
3e5111
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
3e5111
                        _("new xml too large to fit in file"));
3e5111
         goto cleanup;
3e5111
     }
3e5111
-    if (VIR_EXPAND_N(xml, len, header.xml_len - len) < 0)
3e5111
+    if (VIR_EXPAND_N(xml, len, header.data_len - len) < 0)
3e5111
         goto cleanup;
3e5111
 
3e5111
     if (lseek(fd, 0, SEEK_SET) != 0) {
3e5111
-- 
3e5111
2.13.1
3e5111