From: Olaf Hering <olaf@aepfle.de>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian.Campbell@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 09/11] tools/xc: pass errno to callers of xc_domain_save
Date: Thu, 6 Mar 2014 20:19:22 +0100 [thread overview]
Message-ID: <20140306191922.GC4113@aepfle.de> (raw)
In-Reply-To: <21272.48052.437173.290651@mariner.uk.xensource.com>
On Thu, Mar 06, Ian Jackson wrote:
> Olaf Hering writes ("[PATCH 09/11] tools/xc: pass errno to callers of xc_domain_save"):
> > Callers of xc_domain_save use errno to print diagnostics if the call
> > fails. But xc_domain_save does not preserve the actual errno in case of
> > a failure.
> >
> > This change preserves errno in all cases where code jumps to the label
> > "out". In addition a new label "exit" is added to catch also code which
> > used to do just "return 1".
>
> I can't help wondering if this patch would be a lot smaller if it were
> done by having ERROR and PERROR, and the cleanup part of
> xc_domain_save, preserve errno.
Something like this for the macros?
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index a610f0c..8b791b6 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -123,9 +123,15 @@ void xc_report_progress_step(xc_interface *xch,
#define DPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a)
#define DBGPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a)
-#define ERROR(_m, _a...) xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a )
-#define PERROR(_m, _a...) xc_report_error(xch,XC_INTERNAL_ERROR,_m \
- " (%d = %s)", ## _a , errno, xc_strerror(xch, errno))
+#define ERROR(_m, _a...) do { int __errno = errno; \
+ xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a ); \
+ errno = __errno; \
+ } while (0)
+#define PERROR(_m, _a...) do { int __errno = errno; \
+ xc_report_error(xch,XC_INTERNAL_ERROR,_m " (%d = %s)", \
+ ## _a , errno, xc_strerror(xch, errno)); \
+ errno = __errno; \
+ } while (0)
/*
* HYPERCALL ARGUMENT BUFFERS
> > Note: some of the functions used in xc_domain_save do not use errno to
> > indicate a reason. In these cases the errno remains undefined as it used
> > to be without this change.
>
> Do you intend to fix this too ?
I will have a look.
Olaf
next prev parent reply other threads:[~2014-03-06 19:19 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 16:13 [PATCH 00/11] tools changes Olaf Hering
2014-03-06 16:13 ` [PATCH 01/11] docs: remove ia64 from kexec_and_kdump.txt Olaf Hering
2014-03-06 16:13 ` [PATCH 02/11] unmodified_drivers: remove ia64 parts of the code Olaf Hering
2014-03-12 13:37 ` Ian Campbell
2014-03-12 14:14 ` Jan Beulich
2014-03-12 14:26 ` Olaf Hering
2014-03-12 15:04 ` Jan Beulich
2014-03-06 16:13 ` [PATCH 03/11] docs: remove ia64 from tmem-internals.html Olaf Hering
2014-03-06 16:13 ` [PATCH 04/11] stubdom: remove ia64 from stubdom Olaf Hering
2014-03-06 16:13 ` [PATCH 05/11] libxc: remove ia64 from xg_private.h Olaf Hering
2014-03-06 16:13 ` [PATCH 06/11] pygrub: remote ia64 from pygrub Olaf Hering
2014-03-06 18:04 ` Ian Jackson
2014-03-06 18:59 ` Olaf Hering
2014-03-07 11:06 ` Ian Jackson
2014-03-06 16:13 ` [PATCH 07/11] xend: remove ia64 from xend sources Olaf Hering
2014-03-06 16:13 ` [PATCH 08/11] libxl: add option for discard support to xl disk configuration Olaf Hering
2014-03-06 18:15 ` Ian Jackson
2014-03-06 19:11 ` Olaf Hering
2014-03-06 16:13 ` [PATCH 09/11] tools/xc: pass errno to callers of xc_domain_save Olaf Hering
2014-03-06 18:17 ` Ian Jackson
2014-03-06 19:19 ` Olaf Hering [this message]
2014-03-10 16:49 ` Ian Jackson
2014-03-11 8:21 ` Olaf Hering
2014-03-11 11:18 ` Ian Jackson
2014-03-06 16:13 ` [PATCH 10/11] xend/pvscsi: recognize also SCSI CDROM devices Olaf Hering
2014-03-06 18:19 ` Ian Jackson
2014-03-06 19:20 ` Olaf Hering
2014-03-06 16:13 ` [PATCH 11/11] tools/xend: move assert to exception block Olaf Hering
2014-03-06 18:07 ` [PATCH 00/11] tools changes Ian Jackson
2014-03-12 14:41 ` Ian Campbell
2014-03-12 14:41 ` Boris Ostrovsky
2014-03-12 15:01 ` Ian Campbell
2014-03-12 15:17 ` Boris Ostrovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140306191922.GC4113@aepfle.de \
--to=olaf@aepfle.de \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.