ia64/xen-unstable

changeset 7638:b67d2d2465aa

Added domain_ioport_permission to the python module xen.lowlevel.xc,
wrapping the equivalent libxc call

Signed-off-by: Jody Belka <knew (at) pimb (dot) org>
author kaf24@firebug.cl.cam.ac.uk
date Sun Nov 06 16:40:15 2005 +0100 (2005-11-06)
parents 15dc55145e55
children c352591ebfdf
files tools/python/xen/lowlevel/xc/xc.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Sun Nov 06 16:39:55 2005 +0100
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Sun Nov 06 16:40:15 2005 +0100
     1.3 @@ -858,6 +858,29 @@ static PyObject *pyxc_domain_memory_incr
     1.4      return zero;
     1.5  }
     1.6  
     1.7 +static PyObject *pyxc_domain_ioport_permission(PyObject *self,
     1.8 +                                               PyObject *args,
     1.9 +                                               PyObject *kwds)
    1.10 +{
    1.11 +    XcObject *xc = (XcObject *)self;
    1.12 +    uint32_t dom;
    1.13 +    int first_port, nr_ports, allow_access, ret;
    1.14 +
    1.15 +    static char *kwd_list[] = { "dom", "first_port", "nr_ports", "allow_access", NULL };
    1.16 +
    1.17 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list, 
    1.18 +                                      &dom, &first_port, &nr_ports, &allow_access) )
    1.19 +        return NULL;
    1.20 +
    1.21 +    ret = xc_domain_ioport_permission(
    1.22 +        xc->xc_handle, dom, first_port, nr_ports, allow_access);
    1.23 +    if ( ret != 0 )
    1.24 +        return PyErr_SetFromErrno(xc_error);
    1.25 +
    1.26 +    Py_INCREF(zero);
    1.27 +    return zero;
    1.28 +}
    1.29 +
    1.30  static PyMethodDef pyxc_methods[] = {
    1.31      { "handle",
    1.32        (PyCFunction)pyxc_handle,
    1.33 @@ -1127,6 +1150,16 @@ static PyMethodDef pyxc_methods[] = {
    1.34        " mem_kb [long]: .\n"
    1.35        "Returns: [int] 0 on success; -1 on error.\n" },
    1.36  
    1.37 +    { "domain_ioport_permission",
    1.38 +      (PyCFunction)pyxc_domain_ioport_permission,
    1.39 +      METH_VARARGS | METH_KEYWORDS, "\n"
    1.40 +      "Allow a domain access to a range of IO ports\n"
    1.41 +      " dom          [int]: Identifier of domain to be allowed access.\n"
    1.42 +      " first_port   [int]: First IO port\n"
    1.43 +      " nr_ports     [int]: Number of IO ports\n"
    1.44 +      " allow_access [int]: Non-zero means enable access; else disable access\n\n"
    1.45 +      "Returns: [int] 0 on success; -1 on error.\n" },
    1.46 +
    1.47      { NULL, NULL, 0, NULL }
    1.48  };
    1.49