[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] XendDomain.py, xc.c, xc_linux_restore.c, xc.h:
ChangeSet 1.1511, 2005/05/23 11:24:56+01:00, cl349@xxxxxxxxxxxxxxxxxxxx XendDomain.py, xc.c, xc_linux_restore.c, xc.h: Move read of pfn to mfn frame list into xc_linux_restore. Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> libxc/xc.h | 3 +-- libxc/xc_linux_restore.c | 10 +++++++--- python/xen/lowlevel/xc/xc.c | 21 +++++---------------- python/xen/xend/XendDomain.py | 6 +----- 4 files changed, 14 insertions(+), 26 deletions(-) diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h --- a/tools/libxc/xc.h 2005-05-23 12:05:03 -04:00 +++ b/tools/libxc/xc.h 2005-05-23 12:05:03 -04:00 @@ -244,8 +244,7 @@ * @parm ioctxt the IO context to restore a domain from * @return 0 on success, -1 on failure */ -int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, - unsigned char *pfn2mfn); +int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns); int xc_linux_build(int xc_handle, u32 domid, diff -Nru a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c --- a/tools/libxc/xc_linux_restore.c 2005-05-23 12:05:03 -04:00 +++ b/tools/libxc/xc_linux_restore.c 2005-05-23 12:05:03 -04:00 @@ -32,8 +32,7 @@ #define PPRINTF(_f, _a...) #endif -int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, - unsigned char *pfn2mfn) +int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns) { dom0_op_t op; int rc = 1, i, n, k; @@ -60,7 +59,7 @@ unsigned long *ppage = NULL; /* A copy of the pfn-to-mfn table frame list. */ - unsigned long *pfn_to_mfn_frame_list = (void *)pfn2mfn; // [1024]; + unsigned long pfn_to_mfn_frame_list[1024]; /* A table mapping each PFN to its new MFN. */ unsigned long *pfn_to_mfn_table = NULL; @@ -89,6 +88,11 @@ but might as well do early */ ERR("Unable to mlock ctxt"); return 1; + } + + if (read(io_fd, pfn_to_mfn_frame_list, PAGE_SIZE) != PAGE_SIZE) { + ERR("read pfn_to_mfn_frame_list failed"); + goto out; } /* We want zeroed memory so use calloc rather than malloc. */ diff -Nru a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c 2005-05-23 12:05:03 -04:00 +++ b/tools/python/xen/lowlevel/xc/xc.c 2005-05-23 12:05:03 -04:00 @@ -343,24 +343,14 @@ int rc =-1; int io_fd, dom; unsigned long nr_pfns; - char *pfn2mfn; - int pfn2mfn_len; - PyObject *pfn2mfn_object; - - static char *kwd_list[] = { "fd", "dom", "pfns", "pfn2mfn", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iilO", kwd_list, - &io_fd, &dom, &nr_pfns, - &pfn2mfn_object) ) - goto exit; - if (PyString_AsStringAndSize(pfn2mfn_object, &pfn2mfn, &pfn2mfn_len)) - goto exit; + static char *kwd_list[] = { "fd", "dom", "pfns", NULL }; - if (pfn2mfn_len != PAGE_SIZE) - goto exit; + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iil", kwd_list, + &io_fd, &dom, &nr_pfns) ) + goto exit; - rc = xc_linux_restore(xc->xc_handle, io_fd, dom, nr_pfns, pfn2mfn); + rc = xc_linux_restore(xc->xc_handle, io_fd, dom, nr_pfns); if ( rc != 0 ) { PyErr_SetFromErrno(xc_error); @@ -1042,7 +1032,6 @@ "Restore the CPU and memory state of a Linux guest OS.\n" " dom [int]: Identifier of domain to be restored.\n" " pfns [int]: Number of pages domain uses.\n" - " pfn2mfn [str]: String containing the pfn to mfn frame list.\n\n" "Returns: [int] new domain identifier on success; -1 on error.\n" }, { "linux_build", diff -Nru a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py 2005-05-23 12:05:03 -04:00 +++ b/tools/python/xen/xend/XendDomain.py 2005-05-23 12:05:03 -04:00 @@ -363,15 +363,11 @@ raise XendError( "not a valid guest state file: pfn count out of range") - pfn_to_mfn_frame_list = fd.read_exact(PAGE_SIZE, - "not a valid guest state file: pfn_to_mfn_frame_list read") - # XXXcl hack: fd.tell will sync up the object and # underlying file descriptor ignore = fd.tell() - xc.linux_restore(fd.fileno(), int(dominfo.id), nr_pfns, - pfn_to_mfn_frame_list) + xc.linux_restore(fd.fileno(), int(dominfo.id), nr_pfns) return dominfo except IOError, ex: _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |