From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v5 RFC 09/14] tools/libxc: x86 PV restore code Date: Thu, 12 Jun 2014 18:01:29 +0100 Message-ID: <5399DCE9.40202@citrix.com> References: <1402510482-21099-1-git-send-email-andrew.cooper3@citrix.com> <1402510482-21099-10-git-send-email-andrew.cooper3@citrix.com> <5399CC03.7010809@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5399CC03.7010809@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: David Vrabel Cc: Frediano Ziglio , Xen-devel List-Id: xen-devel@lists.xenproject.org On 12/06/14 16:49, David Vrabel wrote: > On 11/06/14 19:14, Andrew Cooper wrote: >> --- /dev/null >> +++ b/tools/libxc/saverestore/restore_x86_pv.c > ... >> +static int x86_pv_process_record(struct context *ctx, struct record *rec) >> +{ >> + xc_interface *xch = ctx->xch; >> + >> + switch ( rec->type ) >> + { >> + case REC_TYPE_X86_PV_INFO: >> + return handle_x86_pv_info(ctx, rec); >> + > ... >> + >> + case REC_TYPE_X86_PV_VCPU_MSRS: >> + return handle_x86_pv_vcpu_msrs(ctx, rec); >> + >> + default: >> + if ( rec->type & REC_TYPE_OPTIONAL ) >> + { >> + IPRINTF("Ignoring optional record (0x%"PRIx32", %s)", >> + rec->type, rec_type_to_str(rec->type)); >> + return 0; >> + } >> + >> + ERROR("Invalid record type (0x%"PRIx32", %s) for x86_pv domains", >> + rec->type, rec_type_to_str(rec->type)); >> + return -1; >> + } > I think this default case can be moved to common code. Perhaps return > XC_SR_RECORD_UNHANDLED (== 1) to indicate the record wasn't handled. > > David It am looking to not adversely affect any attempt to standardise libxc error reporting in the future, which is why all this code uses 0 or -1, even though errno might or might not be relevant. Even at the moment, there are callbacks into higher level toolstacks which can return any arbitrary error. ~Andrew