WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxc: add ability to query OS interface

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: add ability to query OS interface for "fakeness"
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Dec 2010 15:46:05 -0800
Delivery-date: Fri, 24 Dec 2010 15:48:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID 79c2b469a9f8ed5f4cddca88aa58b8879a8ff210
# Parent  36b2cef7eb9c38bb8b2f82027a6cd1b1f1deb56e
libxc: add ability to query OS interface for "fakeness"

i.e. not running on a real hypervisor

Allows users of the library to adjust behaviour. I don't especially
like this violation of the abstraction but both oxenstored and xapi
use this to avoid difficult to simulate operations when running on the
simulator.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
---
 tools/libxc/xc_linux.c     |    1 +
 tools/libxc/xc_minios.c    |    1 +
 tools/libxc/xc_netbsd.c    |    1 +
 tools/libxc/xc_private.c   |   13 +++++++++++++
 tools/libxc/xc_solaris.c   |    1 +
 tools/libxc/xenctrl.h      |    9 +++++++++
 tools/libxc/xenctrlosdep.h |    3 +++
 7 files changed, 29 insertions(+)

diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c    Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_linux.c    Fri Dec 03 09:36:47 2010 +0000
@@ -697,6 +697,7 @@ xc_osdep_info_t xc_osdep_info = {
 xc_osdep_info_t xc_osdep_info = {
     .name = "Linux Native OS interface",
     .init = &linux_osdep_init,
+    .fake = 0,
 };
 
 /*
diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_minios.c   Fri Dec 03 09:36:47 2010 +0000
@@ -549,6 +549,7 @@ xc_osdep_info_t xc_osdep_info = {
 xc_osdep_info_t xc_osdep_info = {
     .name = "Minios Native OS interface",
     .init = &minios_osdep_init,
+    .fake = 0,
 };
 
 /*
diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_netbsd.c   Fri Dec 03 09:36:47 2010 +0000
@@ -373,6 +373,7 @@ xc_osdep_info_t xc_osdep_info = {
 xc_osdep_info_t xc_osdep_info = {
     .name = "Netbsd Native OS interface",
     .init = &netbsd_osdep_init,
+    .fake = 0,
 };
 
 /*
diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_private.c  Fri Dec 03 09:36:47 2010 +0000
@@ -122,6 +122,19 @@ static int xc_interface_close_common(xc_
     return rc;
 }
 
+int xc_interface_is_fake(void)
+{
+    xc_osdep_info_t info;
+
+    if ( xc_osdep_get_info(NULL, &info) < 0 )
+        return -1;
+
+    /* Have a copy of info so can release the interface now. */
+    xc_osdep_put(&info);
+
+    return info.fake;
+}
+
 xc_interface *xc_interface_open(xentoollog_logger *logger,
                                 xentoollog_logger *dombuild_logger,
                                 unsigned open_flags)
diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xc_solaris.c
--- a/tools/libxc/xc_solaris.c  Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_solaris.c  Fri Dec 03 09:36:47 2010 +0000
@@ -321,6 +321,7 @@ xc_osdep_info_t xc_osdep_info = {
 xc_osdep_info_t xc_osdep_info = {
     .name = "Solaris Native OS interface",
     .init = &solaris_osdep_init,
+    .fake = 0,
 };
 
 /*
diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xenctrl.h     Fri Dec 03 09:36:47 2010 +0000
@@ -158,6 +158,15 @@ enum xc_open_flags {
  * @return 0 on success, -1 otherwise.
  */
 int xc_interface_close(xc_interface *xch);
+
+/**
+ * Query the active OS interface (i.e. that which would be returned by
+ * xc_interface_open) to find out if it is fake (i.e. backends onto
+ * something other than an actual Xen hypervisor).
+ *
+ * @return 0 is "real", >0 if fake, -1 on error.
+ */
+int xc_interface_is_fake(void);
 
 /*
  * HYPERCALL SAFE MEMORY BUFFER
diff -r 36b2cef7eb9c -r 79c2b469a9f8 tools/libxc/xenctrlosdep.h
--- a/tools/libxc/xenctrlosdep.h        Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xenctrlosdep.h        Fri Dec 03 09:36:47 2010 +0000
@@ -122,6 +122,9 @@ struct xc_osdep_info
 
     /* Returns ops function. */
     xc_osdep_init_fn init;
+
+    /* True if this interface backs onto a fake Xen. */
+    int fake;
 };
 typedef struct xc_osdep_info xc_osdep_info_t;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: add ability to query OS interface for "fakeness", Xen patchbot-unstable <=