From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33958 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2P8o-0000st-AU for qemu-devel@nongnu.org; Wed, 23 Mar 2011 10:34:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2P7f-00016f-18 for qemu-devel@nongnu.org; Wed, 23 Mar 2011 10:33:20 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:47876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2P7e-00016Z-RZ for qemu-devel@nongnu.org; Wed, 23 Mar 2011 10:33:18 -0400 Received: by gwb19 with SMTP id 19so4072294gwb.4 for ; Wed, 23 Mar 2011 07:33:18 -0700 (PDT) Message-ID: <4D8A04A5.8020209@codemonkey.ws> Date: Wed, 23 Mar 2011 09:33:09 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1300839376-22520-1-git-send-email-aliguori@us.ibm.com> <1300839376-22520-8-git-send-email-aliguori@us.ibm.com> <4D89E8B8.6010404@codemonkey.ws> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 07/11] eeprom93xx: Use the new hack macro to avoid duplicate field names List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com Cc: Jan Kiszka , Anthony Liguori , qemu-devel@nongnu.org On 03/23/2011 09:14 AM, Juan Quintela wrote: > Anthony Liguori wrote: >> On 03/23/2011 04:58 AM, Juan Quintela wrote: >>> Anthony Liguori wrote: >>>> I don't fully understand this hack business but we need field to be unique so.. >>>> >>>> Signed-off-by: Anthony Liguori >>>> --- >>>> hw/eeprom93xx.c | 2 +- >>>> 1 files changed, 1 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/hw/eeprom93xx.c b/hw/eeprom93xx.c >>>> index cfa695d..f1d75ec 100644 >>>> --- a/hw/eeprom93xx.c >>>> +++ b/hw/eeprom93xx.c >>>> @@ -114,7 +114,7 @@ static const VMStateInfo vmstate_hack_uint16_from_uint8 = { >>>> }; >>>> >>>> #define VMSTATE_UINT16_HACK_TEST(_f, _s, _t) \ >>>> - VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t) >>>> + VMSTATE_SINGLE_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t) >>>> >>>> static bool is_old_eeprom_version(void *opaque, int version_id) >>>> { >> Could we get away with just doing: >> >> VMSTATE_UNUSED(3), >> VMSTATE_UINT8(bar, ...), > Remember that we are "supposed to be" big/little endian safe. We always send in network byte order (big endian) so this is safe. >> That's fully compatible on the wire and seems to be a clearer >> expression of exactly what the problem is. > if we are going to break big endian machines, I fully agree. The migration protocol is always big endian, see: void qemu_put_be32(QEMUFile *f, unsigned int v) { qemu_put_byte(f, v >> 24); qemu_put_byte(f, v >> 16); qemu_put_byte(f, v >> 8); qemu_put_byte(f, v); } So this is completely safe. Regards, ANthony Liguori > Later, Juan.