From: Ian Campbell Subject: Re: [PATCH v4 3/9] tools/libxc: Stream specification and some common code Date: Wed, 7 May 2014 14:07:11 +0100 Message-ID: <1399468031.13430.69.camel@kazak.uk.xensource.com> References: <1398883012-28413-1-git-send-email-andrew.cooper3@citrix.com> <1398883012-28413-4-git-send-email-andrew.cooper3@citrix.com> <1399463828.13430.19.camel@kazak.uk.xensource.com> <536A238C.1010900@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <536A238C.1010900@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: David Vrabel , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2014-05-07 at 13:14 +0100, Andrew Cooper wrote: > On 07/05/14 12:57, Ian Campbell wrote: > > On Wed, 2014-04-30 at 19:36 +0100, Andrew Cooper wrote: > >> diff --git a/tools/libxc/saverestore/stream_format.h b/tools/libxc/saverestore/stream_format.h > >> new file mode 100644 > >> index 0000000..efcca60 > >> --- /dev/null > >> +++ b/tools/libxc/saverestore/stream_format.h > > Reference to the spec (which doesn't appear to be in this series > > anywhere BTW) > > The spec pdf is referenced in the header. I suppose it should move into > docs/. Please. > > > > >> @@ -0,0 +1,158 @@ > >> +#ifndef __STREAM_FORMAT__H > >> +#define __STREAM_FORMAT__H > >> + > >> +#include > >> + > >> +/* TODO - find somewhere more appropriate. rec_tsc_info needs it for 64bit */ > > You seem to use it on all of them though. Can we not use explicit > > padding, as you seem to do for many of the other structs? > > The issue with rec_tsc_info is its trailing alignment. i.e. > sizeof(rec_tsc_info) is different between 32 and 64 bit builds, yet all > fields are at the same offset from the beginning. Putting explicit > trailing padding would invalidate the current code writing > sizeof(rec_tsc_info) bytes into the stream. Putting it inside the struct, like you do elsewhere, would not have this problem I think. > This particular bit is to match the spec, but I see what you mean. I > shall make it consistently upper case. > > I hadn't actually considered an enum. It might be ok as each type field > is passed as a uint32_t, although changing it would be faff for no > appreciable gain. Yes, if you can't change the variables which store it there isn't much gain. If you can change the variables then it lets you use switch statements to make sure you handle all cases, but that probably doesn't justify the churn. Ian.