Mostly for historical reasons Xen includes Python bindings for libxc. They have been used by xm/xend in the past but nowadays there are only some few python bindings in use, most of the in out of tree tools. Remove all unused libxc python bindings.
Signed-off-by: Juergen Gross <jgr...@suse.com> --- tools/python/xen/lowlevel/xc/xc.c | 484 -------------------------------------- 1 file changed, 484 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 5039f94..5d79b14 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -146,148 +146,11 @@ static PyObject *pyxc_domain_getinfo(XcObject *self, return list; } -static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom, remote_dom; - int port; - - static char *kwd_list[] = { "domid", "remote_dom", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, - &dom, &remote_dom) ) - return NULL; - - if ( (port = xc_evtchn_alloc_unbound(self->xc_handle, dom, remote_dom)) < 0 ) - return pyxc_error_to_exception(self->xc_handle); - - return PyInt_FromLong(port); -} - -static PyObject *pyxc_evtchn_reset(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom; - - static char *kwd_list[] = { "dom", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) - return NULL; - - if ( xc_evtchn_reset(self->xc_handle, dom) < 0 ) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - -static PyObject *pyxc_physdev_map_pirq(PyObject *self, - PyObject *args, - PyObject *kwds) -{ - XcObject *xc = (XcObject *)self; - uint32_t dom; - int index, pirq, ret; - - static char *kwd_list[] = {"domid", "index", "pirq", NULL}; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list, - &dom, &index, &pirq) ) - return NULL; - ret = xc_physdev_map_pirq(xc->xc_handle, dom, index, &pirq); - if ( ret != 0 ) - return pyxc_error_to_exception(xc->xc_handle); - return PyLong_FromUnsignedLong(pirq); -} - -static PyObject *pyxc_physdev_pci_access_modify(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom; - int bus, dev, func, enable, ret; - - static char *kwd_list[] = { "domid", "bus", "dev", "func", "enable", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list, - &dom, &bus, &dev, &func, &enable) ) - return NULL; - - ret = xc_physdev_pci_access_modify( - self->xc_handle, dom, bus, dev, func, enable); - if ( ret != 0 ) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - -static PyObject *pyxc_readconsolering(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - unsigned int clear = 0, index = 0, incremental = 0; - unsigned int count = 16384 + 1, size = count; - char *str, *ptr; - PyObject *obj; - int ret; - - static char *kwd_list[] = { "clear", "index", "incremental", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iii", kwd_list, - &clear, &index, &incremental) || - !(str = malloc(size)) ) - return NULL; - - ret = xc_readconsolering(self->xc_handle, str, &count, clear, - incremental, &index); - if ( ret < 0 ) { - free(str); - return pyxc_error_to_exception(self->xc_handle); - } - - while ( !incremental && count == size && ret >= 0 ) - { - size += count - 1; - if ( size < count ) - break; - - ptr = realloc(str, size); - if ( !ptr ) - break; - - str = ptr + count; - count = size - count; - ret = xc_readconsolering(self->xc_handle, str, &count, clear, - 1, &index); - count += str - ptr; - str = ptr; - } - - obj = PyString_FromStringAndSize(str, count); - free(str); - return obj; -} - - static unsigned long pages_to_kib(unsigned long pages) { return pages * (XC_PAGE_SIZE / 1024); } - -static PyObject *pyxc_pages_to_kib(XcObject *self, PyObject *args) -{ - unsigned long pages; - - if (!PyArg_ParseTuple(args, "l", &pages)) - return NULL; - - return PyLong_FromUnsignedLong(pages_to_kib(pages)); -} - static PyObject *pyxc_physinfo(XcObject *self) { xc_physinfo_t pinfo; @@ -360,168 +223,6 @@ static PyObject *pyxc_getcpuinfo(XcObject *self, PyObject *args, PyObject *kwds) return cpuinfo_list_obj; } -static PyObject *pyxc_topologyinfo(XcObject *self) -{ - xc_cputopo_t *cputopo = NULL; - unsigned i, num_cpus = 0; - PyObject *ret_obj = NULL; - PyObject *cpu_to_core_obj, *cpu_to_socket_obj, *cpu_to_node_obj; - - if ( xc_cputopoinfo(self->xc_handle, &num_cpus, NULL) != 0 ) - goto out; - - cputopo = calloc(num_cpus, sizeof(*cputopo)); - if ( cputopo == NULL ) - goto out; - - if ( xc_cputopoinfo(self->xc_handle, &num_cpus, cputopo) != 0 ) - goto out; - - /* Construct cpu-to-* lists. */ - cpu_to_core_obj = PyList_New(0); - cpu_to_socket_obj = PyList_New(0); - cpu_to_node_obj = PyList_New(0); - for ( i = 0; i < num_cpus; i++ ) - { - if ( cputopo[i].core == XEN_INVALID_CORE_ID ) - { - PyList_Append(cpu_to_core_obj, Py_None); - } - else - { - PyObject *pyint = PyInt_FromLong(cputopo[i].core); - PyList_Append(cpu_to_core_obj, pyint); - Py_DECREF(pyint); - } - - if ( cputopo[i].socket == XEN_INVALID_SOCKET_ID ) - { - PyList_Append(cpu_to_socket_obj, Py_None); - } - else - { - PyObject *pyint = PyInt_FromLong(cputopo[i].socket); - PyList_Append(cpu_to_socket_obj, pyint); - Py_DECREF(pyint); - } - - if ( cputopo[i].node == XEN_INVALID_NODE_ID ) - { - PyList_Append(cpu_to_node_obj, Py_None); - } - else - { - PyObject *pyint = PyInt_FromLong(cputopo[i].node); - PyList_Append(cpu_to_node_obj, pyint); - Py_DECREF(pyint); - } - } - - ret_obj = Py_BuildValue("{s:i}", "max_cpu_index", num_cpus + 1); - - PyDict_SetItemString(ret_obj, "cpu_to_core", cpu_to_core_obj); - Py_DECREF(cpu_to_core_obj); - - PyDict_SetItemString(ret_obj, "cpu_to_socket", cpu_to_socket_obj); - Py_DECREF(cpu_to_socket_obj); - - PyDict_SetItemString(ret_obj, "cpu_to_node", cpu_to_node_obj); - Py_DECREF(cpu_to_node_obj); - -out: - free(cputopo); - return ret_obj ? ret_obj : pyxc_error_to_exception(self->xc_handle); -} - -static PyObject *pyxc_numainfo(XcObject *self) -{ - unsigned i, j, num_nodes = 0; - uint64_t free_heap; - PyObject *ret_obj = NULL, *node_to_node_dist_list_obj; - PyObject *node_to_memsize_obj, *node_to_memfree_obj; - PyObject *node_to_dma32_mem_obj, *node_to_node_dist_obj; - xc_meminfo_t *meminfo = NULL; - uint32_t *distance = NULL; - - if ( xc_numainfo(self->xc_handle, &num_nodes, NULL, NULL) != 0 ) - goto out; - - meminfo = calloc(num_nodes, sizeof(*meminfo)); - distance = calloc(num_nodes * num_nodes, sizeof(*distance)); - if ( (meminfo == NULL) || (distance == NULL) ) - goto out; - - if ( xc_numainfo(self->xc_handle, &num_nodes, meminfo, distance) != 0 ) - goto out; - - /* Construct node-to-* lists. */ - node_to_memsize_obj = PyList_New(0); - node_to_memfree_obj = PyList_New(0); - node_to_dma32_mem_obj = PyList_New(0); - node_to_node_dist_list_obj = PyList_New(0); - for ( i = 0; i < num_nodes; i++ ) - { - PyObject *pyint; - unsigned invalid_node; - - /* Total Memory */ - pyint = PyInt_FromLong(meminfo[i].memsize >> 20); /* MB */ - PyList_Append(node_to_memsize_obj, pyint); - Py_DECREF(pyint); - - /* Free Memory */ - pyint = PyInt_FromLong(meminfo[i].memfree >> 20); /* MB */ - PyList_Append(node_to_memfree_obj, pyint); - Py_DECREF(pyint); - - /* DMA memory. */ - xc_availheap(self->xc_handle, 0, 32, i, &free_heap); - pyint = PyInt_FromLong(free_heap >> 20); /* MB */ - PyList_Append(node_to_dma32_mem_obj, pyint); - Py_DECREF(pyint); - - /* Node to Node Distance */ - node_to_node_dist_obj = PyList_New(0); - invalid_node = (meminfo[i].memsize == XEN_INVALID_MEM_SZ); - for ( j = 0; j < num_nodes; j++ ) - { - uint32_t dist = distance[i * num_nodes + j]; - if ( invalid_node || (dist == XEN_INVALID_NODE_DIST) ) - { - PyList_Append(node_to_node_dist_obj, Py_None); - } - else - { - pyint = PyInt_FromLong(dist); - PyList_Append(node_to_node_dist_obj, pyint); - Py_DECREF(pyint); - } - } - PyList_Append(node_to_node_dist_list_obj, node_to_node_dist_obj); - Py_DECREF(node_to_node_dist_obj); - } - - ret_obj = Py_BuildValue("{s:i}", "max_node_index", num_nodes + 1); - - PyDict_SetItemString(ret_obj, "node_memsize", node_to_memsize_obj); - Py_DECREF(node_to_memsize_obj); - - PyDict_SetItemString(ret_obj, "node_memfree", node_to_memfree_obj); - Py_DECREF(node_to_memfree_obj); - - PyDict_SetItemString(ret_obj, "node_to_dma32_mem", node_to_dma32_mem_obj); - Py_DECREF(node_to_dma32_mem_obj); - - PyDict_SetItemString(ret_obj, "node_to_node_dist", - node_to_node_dist_list_obj); - Py_DECREF(node_to_node_dist_list_obj); - -out: - free(meminfo); - free(distance); - return ret_obj ? ret_obj : pyxc_error_to_exception(self->xc_handle); -} - static PyObject *pyxc_xeninfo(XcObject *self) { xen_extraversion_t xen_extra; @@ -608,53 +309,6 @@ static PyObject *pyxc_domain_set_target_mem(XcObject *self, PyObject *args) return zero; } -static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args) -{ - uint32_t dom; - int32_t offset; - - if (!PyArg_ParseTuple(args, "ii", &dom, &offset)) - return NULL; - - if (xc_domain_set_time_offset(self->xc_handle, dom, offset) != 0) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - -static PyObject *pyxc_domain_set_tsc_info(XcObject *self, PyObject *args) -{ - uint32_t dom, tsc_mode; - - if (!PyArg_ParseTuple(args, "ii", &dom, &tsc_mode)) - return NULL; - - if (xc_domain_set_tsc_info(self->xc_handle, dom, tsc_mode, 0, 0, 0) != 0) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - -static PyObject *pyxc_send_debug_keys(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - char *keys; - - static char *kwd_list[] = { "keys", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s", kwd_list, &keys) ) - return NULL; - - if ( xc_send_debug_keys(self->xc_handle, keys) != 0 ) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - static PyObject *pyxc_tmem_control(XcObject *self, PyObject *args, PyObject *kwds) @@ -701,43 +355,6 @@ static PyObject *pyxc_tmem_control(XcObject *self, return zero; } -static PyObject *pyxc_tmem_shared_auth(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t cli_id; - uint32_t arg1; - char *uuid_str; - int rc; - - static char *kwd_list[] = { "cli_id", "uuid_str", "arg1", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "isi", kwd_list, - &cli_id, &uuid_str, &arg1) ) - return NULL; - - if ( (rc = xc_tmem_auth(self->xc_handle, cli_id, uuid_str, arg1)) < 0 ) - return Py_BuildValue("i", rc); - - Py_INCREF(zero); - return zero; -} - -static PyObject *pyxc_dom_set_memshr(XcObject *self, PyObject *args) -{ - uint32_t dom; - int enable; - - if (!PyArg_ParseTuple(args, "ii", &dom, &enable)) - return NULL; - - if (xc_memshr_control(self->xc_handle, dom, enable) != 0) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - static PyMethodDef pyxc_methods[] = { { "domain_getinfo", (PyCFunction)pyxc_domain_getinfo, @@ -765,47 +382,6 @@ static PyMethodDef pyxc_methods[] = { "reason why it shut itself down.\n" " cpupool [int] Id of cpupool domain is bound to.\n" }, - { "evtchn_alloc_unbound", - (PyCFunction)pyxc_evtchn_alloc_unbound, - METH_VARARGS | METH_KEYWORDS, "\n" - "Allocate an unbound port that will await a remote connection.\n" - " dom [int]: Domain whose port space to allocate from.\n" - " remote_dom [int]: Remote domain to accept connections from.\n\n" - "Returns: [int] Unbound event-channel port.\n" }, - - { "evtchn_reset", - (PyCFunction)pyxc_evtchn_reset, - METH_VARARGS | METH_KEYWORDS, "\n" - "Reset all connections.\n" - " dom [int]: Domain to reset.\n" }, - - { "physdev_map_pirq", - (PyCFunction)pyxc_physdev_map_pirq, - METH_VARARGS | METH_KEYWORDS, "\n" - "map physical irq to guest pirq.\n" - " dom [int]: Identifier of domain to map for.\n" - " index [int]: physical irq.\n" - " pirq [int]: guest pirq.\n" - "Returns: [long] value of the param.\n" }, - - { "physdev_pci_access_modify", - (PyCFunction)pyxc_physdev_pci_access_modify, - METH_VARARGS | METH_KEYWORDS, "\n" - "Allow a domain access to a PCI device\n" - " dom [int]: Identifier of domain to be allowed access.\n" - " bus [int]: PCI bus\n" - " dev [int]: PCI slot\n" - " func [int]: PCI function\n" - " enable [int]: Non-zero means enable access; else disable access\n\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - - { "readconsolering", - (PyCFunction)pyxc_readconsolering, - METH_VARARGS | METH_KEYWORDS, "\n" - "Read Xen's console ring.\n" - " clear [int, 0]: Bool - clear the ring after reading from it?\n\n" - "Returns: [str] string is empty on failure.\n" }, - { "physinfo", (PyCFunction)pyxc_physinfo, METH_NOARGS, "\n" @@ -820,20 +396,6 @@ static PyMethodDef pyxc_methods[] = { "Returns [list]: information about physical CPUs" " [None]: on failure.\n" }, - { "topologyinfo", - (PyCFunction)pyxc_topologyinfo, - METH_NOARGS, "\n" - "Get information about the cpu topology on the host machine\n" - "Returns [dict]: information about the cpu topology on host" - " [None]: on failure.\n" }, - - { "numainfo", - (PyCFunction)pyxc_numainfo, - METH_NOARGS, "\n" - "Get NUMA information on the host machine\n" - "Returns [dict]: NUMA information on host" - " [None]: on failure.\n" }, - { "xeninfo", (PyCFunction)pyxc_xeninfo, METH_NOARGS, "\n" @@ -857,35 +419,6 @@ static PyMethodDef pyxc_methods[] = { " mem_kb [int]: .\n" "Returns: [int] 0 on success; -1 on error.\n" }, - { "pages_to_kib", - (PyCFunction)pyxc_pages_to_kib, - METH_VARARGS, "\n" - "Returns: [int]: The size in KiB of memory spanning the given number " - "of pages.\n" }, - - { "domain_set_time_offset", - (PyCFunction)pyxc_domain_set_time_offset, - METH_VARARGS, "\n" - "Set a domain's time offset to Dom0's localtime\n" - " dom [int]: Domain whose time offset is being set.\n" - " offset [int]: Time offset from UTC in seconds.\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - - { "domain_set_tsc_info", - (PyCFunction)pyxc_domain_set_tsc_info, - METH_VARARGS, "\n" - "Set a domain's TSC mode\n" - " dom [int]: Domain whose TSC mode is being set.\n" - " tsc_mode [int]: 0=default (monotonic, but native where possible)\n" - " 1=always emulate 2=never emulate 3=pvrdtscp\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - - { "send_debug_keys", - (PyCFunction)pyxc_send_debug_keys, - METH_VARARGS | METH_KEYWORDS, "\n" - "Inject debug keys into Xen.\n" - " keys [str]: String of keys to inject.\n" }, - { "tmem_control", (PyCFunction)pyxc_tmem_control, METH_VARARGS | METH_KEYWORDS, "\n" @@ -898,23 +431,6 @@ static PyMethodDef pyxc_methods[] = { " buf [str]: Buffer.\n\n" "Returns: [int] 0 or [str] tmem info on success; exception on error.\n" }, - { "tmem_shared_auth", - (PyCFunction)pyxc_tmem_shared_auth, - METH_VARARGS | METH_KEYWORDS, "\n" - "De/authenticate a shared tmem pool.\n" - " cli_id [int]: Client identifier (-1 == all).\n" - " uuid_str [str]: uuid.\n" - " auth [int]: 0|1 .\n" - "Returns: [int] 0 on success; exception on error.\n" }, - - { "dom_set_memshr", - (PyCFunction)pyxc_dom_set_memshr, - METH_VARARGS, "\n" - "Enable/disable memory sharing for the domain.\n" - " dom [int]: Domain identifier.\n" - " enable [int,0|1]: Disable or enable?\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - { NULL, NULL, 0, NULL } }; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel