From: Ian Campbell Subject: Re: [PATCH v4 7/9] tools/libxc: x86 pv restore implementation Date: Wed, 7 May 2014 17:17:39 +0100 Message-ID: <1399479459.13430.189.camel@kazak.uk.xensource.com> References: <1398883012-28413-1-git-send-email-andrew.cooper3@citrix.com> <1398883012-28413-8-git-send-email-andrew.cooper3@citrix.com> <1399471843.13430.108.camel@kazak.uk.xensource.com> <536A533B.8070501@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <536A533B.8070501@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: Frediano Ziglio , David Vrabel , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2014-05-07 at 16:37 +0100, Andrew Cooper wrote: > On 07/05/14 15:10, Ian Campbell wrote: > > > >> + if ( xc_domain_getinfo(xch, dom, 1, &ctx.dominfo) != 1 ) > >> + { > >> + PERROR("Failed to get domain info"); > >> + return -1; > >> + } > >> + > >> + if ( ctx.dominfo.domid != dom ) > >> + { > >> + ERROR("Domain %d does not exist", dom); > >> + return -1; > >> + } > >> + > >> + ctx.domid = dom; > >> + IPRINTF("Restoring domain %d", dom); > >> + > >> + if ( read_headers(&ctx) ) > >> + return -1; > >> + > >> + if ( ctx.dominfo.hvm ) > >> + { > >> + ERROR("HVM Restore not supported yet"); > >> + return -1; > >> + } > >> + else > > Unneeded. > > Perhaps, but it makes more readable patches as hvm restore is added later. OK, I think this one got dumped in with all the other actually unnecessary elses in my mind. > > Furthermore, all of this will need tweaking when this series stops > trying to coexist alongside the legacy code. >From a reviewer's point of view the sooner this happens the better. > > > > > >> + return -1; > >> + } > >> + else if ( rec->length > sizeof *vcpu + 128 ) > > There's an awful lot of magic numbers throughout this series. Can we try > > and use meaningful symbolic names for things please. > > This one, no. It is magic even in the legacy stream, and is sizeof > domctl.u on the sending toolstack, which thinking forward is not > necessarily sizeof domctl.u on the receiving toolstack. OK. Where a legitimate magic number remains then please add a comment. Ian.