mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Allow tools to see the hypervisor command line.
This is useful from tools in the same way /proc/cmdline is useful for the domain 0 kernel. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
d914b94a3f
commit
fa97833ae1
6 files changed
+28
-3
No files matched your search
@@ -1132,6 +1132,7 @@ static PyObject *pyxc_xeninfo(XcObject *self)
|
||||
xen_changeset_info_t xen_chgset;
|
||||
xen_capabilities_info_t xen_caps;
|
||||
xen_platform_parameters_t p_parms;
|
||||
xen_commandline_t xen_commandline;
|
||||
long xen_version;
|
||||
long xen_pagesize;
|
||||
char str[128];
|
||||
@@ -1153,13 +1154,16 @@ static PyObject *pyxc_xeninfo(XcObject *self)
|
||||
if ( xc_version(self->xc_handle, XENVER_platform_parameters, &p_parms) != 0 )
|
||||
return pyxc_error_to_exception();
|
||||
|
||||
if ( xc_version(self->xc_handle, XENVER_commandline, &xen_commandline) != 0 )
|
||||
return pyxc_error_to_exception();
|
||||
|
||||
snprintf(str, sizeof(str), "virt_start=0x%lx", p_parms.virt_start);
|
||||
|
||||
xen_pagesize = xc_version(self->xc_handle, XENVER_pagesize, NULL);
|
||||
if (xen_pagesize < 0 )
|
||||
return pyxc_error_to_exception();
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:s,s:s,s:i,s:s,s:s,s:s,s:s,s:s,s:s}",
|
||||
return Py_BuildValue("{s:i,s:i,s:s,s:s,s:i,s:s,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,
|
||||
@@ -1167,6 +1171,7 @@ static PyObject *pyxc_xeninfo(XcObject *self)
|
||||
"xen_pagesize", xen_pagesize,
|
||||
"platform_params", str,
|
||||
"xen_changeset", xen_chgset,
|
||||
"xen_commandline", xen_commandline,
|
||||
"cc_compiler", xen_cc.compiler,
|
||||
"cc_compile_by", xen_cc.compile_by,
|
||||
"cc_compile_domain", xen_cc.compile_domain,
|
||||
|
||||
@@ -91,6 +91,7 @@ class XendNode:
|
||||
# is directly exposed via XenAPI
|
||||
self.other_config["xen_pagesize"] = self.xeninfo_dict()["xen_pagesize"]
|
||||
self.other_config["platform_params"] = self.xeninfo_dict()["platform_params"]
|
||||
self.other_config["xen_commandline"] = self.xeninfo_dict()["xen_commandline"]
|
||||
|
||||
# load CPU UUIDs
|
||||
saved_cpus = self.state_store.load_state('cpu')
|
||||
@@ -612,7 +613,8 @@ class XendNode:
|
||||
"cc_compile_by": xeninfo_dict["cc_compile_by"],
|
||||
"cc_compile_domain": xeninfo_dict["cc_compile_domain"],
|
||||
"cc_compile_date": xeninfo_dict["cc_compile_date"],
|
||||
"xen_changeset": xeninfo_dict["xen_changeset"]
|
||||
"xen_changeset": xeninfo_dict["xen_changeset"],
|
||||
"xen_commandline": xeninfo_dict["xen_commandline"]
|
||||
})
|
||||
|
||||
return info
|
||||
@@ -888,6 +890,7 @@ class XendNode:
|
||||
'xen_pagesize',
|
||||
'platform_params',
|
||||
'xen_changeset',
|
||||
'xen_commandline',
|
||||
'cc_compiler',
|
||||
'cc_compile_by',
|
||||
'cc_compile_domain',
|
||||
|
||||
@@ -1757,6 +1757,7 @@ def xm_info(args):
|
||||
"xen_scheduler": getVal(["sched_policy"]),
|
||||
"xen_pagesize": getVal(["other_config", "xen_pagesize"]),
|
||||
"platform_params": getVal(["other_config", "platform_params"]),
|
||||
"xen_commandline": getVal(["other_config", "xen_commandline"]),
|
||||
"xen_changeset": getVal(["software_version", "xen_changeset"]),
|
||||
"cc_compiler": getVal(["software_version", "cc_compiler"]),
|
||||
"cc_compile_by": getVal(["software_version", "cc_compile_by"]),
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <compat/nmi.h>
|
||||
#include <compat/version.h>
|
||||
|
||||
extern xen_commandline_t saved_cmdline;
|
||||
|
||||
#define xen_extraversion compat_extraversion
|
||||
#define xen_extraversion_t compat_extraversion_t
|
||||
|
||||
|
||||
+12
-1
@@ -24,6 +24,8 @@
|
||||
|
||||
int tainted;
|
||||
|
||||
xen_commandline_t saved_cmdline;
|
||||
|
||||
void cmdline_parse(char *cmdline)
|
||||
{
|
||||
char opt[100], *optval, *optkey, *q;
|
||||
@@ -31,6 +33,8 @@ void cmdline_parse(char *cmdline)
|
||||
struct kernel_param *param;
|
||||
int bool_assert;
|
||||
|
||||
safe_strcpy(saved_cmdline, cmdline);
|
||||
|
||||
if ( p == NULL )
|
||||
return;
|
||||
|
||||
@@ -246,7 +250,14 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE(void) arg)
|
||||
ARRAY_SIZE(current->domain->handle)) )
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
case XENVER_commandline:
|
||||
{
|
||||
if ( copy_to_guest(arg, saved_cmdline, ARRAY_SIZE(saved_cmdline)) )
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -ENOSYS;
|
||||
|
||||
@@ -78,6 +78,9 @@ typedef struct xen_feature_info xen_feature_info_t;
|
||||
/* arg == xen_domain_handle_t. */
|
||||
#define XENVER_guest_handle 8
|
||||
|
||||
#define XENVER_commandline 9
|
||||
typedef char xen_commandline_t[1024];
|
||||
|
||||
#endif /* __XEN_PUBLIC_VERSION_H__ */
|
||||
|
||||
/*
|
||||
|
||||