diff mbox

[v3,3/9] version/livepatch: Move xen_build_id_check to version.h

Message ID 1471211546-2235-4-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Aug. 14, 2016, 9:52 p.m. UTC
It makes more sense for it to be there. However that
means the version.h has now a dependency on <xen/elfstructs.h>
as the Elf_Note is a macro.

The elfstructs.h has a dependency on types.h as well so
we need that. We cannot put that #include <xen/types.h>
in elfstructs.h as that file is used by tools and they
do not have such file.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

---
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

v3: First submission
---
 xen/include/xen/livepatch.h | 2 --
 xen/include/xen/version.h   | 8 ++++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Jan Beulich Aug. 15, 2016, 10:35 a.m. UTC | #1
>>> On 14.08.16 at 23:52, <konrad.wilk@oracle.com> wrote:
> It makes more sense for it to be there. However that
> means the version.h has now a dependency on <xen/elfstructs.h>
> as the Elf_Note is a macro.
> 
> The elfstructs.h has a dependency on types.h as well so
> we need that. We cannot put that #include <xen/types.h>
> in elfstructs.h as that file is used by tools and they
> do not have such file.

I think that's acceptable, as the number of places this header gets
included is pretty limited. Hence the alternative of making the
declaration conditional upon Elf_Note being defined is likely the
uglier one (as it would impose ordering constraints on the #include-s
used by respective source files).

> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Ross Lagerwall Aug. 19, 2016, 9:29 a.m. UTC | #2
On 08/14/2016 10:52 PM, Konrad Rzeszutek Wilk wrote:
> It makes more sense for it to be there. However that
> means the version.h has now a dependency on <xen/elfstructs.h>
> as the Elf_Note is a macro.
>
> The elfstructs.h has a dependency on types.h as well so
> we need that. We cannot put that #include <xen/types.h>
> in elfstructs.h as that file is used by tools and they
> do not have such file.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> ---
> Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
>

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
diff mbox

Patch

diff --git a/xen/include/xen/livepatch.h b/xen/include/xen/livepatch.h
index ed49843..02f4572 100644
--- a/xen/include/xen/livepatch.h
+++ b/xen/include/xen/livepatch.h
@@ -42,8 +42,6 @@  int livepatch_op(struct xen_sysctl_livepatch_op *);
 void check_for_livepatch_work(void);
 unsigned long livepatch_symbols_lookup_by_name(const char *symname);
 bool_t is_patch(const void *addr);
-int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
-                       const void **p, unsigned int *len);
 
 /* Arch hooks. */
 int arch_livepatch_verify_elf(const struct livepatch_elf *elf);
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 400160f..97c247a 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -1,6 +1,9 @@ 
 #ifndef __XEN_VERSION_H__
 #define __XEN_VERSION_H__
 
+#include <xen/types.h>
+#include <xen/elfstructs.h>
+
 const char *xen_compile_date(void);
 const char *xen_compile_time(void);
 const char *xen_compile_by(void);
@@ -15,4 +18,9 @@  const char *xen_banner(void);
 const char *xen_deny(void);
 int xen_build_id(const void **p, unsigned int *len);
 
+#ifdef BUILD_ID
+int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
+                       const void **p, unsigned int *len);
+#endif
+
 #endif /* __XEN_VERSION_H__ */