diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-12-03 09:36:47 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-12-03 09:36:47 +0000 |
commit | 048f6a9497466b39eb6f34eb0a699e632c15929f (patch) | |
tree | b323954ad4f08e230ca40aca617d2d458ef93ae9 /tools/libxc/xc_private.c | |
parent | fa0eebfd1bd2a7eea7b6cb424a8d83cebfe6ee0b (diff) | |
download | xen-048f6a9497466b39eb6f34eb0a699e632c15929f.tar.gz xen-048f6a9497466b39eb6f34eb0a699e632c15929f.tar.bz2 xen-048f6a9497466b39eb6f34eb0a699e632c15929f.zip |
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@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_private.c')
-rw-r--r-- | tools/libxc/xc_private.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index aaa0d34ce3..69b674dabf 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -122,6 +122,19 @@ static int xc_interface_close_common(xc_interface *xch) 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) |