libxc: osdep: report missing backends in common code
authorIan Campbell <ian.campbell@citrix.com>
Thu, 13 Oct 2011 09:32:09 +0000 (10:32 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 13 Oct 2011 09:32:09 +0000 (10:32 +0100)
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>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
Requires Daniel De Graaf's "libxc: add xc_gntshr_* functions"

tools/libxc/xc_netbsd.c
tools/libxc/xc_private.c
tools/libxc/xc_solaris.c

index 72e1c2851752ffb5ae0b527c57498aa0a078ebe8..0f49e30ad1177378f7ba14e9ce9e5d2108ad7af2 100644 (file)
@@ -386,9 +386,6 @@ static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_t
         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;
     }
index 09a91e75adf21ca67d38c07838b8ca8d9cabf0dc..3ceed3e66092f9ccc75e2ea8ba08a33f3fa2a4fd 100644 (file)
@@ -111,6 +111,18 @@ static void xc_osdep_put(xc_osdep_info_t *info)
 #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_interface_open_common(xentoollog_logger *log
 
         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)
index 9de8505bb6b65cb87ed54b0ece6d60893ef90b03..eba4358c9dba45a3a43bc472dc83e3e08b764a4f 100644 (file)
@@ -322,9 +322,6 @@ static struct xc_osdep_ops *solaris_osdep_init(xc_interface *xch, enum xc_osdep_
         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;
     }