From nobody Fri Dec 19 08:04:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580135746002971.0988073960164; Mon, 27 Jan 2020 06:35:46 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iw5Th-0001Yl-QV; Mon, 27 Jan 2020 14:35:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iw5Tg-0001YC-I9 for xen-devel@lists.xenproject.org; Mon, 27 Jan 2020 14:35:00 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2d4e1e7c-4112-11ea-9fd7-bc764e2007e4; Mon, 27 Jan 2020 14:34:51 +0000 (UTC) X-Inumbo-ID: 2d4e1e7c-4112-11ea-9fd7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580135692; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0GGzmlFGaEIMS+O2YuTNdygeIZmvyTogSE9zQHILJss=; b=QRqMd36lWNuqo6gQREBS0Yj6zBgTM0PO/iMMBIIwgj9Ptb7PVFa/HUT7 HImZgXp5qu5Uvq5o6hsLgq4zMxRfPj/WVPxJu4aK4EVml7JjiF2RWXXow dvJSni86f6kwITSeWnF7JaLrVJS0wXNzZnQlf/+26vc5iasEK+bCpZdIs 8=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: uD/1/QcMwLjZKhYOCHQptEskXtKhELTL2WbRym4fKnL5wpbxzYlGPAJE5cx9e26IX/n1ojwOWC JTmuY5BrpFbcESqfofUjAhe1iaRlOciOWQSf6geEbFzELGstp/dBrFyRgKDGxdG7v1a8JJMNLW bMIfaOYuKQOTw3gjOiPCpMF5+Kj92qd5HAEAzr8v+tPFoedHaHS3N6mw9auvUT0+COim7PIYgn Ra36uJoBEF9S5DK0kw0djjZoORBcPjsn2dKVtMznw09/qu9nQnHi/Dc3302j9s7EYrO1tPVPJt xhA= X-SBRS: 2.7 X-MesageID: 11664973 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,370,1574139600"; d="scan'208";a="11664973" From: Andrew Cooper To: Xen-devel Date: Mon, 27 Jan 2020 14:34:30 +0000 Message-ID: <20200127143444.25538-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200127143444.25538-1-andrew.cooper3@citrix.com> References: <20200127143444.25538-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 03/17] tools/migration: Drop IHDR_VERSION constant from libxc and python X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Migration v3 is in the process of being introduced, meaning that the code h= as to cope with both versions. Use an explicit 2 for now. For the verify-stream-v2 and convert-legacy-stream scripts, update text to = say "v2 (or later)". What matters is the distinction vs legacy streams. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Marek Marczykowski-G=C3=B3recki --- tools/libxc/xc_sr_restore.c | 6 +++--- tools/libxc/xc_sr_save.c | 2 +- tools/libxc/xc_sr_stream_format.h | 1 - tools/python/scripts/convert-legacy-stream | 6 +++--- tools/python/scripts/verify-stream-v2 | 2 +- tools/python/xen/migration/libxc.py | 9 ++++----- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c index 5e31908ca8..dc2ffcf855 100644 --- a/tools/libxc/xc_sr_restore.c +++ b/tools/libxc/xc_sr_restore.c @@ -35,10 +35,10 @@ static int read_headers(struct xc_sr_context *ctx) return -1; } =20 - if ( ihdr.version !=3D IHDR_VERSION ) + if ( ihdr.version !=3D 2 ) { - ERROR("Invalid Version: Expected %d, Got %d", - IHDR_VERSION, ihdr.version); + ERROR("Invalid Version: Expected 2, Got %d", + ihdr.version); return -1; } =20 diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c index fa736a311f..5c5ce18ac3 100644 --- a/tools/libxc/xc_sr_save.c +++ b/tools/libxc/xc_sr_save.c @@ -13,7 +13,7 @@ static int write_headers(struct xc_sr_context *ctx, uint1= 6_t guest_type) struct xc_sr_ihdr ihdr =3D { .marker =3D IHDR_MARKER, .id =3D htonl(IHDR_ID), - .version =3D htonl(IHDR_VERSION), + .version =3D htonl(2), .options =3D htons(IHDR_OPT_LITTLE_ENDIAN), }; struct xc_sr_dhdr dhdr =3D { diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_f= ormat.h index 37a7da6eab..ae7c0de393 100644 --- a/tools/libxc/xc_sr_stream_format.h +++ b/tools/libxc/xc_sr_stream_format.h @@ -23,7 +23,6 @@ struct xc_sr_ihdr =20 #define IHDR_MARKER 0xffffffffffffffffULL #define IHDR_ID 0x58454E46U -#define IHDR_VERSION 2 =20 #define _IHDR_OPT_ENDIAN 0 #define IHDR_OPT_LITTLE_ENDIAN (0 << _IHDR_OPT_ENDIAN) diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/scri= pts/convert-legacy-stream index 2922fb3185..02a194178f 100755 --- a/tools/python/scripts/convert-legacy-stream +++ b/tools/python/scripts/convert-legacy-stream @@ -79,7 +79,7 @@ def write_libxc_ihdr(): stream_write(pack(libxc.IHDR_FORMAT, libxc.IHDR_MARKER, # Marker libxc.IHDR_IDENT, # Ident - libxc.IHDR_VERSION, # Version + 2, # Version libxc.IHDR_OPT_LE, # Options 0, 0)) # Reserved =20 @@ -632,13 +632,13 @@ def main(): usage =3D ("%prog [options] -i INPUT -o OUTPUT" " -w WIDTH -g GUEST"), description =3D - "Convert a legacy stream to a v2 stream") + "Convert a legacy stream to a v2 (or later) stre= am") =20 # Required options parser.add_option("-i", "--in", dest =3D "fin", metavar =3D "", help =3D "Legacy input to convert") parser.add_option("-o", "--out", dest =3D "fout", metavar =3D "", - help =3D "v2 format output") + help =3D "v2 (or later) format output") parser.add_option("-w", "--width", dest =3D "twidth", metavar =3D "<32/64>", choices =3D ["32", "64"], help =3D "Legacy toolstack bitness") diff --git a/tools/python/scripts/verify-stream-v2 b/tools/python/scripts/v= erify-stream-v2 index 8bac04d566..fe82b86c11 100755 --- a/tools/python/scripts/verify-stream-v2 +++ b/tools/python/scripts/verify-stream-v2 @@ -108,7 +108,7 @@ def main(): =20 parser =3D OptionParser(usage =3D "%prog [options]", description =3D - "Verify a stream according to the v2 spec") + "Verify a stream according to the v2 (or later) = spec") =20 # Optional options parser.add_option("-i", "--in", dest =3D "fin", metavar =3D "", diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migrati= on/libxc.py index 8a800df980..63b3558029 100644 --- a/tools/python/xen/migration/libxc.py +++ b/tools/python/xen/migration/libxc.py @@ -19,7 +19,6 @@ =20 IHDR_MARKER =3D 0xffffffffffffffff IHDR_IDENT =3D 0x58454E46 # "XENF" in ASCII -IHDR_VERSION =3D 2 =20 IHDR_OPT_BIT_ENDIAN =3D 0 IHDR_OPT_LE =3D (0 << IHDR_OPT_BIT_ENDIAN) @@ -113,7 +112,7 @@ HVM_PARAMS_FORMAT =3D "II" =20 class VerifyLibxc(VerifyBase): - """ Verify a Libxc v2 stream """ + """ Verify a Libxc v2 (or later) stream """ =20 def __init__(self, info, read): VerifyBase.__init__(self, info, read) @@ -144,9 +143,9 @@ def verify_ihdr(self): raise StreamError("Bad image id: Expected 0x%x, got 0x%x" % (IHDR_IDENT, ident)) =20 - if version !=3D IHDR_VERSION: - raise StreamError("Unknown image version: Expected %d, got %d"= % - (IHDR_VERSION, version)) + if version !=3D 2: + raise StreamError("Unknown image version: Expected 2, got %d" % + (version, )) =20 if options & IHDR_OPT_RESZ_MASK: raise StreamError("Reserved bits set in image options field: 0= x%x" % --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel