diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2013-07-19 12:51:07 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-08-20 15:40:36 +0100 |
commit | 623038e4df4f09946e6126e5744a3a2e28add28f (patch) | |
tree | 793eafdc9110ffb9aed778dbac2c8640a9e5b472 /xen/tools | |
parent | 484a3711b42261f3a82e21bf5164a7021d52356f (diff) | |
download | xen-623038e4df4f09946e6126e5744a3a2e28add28f.tar.gz xen-623038e4df4f09946e6126e5744a3a2e28add28f.tar.bz2 xen-623038e4df4f09946e6126e5744a3a2e28add28f.zip |
xen/compat: support XEN_HAVE_FOO ifdefs in public interface
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>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'xen/tools')
-rwxr-xr-x | xen/tools/compat-build-header.py | 3 | ||||
-rwxr-xr-x | 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 fba2f37861..e29606295e 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 3906b71ea0..55206e637a 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" ], |