Ian Campbell
2011-Oct-13 09:33 UTC
[Xen-devel] [PATCH] libxc: osdep: report missing backends in common code
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1318498329 -3600 # Node ID c4c4e2768341b3003734e0ce83cab59d05f4ebac # Parent b8c4238b870225d00fec8a7cbba9387d213a02e5 libxc: osdep: report missing backends in common code Backends were inconsistent about reporting and it''s a pain to edit them all when adding a new class of osdep. Signed-off-by: Ian Campbell <Ian.campbell@citrix.com> --- Requires Daniel De Graaf''s "libxc: add xc_gntshr_* functions" diff -r b8c4238b8702 -r c4c4e2768341 tools/libxc/xc_netbsd.c --- a/tools/libxc/xc_netbsd.c Thu Oct 13 10:32:09 2011 +0100 +++ b/tools/libxc/xc_netbsd.c Thu Oct 13 10:32:09 2011 +0100 @@ -386,9 +386,6 @@ static struct xc_osdep_ops *netbsd_osdep return &netbsd_privcmd_ops; case XC_OSDEP_EVTCHN: return &netbsd_evtchn_ops; - case XC_OSDEP_GNTTAB: - ERROR("GNTTAB interface not supported on this platform"); - return NULL; default: return NULL; } diff -r b8c4238b8702 -r c4c4e2768341 tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Thu Oct 13 10:32:09 2011 +0100 +++ b/tools/libxc/xc_private.c Thu Oct 13 10:32:09 2011 +0100 @@ -111,6 +111,18 @@ static void xc_osdep_put(xc_osdep_info_t #endif } +static const char *xc_osdep_type_name(enum xc_osdep_type type) +{ + switch ( type ) + { + case XC_OSDEP_PRIVCMD: return "privcmd"; + case XC_OSDEP_EVTCHN: return "evtchn"; + case XC_OSDEP_GNTTAB: return "gnttab"; + case XC_OSDEP_GNTSHR: return "gntshr"; + } + return "unknown"; +} + static struct xc_interface_core *xc_interface_open_common(xentoollog_logger *logger, xentoollog_logger *dombuild_logger, unsigned open_flags, @@ -161,7 +173,11 @@ static struct xc_interface_core *xc_inte xch->ops = xch->osdep.init(xch, type); if ( xch->ops == NULL ) + { + ERROR("OSDEP: interface %d (%s) not supported on this platform", + type, xc_osdep_type_name(type)); goto err_put_iface; + } xch->ops_handle = xch->ops->open(xch); if (xch->ops_handle == XC_OSDEP_OPEN_ERROR) diff -r b8c4238b8702 -r c4c4e2768341 tools/libxc/xc_solaris.c --- a/tools/libxc/xc_solaris.c Thu Oct 13 10:32:09 2011 +0100 +++ b/tools/libxc/xc_solaris.c Thu Oct 13 10:32:09 2011 +0100 @@ -322,9 +322,6 @@ static struct xc_osdep_ops *solaris_osde return &solaris_privcmd_ops; case XC_OSDEP_EVTCHN: return &solaris_evtchn_ops; - case XC_OSDEP_GNTTAB: - ERROR("GNTTAB interface not supported on this platform"); - return NULL; default: return NULL; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel