On 04/11/2011 01:46 PM, Eric Blake wrote:
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?
Would version 3 then simply mean to convert to
version-3-standard-header-endianess and anything below just would fail
if the hosts had different endianess ? No matter what, we'll have to
have code to convert the version indicator alone.
Stefan