mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Change xs_read_watch interface to return a sized array (in userspace and in
kernel). Add index macros (XS_WATCH_*) for accessing the array to allow for future expansion. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
1 parent
86a5b732c1
commit
76bd51c23d
8 files changed
+101
-49
No files matched your search
@@ -462,19 +462,20 @@ static PyObject *xspy_read_watch(PyObject *self, PyObject *args,
|
||||
char **xsval = NULL;
|
||||
PyObject *token;
|
||||
int i;
|
||||
unsigned int num;
|
||||
|
||||
if (!xh)
|
||||
goto exit;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec))
|
||||
goto exit;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
xsval = xs_read_watch(xh);
|
||||
xsval = xs_read_watch(xh, &num);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (!xsval) {
|
||||
PyErr_SetFromErrno(PyExc_RuntimeError);
|
||||
goto exit;
|
||||
}
|
||||
if (sscanf(xsval[1], "%li", (unsigned long *)&token) != 1) {
|
||||
if (sscanf(xsval[XS_WATCH_TOKEN], "%li", (unsigned long *)&token) != 1) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "invalid token");
|
||||
goto exit;
|
||||
}
|
||||
@@ -487,7 +488,7 @@ static PyObject *xspy_read_watch(PyObject *self, PyObject *args,
|
||||
goto exit;
|
||||
}
|
||||
/* Create tuple (path, token). */
|
||||
val = Py_BuildValue("(sO)", xsval[0], token);
|
||||
val = Py_BuildValue("(sO)", xsval[XS_WATCH_PATH], token);
|
||||
exit:
|
||||
if (xsval)
|
||||
free(xsval);
|
||||
|
||||