From nobody Mon Feb 9 21:06:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496824697106830.7568116235567; Wed, 7 Jun 2017 01:38:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4B868047B; Wed, 7 Jun 2017 08:38:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97D987C76C; Wed, 7 Jun 2017 08:38:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 565EF4A492; Wed, 7 Jun 2017 08:38:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v578bpd7004809 for ; Wed, 7 Jun 2017 04:37:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F67E757D9; Wed, 7 Jun 2017 08:37:51 +0000 (UTC) Received: from virval.usersys.redhat.com (dhcp129-92.brq.redhat.com [10.34.129.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8AD5757CD for ; Wed, 7 Jun 2017 08:37:50 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 74E0E101930; Wed, 7 Jun 2017 10:37:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D4B868047B Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D4B868047B From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 7 Jun 2017 10:37:30 +0200 Message-Id: <4ed948dfe107535e7fd7a1ec9475592a719acdf0.1496824604.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 05/20] qemu: Rename xml_len in virQEMUSaveHeader as data_len X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 07 Jun 2017 08:38:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since virQEMUSaveHeader will be followed by more than just domain XML, the old name would be confusing as it was designed to describe the length of all data following the save image header. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- Notes: Version 2: - enhanced commit message src/qemu/qemu_driver.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f97d41030..b0d67adc1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2805,7 +2805,7 @@ typedef virQEMUSaveHeader *virQEMUSaveHeaderPtr; struct _virQEMUSaveHeader { char magic[sizeof(QEMU_SAVE_MAGIC)-1]; uint32_t version; - uint32_t xml_len; + uint32_t data_len; uint32_t was_running; uint32_t compressed; uint32_t unused[15]; @@ -2815,7 +2815,7 @@ static inline void bswap_header(virQEMUSaveHeaderPtr hdr) { hdr->version =3D bswap_32(hdr->version); - hdr->xml_len =3D bswap_32(hdr->xml_len); + hdr->data_len =3D bswap_32(hdr->data_len); hdr->was_running =3D bswap_32(hdr->was_running); hdr->compressed =3D bswap_32(hdr->compressed); } @@ -2836,7 +2836,7 @@ qemuDomainSaveHeader(int fd, const char *path, const = char *xml, goto endjob; } =20 - if (safewrite(fd, xml, header->xml_len) !=3D header->xml_len) { + if (safewrite(fd, xml, header->data_len) !=3D header->data_len) { ret =3D -errno; virReportError(VIR_ERR_OPERATION_FAILED, _("failed to write xml to '%s'"), path); @@ -3082,7 +3082,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, header.version =3D QEMU_SAVE_VERSION; header.was_running =3D was_running ? 1 : 0; header.compressed =3D compressed; - header.xml_len =3D strlen(domXML) + 1; + header.data_len =3D strlen(domXML) + 1; =20 /* Obtain the file handle. */ if ((flags & VIR_DOMAIN_SAVE_BYPASS_CACHE)) { @@ -6276,16 +6276,16 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, goto error; } =20 - if (header.xml_len <=3D 0) { + if (header.data_len <=3D 0) { virReportError(VIR_ERR_OPERATION_FAILED, - _("invalid XML length: %d"), header.xml_len); + _("invalid XML length: %d"), header.data_len); goto error; } =20 - if (VIR_ALLOC_N(xml, header.xml_len) < 0) + if (VIR_ALLOC_N(xml, header.data_len) < 0) goto error; =20 - if (saferead(fd, xml, header.xml_len) !=3D header.xml_len) { + if (saferead(fd, xml, header.data_len) !=3D header.data_len) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML")); goto error; @@ -6629,12 +6629,12 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, co= nst char *path, goto cleanup; len =3D strlen(xml) + 1; =20 - if (len > header.xml_len) { + if (len > header.data_len) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("new xml too large to fit in file")); goto cleanup; } - if (VIR_EXPAND_N(xml, len, header.xml_len - len) < 0) + if (VIR_EXPAND_N(xml, len, header.data_len - len) < 0) goto cleanup; =20 if (lseek(fd, 0, SEEK_SET) !=3D 0) { --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list