tools/libs/guest: fix out of tree builds of libxenguest users
PATCH 1/1 tools/libs/guest: fix out of tree builds of libxenguest users
xenguest.h includes xenctrl_dom.h, which is including the Xen internal xen/libelf/libelf.h. This results in build failures for components using libxenguest when being built outside the Xen build environment.
Fix that by guarding the include of xenctrl_dom.h with "#ifdef __XEN_TOOLS_".
--- tools/libs/guest/include/xenguest.h | 2 ++ 1 file changed, 2 insertions(+)
tools/libs/guest/include/xenguest.h +2 -0
@@ -22,7 +22,9 @@#ifndef XENGUEST_H #define XENGUEST_H +#ifdef __XEN_TOOLS__#include <xenctrl_dom.h> +#endif #define XC_NUMA_NO_NODE (~0U)
Signature · 1 line
2.26.2
Quoted 19 lines · Juergen Gross
xenguest.hincludesxenctrl_dom.h, which is including the Xen internalxen/libelf/libelf.h. This results in build failures for components using libxenguest when being built outside the Xen build environment.Fix that by guarding the include of
xenctrl_dom.hwith "#ifdef__XEN_TOOLS_".Fixes 7e0165c19387 ("tools/libxc: untangle libxenctrl from libxenguest")Reported-by Andrew Cooper <[email protected]>Signed-off-by Juergen Gross <[email protected]>--- tools/libs/guest/include/xenguest.h | 2 ++ 1 file changed, 2 insertions(+)tools/libs/guest/include/xenguest.h +0
-0
tools/libs/guest/include/xenguest.h line 27
Quoted 6 lines
tools/libs/guest/include/xenguest.h +2
-0@@ -22,7 +22,9 @@#ifndef XENGUEST_H #define XENGUEST_H +#ifdef __XEN_TOOLS__#include <xenctrl_dom.h> +#endif
I have to admit that this doesn't feel right to put into a public header.
Can't we split xenctrl_dom in half and merge the relevant subsets into xen{ctrl,guest}.h ?
~Andrew
Quoted 23 lines · Andrew Cooper
Quoted 22 lines · Juergen Gross
xenguest.hincludesxenctrl_dom.h, which is including the Xen internalxen/libelf/libelf.h. This results in build failures for components using libxenguest when being built outside the Xen build environment.Fix that by guarding the include of
xenctrl_dom.hwith "#ifdef__XEN_TOOLS_".Fixes 7e0165c19387 ("tools/libxc: untangle libxenctrl from libxenguest")Reported-by Andrew Cooper <[email protected]>Signed-off-by Juergen Gross <[email protected]>--- tools/libs/guest/include/xenguest.h | 2 ++ 1 file changed, 2 insertions(+)tools/libs/guest/include/xenguest.h +0
-0@@ -22,7 +22,9 @@#ifndef XENGUEST_H #define XENGUEST_H
Quoted 8 lines
tools/libs/guest/include/xenguest.h line 27
Quoted 3 lines
tools/libs/guest/include/xenguest.h +2
-0+#ifdef __XEN_TOOLS__#include <xenctrl_dom.h> +#endif I have to admit that this doesn't feel right to put into a public header.
Can't we split
xenctrl_domin half and merge the relevant subsets into xen{ctrl,guest}.h ?
Yes, but the xenctrl.h half will be empty :-) (see my patch from Sep 9th).
The #ifdef will remain, though.
Another solution would be to make xenctrl_dom.h an internal header again which has to be included by every user needing the domain loader stuff. Question then is why all of this is part of libxenguest.
Or we could remove the prototype of xc_dom_register_loader() and the definition of struct xc_dom_loader from the header and make it private to libxenguest, and modify struct xc_dom_image to hold an opaque pointer to struct elf_dom_parms instead of having it as a sub-structure. This would remove the need to include xen/libelf/libelf.h from xenctrl_dom.h. The question would then be how usable the whole stuff is for someone not having the layout of struct elf_dom_parms.
And finally we could split libxenguest and have a libxendomload which will be usable Xen internal only.
Any preference?
Juergen
Quoted 41 lines · Jürgen Groß
Quoted 28 lines · Andrew Cooper
Quoted 19 lines · Juergen Gross
xenguest.hincludesxenctrl_dom.h, which is including the Xen internalxen/libelf/libelf.h. This results in build failures for components using libxenguest when being built outside the Xen build environment.Fix that by guarding the include of
xenctrl_dom.hwith "#ifdef__XEN_TOOLS_".Fixes 7e0165c19387 ("tools/libxc: untangle libxenctrl from libxenguest")Reported-by Andrew Cooper <[email protected]>Signed-off-by Juergen Gross <[email protected]>---
tools/libs/guest/include/xenguest.h| 2 ++1 file changed, 2 insertions(+)tools/libs/guest/include/xenguest.h +0
-0tools/libs/guest/include/xenguest.h line 26
Quoted 5 lines
tools/libs/guest/include/xenguest.h +2
-0@@ -22,7 +22,9 @@ #ifndef XENGUEST_H #define XENGUEST_H +#ifdef __XEN_TOOLS__ #include <xenctrl_dom.h> +#endif I have to admit that this doesn't feel right to put into a public header.
Quoted 2 lines
Can't we split
xenctrl_domin half and merge the relevant subsets into xen{ctrl,guest}.h ?Yes, but the
xenctrl.hhalf will be empty :-) (see my patch from Sep 9th).The #ifdef will remain, though.
Another solution would be to make
xenctrl_dom.han internal header again which has to be included by every user needing the domain loader stuff. Question then is why all of this is part of libxenguest.
Quoted 7 lines
Or we could remove the prototype of
xc_dom_register_loader()and the definition of structxc_dom_loaderfrom the header and make it private to libxenguest, and modify structxc_dom_imageto hold an opaque pointer to structelf_dom_parmsinstead of having it as a sub-structure. This would remove the need to includexen/libelf/libelf.hfromxenctrl_dom.h. The question would then be how usable the whole stuff is for someone not having the layout of structelf_dom_parms.
I just discovered that currently only 5 elements of struct elf_dom_parms are being used by libxenguest users in Xen. We could add accessors for those to libxenguest.
This would be my favorite solution (including the merge of xenctrl_dom.h into xenguest.h).
Quoted 5 lines
And finally we could split libxenguest and have a libxendomload which will be usable Xen internal only.
Any preference?
Juergen