From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH 1/5] xen/compat: support XEN_HAVE_FOO ifdefs in public interface Date: Thu, 18 Jul 2013 14:15:36 +0100 Message-ID: <1374153340-29398-1-git-send-email-ian.campbell@citrix.com> References: <1374153311.26728.86.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1374153311.26728.86.camel@kazak.uk.xensource.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: xen-devel@lists.xen.org Cc: ian.jackson@eu.citrix.com, Ian Campbell , Jan Beulich List-Id: xen-devel@lists.xenproject.org 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 Cc: Jan Beulich --- xen/tools/compat-build-header.py | 3 +++ xen/tools/compat-build-source.py | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --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"" ], [ 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