[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [xen-devel] [PATCH] libxl: fix compile error of libvirt
On Thu, 2012-02-23 at 08:45 +0000, Ian Campbell wrote: > On Wed, 2012-02-22 at 21:40 +0000, Jim Fehlig wrote: > > Ian Jackson wrote: > > > Bamvor Jian Zhang writes ("Re: [Xen-devel] [xen-devel] [PATCH] libxl: fix > > > compile error of libvirt"): > > > > > >> Ian Jackson wrote: > > >> > > >>> Users of libxl should not be using libxc directly and therefore should > > >>> not be including xenctrl.h. > > >>> > > > ... > > > > > >> but after your commit "23174:751c6dcec0d4"(remove xenctrl.h from > > >> libxl.h), the aplication(like libvirt) compile fail. How do i deal with > > >> it? > > >> it seems that add __XEN_TOOLS_ to libvirt code is not good. > > >> > > > > > > Can you tell us the error message you get ? I think the problem is > > > probably that libvirt is trying to use libxc directly. > > > > > > > The libvirt libxl driver doesn't use libxc directly. AFAICT, the problem > > is that libxl.h includes <xen/sysctl.h>, which has this > > > > #if !defined(__XEN__) && !defined(__XEN_TOOLS__) > > #error "sysctl operations are intended for use by node control tools only" > > #endif > > > > Without the defines, Bamvor is hitting the #error directive. > > I thought we'd discussed and resolved this ages ago but I guess we only > discussed it... > > How about the following: I also have the following, I think the benefits are less obvious for this one though but it does mean we are consistently avoiding all xen public headers in the libxl public API which at least has the benefit of being simple to describe. 8<------------------------------- # HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1329986824 0 # Node ID ad39625c16966fe004c25e5be81af0e32cf8646a # Parent d256d6b42ee77cdff0356c37d6fcaf6203a21ba6 libxl: Remove xen/sched.h from public interface Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r d256d6b42ee7 -r ad39625c1696 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Feb 23 08:37:13 2012 +0000 +++ b/tools/libxl/libxl.h Thu Feb 23 08:47:04 2012 +0000 @@ -137,8 +137,6 @@ #include <xentoollog.h> -#include <xen/sched.h> - #include <libxl_uuid.h> #include <_libxl_list.h> @@ -638,12 +636,7 @@ int libxl_cpupool_cpuremove(libxl_ctx *c int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus); int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid); -static inline int libxl_domid_valid_guest(uint32_t domid) -{ - /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise - * does not check whether the domain actually exists */ - return domid > 0 && domid < DOMID_FIRST_RESERVED; -} +int libxl_domid_valid_guest(uint32_t domid); int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len, uint32_t *ssidref); diff -r d256d6b42ee7 -r ad39625c1696 tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Thu Feb 23 08:37:13 2012 +0000 +++ b/tools/libxl/libxl_types.idl Thu Feb 23 08:47:04 2012 +0000 @@ -107,6 +107,15 @@ libxl_scheduler = Enumeration("scheduler (7, "arinc653"), ]) +# Consistent with SHUTDOWN_* in sched.h +libxl_shutdown_reason = Enumeration("shutdown_reason", [ + (0, "poweroff"), + (1, "reboot"), + (2, "suspend"), + (3, "crash"), + (4, "watchdog"), + ]) + # # Complex libxl types # @@ -154,7 +163,7 @@ libxl_dominfo = Struct("dominfo",[ # # Otherwise set to a value guaranteed not to clash with any valid # SHUTDOWN_* constant. - ("shutdown_reason", uint8), + ("shutdown_reason", libxl_shutdown_reason), ("current_memkb", uint64), ("shared_memkb", uint64), ("max_memkb", uint64), diff -r d256d6b42ee7 -r ad39625c1696 tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Thu Feb 23 08:37:13 2012 +0000 +++ b/tools/libxl/libxl_utils.c Thu Feb 23 08:47:04 2012 +0000 @@ -507,6 +507,13 @@ void libxl_cputopology_list_free(libxl_c free(list); } +int libxl_domid_valid_guest(uint32_t domid) +{ + /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise + * does not check whether the domain actually exists */ + return domid > 0 && domid < DOMID_FIRST_RESERVED; +} + /* * Local variables: * mode: C diff -r d256d6b42ee7 -r ad39625c1696 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Feb 23 08:37:13 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Thu Feb 23 08:47:04 2012 +0000 @@ -1230,19 +1230,19 @@ static int handle_domain_death(libxl_ctx libxl_action_on_shutdown action; switch (event->u.domain_shutdown.shutdown_reason) { - case SHUTDOWN_poweroff: + case LIBXL_SHUTDOWN_REASON_POWEROFF: action = d_config->on_poweroff; break; - case SHUTDOWN_reboot: + case LIBXL_SHUTDOWN_REASON_REBOOT: action = d_config->on_reboot; break; - case SHUTDOWN_suspend: + case LIBXL_SHUTDOWN_REASON_SUSPEND: LOG("Domain has suspended."); return 0; - case SHUTDOWN_crash: + case LIBXL_SHUTDOWN_REASON_CRASH: action = d_config->on_crash; break; - case SHUTDOWN_watchdog: + case LIBXL_SHUTDOWN_REASON_WATCHDOG: action = d_config->on_watchdog; break; default: _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |