
On 04/11/2011 07:36 AM, Daniel Veillard wrote:
@@ -3097,6 +3107,11 @@ qemuDomainSaveImageOpen(struct qemud_dri }
if (header.version> QEMUD_SAVE_VERSION) { + /* convert endianess and try again */ + bswap_header(&header); + } Hum, isn't there a more reliable way to detect the change of endianness ? That's a bit fishy IMHO :-) The problem is that the header should not have been written in a hosts' native format. So what can go wrong? QEMUD_SAVE_VERSION is '2'. Either we find 1 or 2 here and go ahead and accept it 'as-is'. Otherwise anything bigger than 3 is not accepted and swapped. 3 then becomes 0x03 00 00 00 and is discarded. 0x 02 00 00 00 would be swapped to '2' and accepted.
yeah, I understand, okay,
Should we be writing the header in a particular byte order, regardless of host endianness? Or does that require bumping the header version to 3 anyways? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org