|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] python: Add XC binding for Xen build ID
commit bbf230b2a1ae0e56f9d70fb2ca71ed08e97d49b4
Author: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
AuthorDate: Tue Aug 20 12:51:08 2019 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 20 14:24:05 2019 +0100
python: Add XC binding for Xen build ID
Extend the list of xc() object methods with additional one to display
Xen's buildid. The implementation follows the libxl implementation
(e.g. max buildid size assumption being XC_PAGE_SIZE minus
sizeof(buildid->len)).
Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
Reviewed-by: Martin Mazein <amazein@xxxxxxxxx>
Reviewed-by: Andra-Irina Paraschiv <andraprs@xxxxxxxxxx>
Reviewed-by: Norbert Manthey <nmanthey@xxxxxxxxx>
Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
tools/python/xen/lowlevel/xc/xc.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tools/python/xen/lowlevel/xc/xc.c
b/tools/python/xen/lowlevel/xc/xc.c
index 188bfa34da..7f0358ba9c 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1214,6 +1214,26 @@ out:
return ret_obj ? ret_obj : pyxc_error_to_exception(self->xc_handle);
}
+static PyObject *pyxc_xenbuildid(XcObject *self)
+{
+ xen_build_id_t *buildid;
+ int i, r;
+ char *str;
+
+ buildid = alloca(XC_PAGE_SIZE);
+ buildid->len = XC_PAGE_SIZE - sizeof(*buildid);
+
+ r = xc_version(self->xc_handle, XENVER_build_id, buildid);
+ if ( r <= 0 )
+ return pyxc_error_to_exception(self->xc_handle);
+
+ str = alloca((r * 2) + 1);
+ for ( i = 0; i < r; i++ )
+ snprintf(&str[i * 2], 3, "%02hhx", buildid->buf[i]);
+
+ return Py_BuildValue("s", str);
+}
+
static PyObject *pyxc_xeninfo(XcObject *self)
{
xen_extraversion_t xen_extra;
@@ -2297,6 +2317,13 @@ static PyMethodDef pyxc_methods[] = {
"Returns [dict]: information about Xen"
" [None]: on failure.\n" },
+ { "buildid",
+ (PyCFunction)pyxc_xenbuildid,
+ METH_NOARGS, "\n"
+ "Get Xen buildid\n"
+ "Returns [str]: Xen buildid"
+ " [None]: on failure.\n" },
+
{ "shadow_control",
(PyCFunction)pyxc_shadow_control,
METH_VARARGS | METH_KEYWORDS, "\n"
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |