From: Anthony PERARD Subject: Re: [PATCH 1/2] xen: fix usage of ENODATA Date: Tue, 15 Apr 2014 17:15:52 +0100 Message-ID: <20140415161552.GD2554@perard.uk.xensource.com> References: <1397550789-43232-1-git-send-email-roger.pau@citrix.com> <1397550789-43232-2-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wa61e-0006kq-JX for xen-devel@lists.xenproject.org; Tue, 15 Apr 2014 16:15:58 +0000 Content-Disposition: inline In-Reply-To: <1397550789-43232-2-git-send-email-roger.pau@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: Roger Pau Monne Cc: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Tue, Apr 15, 2014 at 10:33:08AM +0200, Roger Pau Monne wrote: > ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the > hypervisor are translated to ENOENT. > = > Also, the error code is returned in errno if the call returns -1, so > compare the error code with the value in errno instead of the value > returned by the function. But in xenctrl.h, the comment on the prototype of the function says that it return the error code, there is nothing about errno been updated. So I think rc should still be check for the error code instead of errno. > Signed-off-by: Roger Pau Monn=E9 > Cc: xen-devel@lists.xenproject.org > Cc: Stefano Stabellini > Cc: Anthony Perard > --- > xen-all.c | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > = > diff --git a/xen-all.c b/xen-all.c > index 0b4d934..4026b7b 100644 > --- a/xen-all.c > +++ b/xen-all.c > @@ -499,11 +499,15 @@ static void xen_sync_dirty_bitmap(XenIOState *state, > start_addr >> TARGET_PAGE_BITS, npages, > bitmap); > if (rc < 0) { > - if (rc !=3D -ENODATA) { > +#ifdef ENODATA > + if (errno =3D=3D ENODATA) { > +#else > + if (errno =3D=3D ENOENT) { > +#endif > memory_region_set_dirty(framebuffer, 0, size); > DPRINTF("xen: track_dirty_vram failed (0x" TARGET_FMT_plx > ", 0x" TARGET_FMT_plx "): %s\n", > - start_addr, start_addr + size, strerror(-rc)); > + start_addr, start_addr + size, strerror(errno)); > } > return; > } > -- = > 1.7.7.5 (Apple Git-26) > = -- = Anthony PERARD