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