tools/migration: Drop IHDR_VERSION constant from libxc and python

Migration v3 is in the process of being introduced, meaning that the code has
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 <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Andrew Cooper committed 2020-05-29 17:33:03 +01:00
1 parent 7582bbc14c
commit 7bac300b42
6 files changed
+12 -14

No files matched your search

+3 -3
View File
@@ -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
@@ -632,13 +632,13 @@ def main():
usage = ("%prog [options] -i INPUT -o OUTPUT"
" -w WIDTH -g GUEST"),
description =
"Convert a legacy stream to a v2 stream")
"Convert a legacy stream to a v2 (or later) stream")
# Required options
parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
help = "Legacy input to convert")
parser.add_option("-o", "--out", dest = "fout", metavar = "<FD or FILE>",
help = "v2 format output")
help = "v2 (or later) format output")
parser.add_option("-w", "--width", dest = "twidth",
metavar = "<32/64>", choices = ["32", "64"],
help = "Legacy toolstack bitness")
+1 -1
View File
@@ -108,7 +108,7 @@ def main():
parser = OptionParser(usage = "%prog [options]",
description =
"Verify a stream according to the v2 spec")
"Verify a stream according to the v2 (or later) spec")
# Optional options
parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
+4 -5
View File
@@ -19,7 +19,6 @@ IHDR_FORMAT = "!QIIHHI"
IHDR_MARKER = 0xffffffffffffffff
IHDR_IDENT = 0x58454E46 # "XENF" in ASCII
IHDR_VERSION = 2
IHDR_OPT_BIT_ENDIAN = 0
IHDR_OPT_LE = (0 << IHDR_OPT_BIT_ENDIAN)
@@ -113,7 +112,7 @@ HVM_PARAMS_ENTRY_FORMAT = "QQ"
HVM_PARAMS_FORMAT = "II"
class VerifyLibxc(VerifyBase):
""" Verify a Libxc v2 stream """
""" Verify a Libxc v2 (or later) stream """
def __init__(self, info, read):
VerifyBase.__init__(self, info, read)
@@ -144,9 +143,9 @@ class VerifyLibxc(VerifyBase):
raise StreamError("Bad image id: Expected 0x%x, got 0x%x" %
(IHDR_IDENT, ident))
if version != IHDR_VERSION:
raise StreamError("Unknown image version: Expected %d, got %d" %
(IHDR_VERSION, version))
if version != 2:
raise StreamError("Unknown image version: Expected 2, got %d" %
(version, ))
if options & IHDR_OPT_RESZ_MASK:
raise StreamError("Reserved bits set in image options field: 0x%x" %
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.