ia64/xen-unstable
changeset 5089:b04f8c2a95d6
bitkeeper revision 1.1511 (4291af78wDb78xhg10ccUaCX1vnh_w)
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@cl.cam.ac.uk>
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@cl.cam.ac.uk>
author | cl349@firebug.cl.cam.ac.uk |
---|---|
date | Mon May 23 10:24:56 2005 +0000 (2005-05-23) |
parents | 9e133359e477 |
children | eb32745a29e8 220fa69a6777 |
files | tools/libxc/xc.h tools/libxc/xc_linux_restore.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendDomain.py |
line diff
1.1 --- a/tools/libxc/xc.h Mon May 23 10:17:35 2005 +0000 1.2 +++ b/tools/libxc/xc.h Mon May 23 10:24:56 2005 +0000 1.3 @@ -244,8 +244,7 @@ int xc_linux_save(int xc_handle, struct 1.4 * @parm ioctxt the IO context to restore a domain from 1.5 * @return 0 on success, -1 on failure 1.6 */ 1.7 -int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, 1.8 - unsigned char *pfn2mfn); 1.9 +int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns); 1.10 1.11 int xc_linux_build(int xc_handle, 1.12 u32 domid,
2.1 --- a/tools/libxc/xc_linux_restore.c Mon May 23 10:17:35 2005 +0000 2.2 +++ b/tools/libxc/xc_linux_restore.c Mon May 23 10:24:56 2005 +0000 2.3 @@ -32,8 +32,7 @@ 2.4 #define PPRINTF(_f, _a...) 2.5 #endif 2.6 2.7 -int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, 2.8 - unsigned char *pfn2mfn) 2.9 +int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns) 2.10 { 2.11 dom0_op_t op; 2.12 int rc = 1, i, n, k; 2.13 @@ -60,7 +59,7 @@ int xc_linux_restore(int xc_handle, int 2.14 unsigned long *ppage = NULL; 2.15 2.16 /* A copy of the pfn-to-mfn table frame list. */ 2.17 - unsigned long *pfn_to_mfn_frame_list = (void *)pfn2mfn; // [1024]; 2.18 + unsigned long pfn_to_mfn_frame_list[1024]; 2.19 2.20 /* A table mapping each PFN to its new MFN. */ 2.21 unsigned long *pfn_to_mfn_table = NULL; 2.22 @@ -91,6 +90,11 @@ int xc_linux_restore(int xc_handle, int 2.23 return 1; 2.24 } 2.25 2.26 + if (read(io_fd, pfn_to_mfn_frame_list, PAGE_SIZE) != PAGE_SIZE) { 2.27 + ERR("read pfn_to_mfn_frame_list failed"); 2.28 + goto out; 2.29 + } 2.30 + 2.31 /* We want zeroed memory so use calloc rather than malloc. */ 2.32 pfn_to_mfn_table = calloc(4, nr_pfns); 2.33 pfn_type = calloc(4, nr_pfns);
3.1 --- a/tools/python/xen/lowlevel/xc/xc.c Mon May 23 10:17:35 2005 +0000 3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c Mon May 23 10:24:56 2005 +0000 3.3 @@ -343,24 +343,14 @@ static PyObject *pyxc_linux_restore(PyOb 3.4 int rc =-1; 3.5 int io_fd, dom; 3.6 unsigned long nr_pfns; 3.7 - char *pfn2mfn; 3.8 - int pfn2mfn_len; 3.9 - PyObject *pfn2mfn_object; 3.10 + 3.11 + static char *kwd_list[] = { "fd", "dom", "pfns", NULL }; 3.12 3.13 - static char *kwd_list[] = { "fd", "dom", "pfns", "pfn2mfn", NULL }; 3.14 - 3.15 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iilO", kwd_list, 3.16 - &io_fd, &dom, &nr_pfns, 3.17 - &pfn2mfn_object) ) 3.18 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iil", kwd_list, 3.19 + &io_fd, &dom, &nr_pfns) ) 3.20 goto exit; 3.21 3.22 - if (PyString_AsStringAndSize(pfn2mfn_object, &pfn2mfn, &pfn2mfn_len)) 3.23 - goto exit; 3.24 - 3.25 - if (pfn2mfn_len != PAGE_SIZE) 3.26 - goto exit; 3.27 - 3.28 - rc = xc_linux_restore(xc->xc_handle, io_fd, dom, nr_pfns, pfn2mfn); 3.29 + rc = xc_linux_restore(xc->xc_handle, io_fd, dom, nr_pfns); 3.30 if ( rc != 0 ) 3.31 { 3.32 PyErr_SetFromErrno(xc_error); 3.33 @@ -1042,7 +1032,6 @@ static PyMethodDef pyxc_methods[] = { 3.34 "Restore the CPU and memory state of a Linux guest OS.\n" 3.35 " dom [int]: Identifier of domain to be restored.\n" 3.36 " pfns [int]: Number of pages domain uses.\n" 3.37 - " pfn2mfn [str]: String containing the pfn to mfn frame list.\n\n" 3.38 "Returns: [int] new domain identifier on success; -1 on error.\n" }, 3.39 3.40 { "linux_build",
4.1 --- a/tools/python/xen/xend/XendDomain.py Mon May 23 10:17:35 2005 +0000 4.2 +++ b/tools/python/xen/xend/XendDomain.py Mon May 23 10:24:56 2005 +0000 4.3 @@ -363,15 +363,11 @@ class XendDomain: 4.4 raise XendError( 4.5 "not a valid guest state file: pfn count out of range") 4.6 4.7 - pfn_to_mfn_frame_list = fd.read_exact(PAGE_SIZE, 4.8 - "not a valid guest state file: pfn_to_mfn_frame_list read") 4.9 - 4.10 # XXXcl hack: fd.tell will sync up the object and 4.11 # underlying file descriptor 4.12 ignore = fd.tell() 4.13 4.14 - xc.linux_restore(fd.fileno(), int(dominfo.id), nr_pfns, 4.15 - pfn_to_mfn_frame_list) 4.16 + xc.linux_restore(fd.fileno(), int(dominfo.id), nr_pfns) 4.17 return dominfo 4.18 4.19 except IOError, ex: