libxc: remove most of tools/libxc/xc_dom_compat_linux.c

In tools/libxc/xc_dom_compat_linux.c xc_linux_build() is the only
domain building function used by an in-tree component (qemu-xen) which
is really necessary.

Remove the other domain building functions and the unused python
wrapper xc.linux_build() referencing one of the to be removed
functions.

Suggested-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Juergen Gross authored and Ian Campbell committed 2015-11-16 11:21:13 +00:00
1 parent f046e501bb
commit 512d4d9605
5 files changed
+39 -260

No files matched your search

-98
View File
@@ -7,7 +7,6 @@
#include <Python.h>
#include <xenctrl.h>
#include <xenguest.h>
#include <zlib.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -17,8 +16,6 @@
#include <netdb.h>
#include <arpa/inet.h>
#include "xenctrl.h"
#include <xen/elfnote.h>
#include <xen/tmem.h>
#include "xc_dom.h"
#include <xen/hvm/hvm_info_table.h>
@@ -454,90 +451,6 @@ static PyObject *pyxc_getBitSize(XcObject *self,
return info_type;
}
static PyObject *pyxc_linux_build(XcObject *self,
PyObject *args,
PyObject *kwds)
{
uint32_t domid;
struct xc_dom_image *dom;
char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
int flags = 0;
int store_evtchn, console_evtchn;
unsigned int mem_mb;
unsigned long store_mfn = 0;
unsigned long console_mfn = 0;
PyObject* elfnote_dict;
PyObject* elfnote = NULL;
PyObject* ret;
int i;
static char *kwd_list[] = { "domid", "store_evtchn", "memsize",
"console_evtchn", "image",
/* optional */
"ramdisk", "cmdline", "flags",
"features", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssis", kwd_list,
&domid, &store_evtchn, &mem_mb,
&console_evtchn, &image,
/* optional */
&ramdisk, &cmdline, &flags, &features) )
return NULL;
xc_dom_loginit(self->xc_handle);
if (!(dom = xc_dom_allocate(self->xc_handle, cmdline, features)))
return pyxc_error_to_exception(self->xc_handle);
if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image,
ramdisk, flags, store_evtchn, &store_mfn,
console_evtchn, &console_mfn) != 0 ) {
goto out;
}
if ( !(elfnote_dict = PyDict_New()) )
goto out;
for ( i = 0; i < ARRAY_SIZE(dom->parms.elf_notes); i++ )
{
switch ( dom->parms.elf_notes[i].type )
{
case XEN_ENT_NONE:
continue;
case XEN_ENT_LONG:
elfnote = Py_BuildValue("k", dom->parms.elf_notes[i].data.num);
break;
case XEN_ENT_STR:
elfnote = Py_BuildValue("s", dom->parms.elf_notes[i].data.str);
break;
}
PyDict_SetItemString(elfnote_dict,
dom->parms.elf_notes[i].name,
elfnote);
Py_DECREF(elfnote);
}
ret = Py_BuildValue("{s:i,s:i,s:N}",
"store_mfn", store_mfn,
"console_mfn", console_mfn,
"notes", elfnote_dict);
if ( dom->arch_hooks->native_protocol )
{
PyObject *native_protocol =
Py_BuildValue("s", dom->arch_hooks->native_protocol);
PyDict_SetItemString(ret, "native_protocol", native_protocol);
Py_DECREF(native_protocol);
}
xc_dom_release(dom);
return ret;
out:
xc_dom_release(dom);
return pyxc_error_to_exception(self->xc_handle);
}
static PyObject *pyxc_hvm_param_get(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -2269,17 +2182,6 @@ static PyMethodDef pyxc_methods[] = {
" cpumap [int]: Bitmap of CPUs this VCPU can run on\n"
" cpu [int]: CPU that this VCPU is currently bound to\n" },
{ "linux_build",
(PyCFunction)pyxc_linux_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new Linux guest OS.\n"
" dom [int]: Identifier of domain to build into.\n"
" image [str]: Name of kernel image file. May be gzipped.\n"
" ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
" vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{"getBitSize",
(PyCFunction)pyxc_getBitSize,
METH_VARARGS | METH_KEYWORDS, "\n"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.