From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: keir@xen.org, Ian Campbell <ian.campbell@citrix.com>,
stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com,
tim@xen.org, julien.grall@citrix.com, jbeulich@suse.com
Subject: [PATCH v6 1/5] xen/compat: support XEN_HAVE_FOO ifdefs in public interface
Date: Fri, 19 Jul 2013 12:51:07 +0100 [thread overview]
Message-ID: <1374234671-6547-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1374234595.13645.59.camel@kazak.uk.xensource.com>
This allows us expose or hide interface features on different architectures
without requiring nasty arch-specific ifdeffery.
Preserves any #ifdef with a XEN_HAVE_* symbol name, as well as any #else or
The ifdef symbol becomes COMPAT_HAVE in the compat versions so that
architectures can enable or disable interfaces for compat mode too. (This
actually just fell out of the way the existing stuff works and it didn't seem
worth jumping through hoops to make the name remain XEN_HAVE).
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
---
| 3 +++
xen/tools/compat-build-source.py | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
--git a/xen/tools/compat-build-header.py b/xen/tools/compat-build-header.py
index fba2f37..e296062 100755
--- a/xen/tools/compat-build-header.py
+++ b/xen/tools/compat-build-header.py
@@ -4,6 +4,9 @@ import re,sys
pats = [
[ r"__InClUdE__(.*)", r"#include\1\n#pragma pack(4)" ],
+ [ r"__IfDeF__ (XEN_HAVE.*)", r"#ifdef \1" ],
+ [ r"__ElSe__", r"#else" ],
+ [ r"__EnDif__", r"#endif" ],
[ r"\"xen-compat.h\"", r"<public/xen-compat.h>" ],
[ r"(struct|union|enum)\s+(xen_?)?(\w)", r"\1 compat_\3" ],
[ r"@KeeP@", r"" ],
diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py
index 3906b71..55206e6 100755
--- a/xen/tools/compat-build-source.py
+++ b/xen/tools/compat-build-source.py
@@ -4,6 +4,9 @@ import re,sys
pats = [
[ r"^\s*#\s*include\s+", r"__InClUdE__ " ],
+ [ r"^\s*#\s*ifdef (XEN_HAVE.*)\s+", r"__IfDeF__ \1" ],
+ [ r"^\s*#\s*else /\* (XEN_HAVE.*) \*/\s+", r"__ElSe__" ],
+ [ r"^\s*#\s*endif /\* (XEN_HAVE.*) \*/\s+", r"__EnDif__" ],
[ r"^\s*#\s*define\s+([A-Z_]*_GUEST_HANDLE)", r"#define HIDE_\1" ],
[ r"^\s*#\s*define\s+([a-z_]*_guest_handle)", r"#define hide_\1" ],
[ r"XEN_GUEST_HANDLE(_[0-9A-Fa-f]+)?", r"COMPAT_HANDLE" ],
--
1.7.2.5
next prev parent reply other threads:[~2013-07-19 11:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 11:49 [PATCH v6 0/5] xen: public interface and foreign struct check changes for arm Ian Campbell
2013-07-19 11:51 ` Ian Campbell [this message]
2013-07-19 11:51 ` [PATCH v6 2/5] xen: only expose start_info on architectures which have a PV boot path Ian Campbell
2013-07-19 11:51 ` [PATCH v6 3/5] xen: arm: include public/xen.h in foreign interface checking Ian Campbell
2013-08-07 15:48 ` Ian Jackson
2013-08-08 8:38 ` Ian Campbell
2013-08-08 10:57 ` Ian Jackson
2013-08-08 14:44 ` Ian Campbell
2013-07-19 11:51 ` [PATCH v6 4/5] tools: foreign: add checks for compatible architectures Ian Campbell
2013-07-19 11:51 ` [PATCH v6 5/5] xen: remove evtchn_upcall_mask from interface on ARM Ian Campbell
2013-07-19 13:27 ` [PATCH v6 0/5] xen: public interface and foreign struct check changes for arm Keir Fraser
2013-07-19 13:40 ` Ian Campbell
2013-08-07 15:52 ` Ian Jackson
2013-08-20 15:02 ` Ian Campbell
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=1374234671-6547-1-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@citrix.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).