[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] extends xm info with xen version and various others information.
# HG changeset patch # User vh249@xxxxxxxxxxxxxxxxxxxxxx # Node ID d6752f193ffa85b9eaa449ff854a6aac986cf821 # Parent 6d4c0bfc3c1c15d1871d17698bfd78a9ea05aff5 extends xm info with xen version and various others information. exports version hypercall to userspace Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx> diff -r 6d4c0bfc3c1c -r d6752f193ffa tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Wed Aug 31 10:24:43 2005 +++ b/tools/libxc/xc_private.c Wed Aug 31 10:39:53 2005 @@ -422,3 +422,8 @@ { return do_dom0_op(xc_handle, op); } + +int xc_version(int xc_handle, int cmd, void *arg) +{ + return do_xen_version(xc_handle, cmd, arg); +} diff -r 6d4c0bfc3c1c -r d6752f193ffa tools/libxc/xc_private.h --- a/tools/libxc/xc_private.h Wed Aug 31 10:24:43 2005 +++ b/tools/libxc/xc_private.h Wed Aug 31 10:39:53 2005 @@ -59,6 +59,17 @@ (unsigned long)hypercall); } +static inline int do_xen_version(int xc_handle, int cmd, void *dest) +{ + privcmd_hypercall_t hypercall; + + hypercall.op = __HYPERVISOR_xen_version; + hypercall.arg[0] = (unsigned long) cmd; + hypercall.arg[1] = (unsigned long) dest; + + return do_xen_hypercall(xc_handle, &hypercall); +} + static inline int do_dom0_op(int xc_handle, dom0_op_t *op) { int ret = -1; diff -r 6d4c0bfc3c1c -r d6752f193ffa tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Wed Aug 31 10:24:43 2005 +++ b/tools/libxc/xenctrl.h Wed Aug 31 10:39:53 2005 @@ -23,6 +23,7 @@ #include <sys/ptrace.h> #include <xen/xen.h> #include <xen/dom0_ops.h> +#include <xen/version.h> #include <xen/event_channel.h> #include <xen/sched_ctl.h> #include <xen/acm.h> @@ -497,6 +498,8 @@ /* Execute a privileged dom0 operation. */ int xc_dom0_op(int xc_handle, dom0_op_t *op); +int xc_version(int xc_handle, int cmd, void *arg); + /* Initializes the store (for dom0) remote_port should be the remote end of a bound interdomain channel between the store and dom0. diff -r 6d4c0bfc3c1c -r d6752f193ffa tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Wed Aug 31 10:24:43 2005 +++ b/tools/python/xen/lowlevel/xc/xc.c Wed Aug 31 10:39:53 2005 @@ -707,6 +707,39 @@ "cpu_khz", info.cpu_khz); } +static PyObject *pyxc_xeninfo(PyObject *self, + PyObject *args, + PyObject *kwds) +{ + XcObject *xc = (XcObject *)self; + xen_extraversion_t xen_extra; + xen_compile_info_t xen_cc; + xen_changeset_info_t xen_chgset; + long xen_version; + + xen_version = xc_version(xc->xc_handle, XENVER_version, NULL); + + if ( xc_version(xc->xc_handle, XENVER_extraversion, &xen_extra) != 0 ) + return PyErr_SetFromErrno(xc_error); + + if ( xc_version(xc->xc_handle, XENVER_compile_info, &xen_cc) != 0 ) + return PyErr_SetFromErrno(xc_error); + + if ( xc_version(xc->xc_handle, XENVER_changeset, &xen_chgset) != 0 ) + return PyErr_SetFromErrno(xc_error); + + return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s}", + "xen_major", xen_version >> 16, + "xen_minor", (xen_version & 0xffff), + "xen_extra", xen_extra, + "xen_changeset", xen_chgset, + "cc_compiler", xen_cc.compiler, + "cc_compile_by", xen_cc.compile_by, + "cc_compile_domain", xen_cc.compile_domain, + "cc_compile_date", xen_cc.compile_date); +} + + static PyObject *pyxc_sedf_domain_set(PyObject *self, PyObject *args, PyObject *kwds) @@ -1089,6 +1122,13 @@ "Returns [dict]: information about the hardware" " [None]: on failure.\n" }, + { "xeninfo", + (PyCFunction)pyxc_xeninfo, + METH_VARARGS, "\n" + "Get information about the Xen host\n" + "Returns [dict]: information about Xen" + " [None]: on failure.\n" }, + { "shadow_control", (PyCFunction)pyxc_shadow_control, METH_VARARGS | METH_KEYWORDS, "\n" diff -r 6d4c0bfc3c1c -r d6752f193ffa tools/python/xen/xend/XendNode.py --- a/tools/python/xen/xend/XendNode.py Wed Aug 31 10:24:43 2005 +++ b/tools/python/xen/xend/XendNode.py Wed Aug 31 10:39:53 2005 @@ -46,7 +46,7 @@ return self.xc.bvtsched_global_get() def info(self): - return self.nodeinfo() + self.physinfo() + return self.nodeinfo() + self.physinfo() + self.xeninfo() def nodeinfo(self): (sys, host, rel, ver, mch) = os.uname() @@ -65,7 +65,16 @@ ['free_memory', pinfo['free_pages']/256]] return info - + def xeninfo(self): + xinfo = self.xc.xeninfo() + return [['xen_major', xinfo['xen_major']], + ['xen_minor', xinfo['xen_minor']], + ['xen_extra', xinfo['xen_extra']], + ['xen_changeset', xinfo['xen_changeset']], + ['cc_compiler', xinfo['cc_compiler']], + ['cc_compile_by', xinfo['cc_compile_by']], + ['cc_compile_domain', xinfo['cc_compile_domain']], + ['cc_compile_date', xinfo['cc_compile_date']]] def instance(): global inst diff -r 6d4c0bfc3c1c -r d6752f193ffa xen/common/kernel.c --- a/xen/common/kernel.c Wed Aug 31 10:24:43 2005 +++ b/xen/common/kernel.c Wed Aug 31 10:39:53 2005 @@ -110,6 +110,27 @@ return -EFAULT; return 0; } + + case XENVER_capabilities: + { + struct xen_capabilities_info info; + + /* FIXME */ + info.arch = 0; + info.pae = 0; + if ( copy_to_user(arg, &info, sizeof(info)) ) + return -EFAULT; + return 0; + } + + case XENVER_changeset: + { + xen_changeset_info_t chgset; + safe_strcpy(chgset, XEN_CHANGESET); + if ( copy_to_user(arg, chgset, sizeof(chgset)) ) + return -EFAULT; + return 0; + } } return -ENOSYS; diff -r 6d4c0bfc3c1c -r d6752f193ffa xen/include/public/version.h --- a/xen/include/public/version.h Wed Aug 31 10:24:43 2005 +++ b/xen/include/public/version.h Wed Aug 31 10:39:53 2005 @@ -28,4 +28,13 @@ char compile_date[32]; } xen_compile_info_t; +#define XENVER_capabilities 3 +typedef struct xen_capabilities_info { + int pae; + int arch; +} xen_capabilities_info_t; + +#define XENVER_changeset 4 +typedef char xen_changeset_info_t[64]; + #endif /* __XEN_PUBLIC_VERSION_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |