ChangeSet 1.1386, 2005/04/26 15:30:28+01:00, smh22@xxxxxxxxxxxxxxxxxxxx
build when DEBUG=1 + whitespace fixes
xc_linux_restore.c | 11 ++++---
xc_linux_save.c | 79 +++++++++++++++++++++++++++++++++--------------------
2 files changed, 56 insertions(+), 34 deletions(-)
diff -Nru a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c 2005-04-27 07:02:28 -04:00
+++ b/tools/libxc/xc_linux_restore.c 2005-04-27 07:02:28 -04:00
@@ -170,13 +170,13 @@
if ( xc_domain_create(xc_handle, nr_pfns * (PAGE_SIZE / 1024),
-1, 1, &dom) )
{
- xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB",
- nr_pfns,nr_pfns * (PAGE_SIZE / 1024));
+ xcio_error(ioctxt, "Could not create domain. pfns=%ld, %ldKB",
+ nr_pfns, nr_pfns * (PAGE_SIZE / 1024));
goto out;
}
ioctxt->domain = dom;
- xcio_info(ioctxt, "Created domain %ld\n",dom);
+ xcio_info(ioctxt, "Created domain %u\n", dom);
/* Get the domain's shared-info frame. */
op.cmd = DOM0_GETDOMAININFO;
@@ -200,7 +200,8 @@
}
/* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
- if ( xc_get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns
)
+ if ( xc_get_pfn_list(xc_handle, dom,
+ pfn_to_mfn_table, nr_pfns) != nr_pfns )
{
xcio_error(ioctxt, "Did not read correct number of frame "
"numbers for new dom");
@@ -657,7 +658,7 @@
if ( rc == 0 )
{
/* Success: print the domain id. */
- xcio_info(ioctxt, "DOM=%lu\n", dom);
+ xcio_info(ioctxt, "DOM=%u\n", dom);
return 0;
}
diff -Nru a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c 2005-04-27 07:02:28 -04:00
+++ b/tools/libxc/xc_linux_save.c 2005-04-27 07:02:28 -04:00
@@ -167,7 +167,8 @@
#define RATE_TO_BTU 781250
#define BURST_TIME_US burst_time_us
-static int xcio_ratewrite(XcIOContext *ioctxt, void *buf, int n){
+static int xcio_ratewrite(XcIOContext *ioctxt, void *buf, int n)
+{
static int budget = 0;
static struct timeval last_put = { 0 };
struct timeval now;
@@ -230,8 +231,8 @@
gettimeofday(&wall_now, NULL);
- d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0, /* FIXME */ 0 )/1000;
- d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid, /* FIXME */ 0
)/1000;
+ d0_cpu_now = xc_domain_get_cpu_usage(xc_handle, 0, /* FIXME */ 0)/1000;
+ d1_cpu_now = xc_domain_get_cpu_usage(xc_handle, domid, /* FIXME */ 0)/1000;
if ( (d0_cpu_now == -1) || (d1_cpu_now == -1) )
printf("ARRHHH!!\n");
@@ -273,10 +274,13 @@
* @param ioctxt i/o context
* @return 0 on success, non-zero on error.
*/
-static int write_vmconfig(XcIOContext *ioctxt){
+static int write_vmconfig(XcIOContext *ioctxt)
+{
int err = -1;
- if(xcio_write(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n)))
goto exit;
- if(xcio_write(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n)) goto exit;
+ if(xcio_write(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n)))
+ goto exit;
+ if(xcio_write(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n))
+ goto exit;
err = 0;
exit:
return err;
@@ -329,7 +333,8 @@
retry:
- if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, info,
ctxt) )
+ if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0,
+ info, ctxt) )
{
xcio_error(ioctxt, "Could not get full domain info");
return -1;
@@ -347,7 +352,7 @@
// try unpausing domain, wait, and retest
xc_domain_unpause( xc_handle, ioctxt->domain );
- xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%lx)",
+ xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%u)",
info->flags);
usleep(10000); // 10ms
@@ -357,14 +362,12 @@
if( ++i < 100 )
{
- xcio_error(ioctxt, "Retry suspend domain (%lx)",
- info->flags);
+ xcio_error(ioctxt, "Retry suspend domain (%u)", info->flags);
usleep(10000); // 10ms
goto retry;
}
- xcio_error(ioctxt, "Unable to suspend domain. (%lx)",
- info->flags);
+ xcio_error(ioctxt, "Unable to suspend domain. (%u)", info->flags);
return -1;
}
@@ -442,7 +445,8 @@
return 1;
}
- if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, &info, &ctxt)
)
+ if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0,
+ &info, &ctxt) )
{
xcio_error(ioctxt, "Could not get full domain info");
goto out;
@@ -459,7 +463,9 @@
/* cheesy sanity check */
if ( nr_pfns > 1024*1024 ){
- xcio_error(ioctxt, "Invalid state record -- pfn count out of range:
%lu", nr_pfns);
+ xcio_error(ioctxt,
+ "Invalid state record -- pfn count out of range: %lu",
+ nr_pfns);
goto out;
}
@@ -513,7 +519,8 @@
for ( i = 0; i < nr_pfns; i += 1024 ){
if ( !translate_mfn_to_pfn(&pfn_to_mfn_frame_list[i/1024]) ){
- xcio_error(ioctxt, "Frame # in pfn-to-mfn frame list is not in
pseudophys");
+ xcio_error(ioctxt,
+ "Frame# in pfn-to-mfn frame list is not in pseudophys");
goto out;
}
}
@@ -539,7 +546,7 @@
if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
{
- xcio_error(ioctxt, "Domain appears not to have suspended: %lx",
+ xcio_error(ioctxt, "Domain appears not to have suspended: %u",
info.flags);
goto out;
}
@@ -836,7 +843,8 @@
} /* end of page table rewrite for loop */
if ( xcio_ratewrite(ioctxt, page, PAGE_SIZE) ){
- xcio_error(ioctxt, "Error when writing to state file
(4)");
+ xcio_error(ioctxt,
+ "Error when writing to state file (4)");
goto out;
}
@@ -844,7 +852,8 @@
if ( xcio_ratewrite(ioctxt, region_base + (PAGE_SIZE*j),
PAGE_SIZE) ){
- xcio_error(ioctxt, "Error when writing to state file
(5)");
+ xcio_error(ioctxt,
+ "Error when writing to state file (5)");
goto out;
}
}
@@ -903,14 +912,15 @@
if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
{
- xcio_error(ioctxt, "Domain appears not to have suspended:
%lx",
+ xcio_error(ioctxt,
+ "Domain appears not to have suspended: %u",
info.flags);
goto out;
}
xcio_info(ioctxt,
- "SUSPEND flags %08lx shinfo %08lx eip %08lx "
- "esi %08lx\n",info.flags,
+ "SUSPEND flags %08u shinfo %08lx eip %08u "
+ "esi %08u\n",info.flags,
info.shared_info_frame,
ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
}
@@ -972,7 +982,8 @@
{
if ( xcio_write(ioctxt, &pfntab, sizeof(unsigned long)*j) )
{
- xcio_error(ioctxt, "Error when writing to state file (6b)");
+ xcio_error(ioctxt,
+ "Error when writing to state file (6b)");
goto out;
}
j = 0;
@@ -1027,14 +1038,24 @@
out:
- if ( live_shinfo ) munmap(live_shinfo, PAGE_SIZE);
- if ( p_srec ) munmap(p_srec, sizeof(*p_srec));
- if ( live_pfn_to_mfn_frame_list ) munmap(live_pfn_to_mfn_frame_list,
PAGE_SIZE);
- if ( live_pfn_to_mfn_table ) munmap(live_pfn_to_mfn_table, nr_pfns*4 );
- if ( live_mfn_to_pfn_table ) munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024
);
+ if(live_shinfo)
+ munmap(live_shinfo, PAGE_SIZE);
+
+ if(p_srec)
+ munmap(p_srec, sizeof(*p_srec));
+
+ if(live_pfn_to_mfn_frame_list)
+ munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE);
+
+ if(live_pfn_to_mfn_table)
+ munmap(live_pfn_to_mfn_table, nr_pfns*4);
+
+ if(live_mfn_to_pfn_table)
+ munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024);
+
+ if (pfn_type != NULL)
+ free(pfn_type);
- if ( pfn_type != NULL ) free(pfn_type);
DPRINTF("Save exit rc=%d\n",rc);
return !!rc;
-
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|