# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID f8af7041bf5b4a6529225f2be225fbf2cce71f72
# Parent cca6641d40875d955654fc75506b49fe85e7f03f
[LIBXC] Convert all printf/fprintf uses to use a macro instead.
Thus all can be disabled at compile time. It would be easy to
make enabling/disabling a run-time option too.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
tools/libxc/xc_core.c | 4 +--
tools/libxc/xc_domain.c | 8 +++---
tools/libxc/xc_hvm_build.c | 4 +--
tools/libxc/xc_ia64_stubs.c | 2 -
tools/libxc/xc_linux_build.c | 38 +++++++++++++++---------------
tools/libxc/xc_linux_restore.c | 2 -
tools/libxc/xc_linux_save.c | 12 ++++-----
tools/libxc/xc_pagetab.c | 20 ++++++++--------
tools/libxc/xc_private.c | 10 ++++----
tools/libxc/xc_private.h | 51 ++++++++++++++++++++++++++++++-----------
tools/libxc/xc_ptrace.c | 18 +++++++-------
tools/libxc/xc_ptrace.h | 1
tools/libxc/xc_ptrace_core.c | 8 +++---
tools/libxc/xg_private.h | 18 --------------
tools/libxc/xg_save_restore.h | 22 -----------------
15 files changed, 102 insertions(+), 116 deletions(-)
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_core.c Wed Jun 07 14:07:36 2006 +0100
@@ -83,12 +83,12 @@ xc_domain_dumpcore_via_callback(int xc_h
if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
{
- printf("Could not allocate memory\n");
+ IPRINTF("Could not allocate memory\n");
goto error_out;
}
if ( xc_get_pfn_list(xc_handle, domid, page_array, nr_pages) != nr_pages )
{
- printf("Could not get the page frame list\n");
+ IPRINTF("Could not get the page frame list\n");
goto error_out;
}
sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(xen_pfn_t));
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_domain.c Wed Jun 07 14:07:36 2006 +0100
@@ -310,7 +310,7 @@ int xc_domain_memory_increase_reservatio
if ( err > 0 )
{
- fprintf(stderr, "Failed allocation for dom %d: "
+ DPRINTF("Failed allocation for dom %d: "
"%ld pages order %d addr_bits %d\n",
domid, nr_extents, extent_order, address_bits);
errno = ENOMEM;
@@ -338,7 +338,7 @@ int xc_domain_memory_decrease_reservatio
if ( extent_start == NULL )
{
- fprintf(stderr,"decrease_reservation extent_start is NULL!\n");
+ DPRINTF("decrease_reservation extent_start is NULL!\n");
errno = EINVAL;
return -1;
}
@@ -349,7 +349,7 @@ int xc_domain_memory_decrease_reservatio
if ( err > 0 )
{
- fprintf(stderr,"Failed deallocation for dom %d: %ld pages order %d\n",
+ DPRINTF("Failed deallocation for dom %d: %ld pages order %d\n",
domid, nr_extents, extent_order);
errno = EBUSY;
err = -1;
@@ -380,7 +380,7 @@ int xc_domain_memory_populate_physmap(in
if ( err > 0 )
{
- fprintf(stderr,"Failed deallocation for dom %d: %ld pages order %d\n",
+ DPRINTF("Failed deallocation for dom %d: %ld pages order %d\n",
domid, nr_extents, extent_order);
errno = EBUSY;
err = -1;
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_hvm_build.c Wed Jun 07 14:07:36 2006 +0100
@@ -207,12 +207,12 @@ static int setup_guest(int xc_handle,
/* memsize is in megabytes */
v_end = (unsigned long long)memsize << 20;
- printf("VIRTUAL MEMORY ARRANGEMENT:\n"
+ IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n"
" Loaded HVM loader: %08lx->%08lx\n"
" TOTAL: %08lx->%016llx\n",
dsi.v_kernstart, dsi.v_kernend,
dsi.v_start, v_end);
- printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
+ IPRINTF(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
if ( (v_end - dsi.v_start) > ((unsigned long long)nr_pages << PAGE_SHIFT) )
{
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_ia64_stubs.c
--- a/tools/libxc/xc_ia64_stubs.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_ia64_stubs.c Wed Jun 07 14:07:36 2006 +0100
@@ -655,7 +655,7 @@ static int setup_guest( int xc_handle,
vp_eport = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
if (vp_eport < 0) {
- fprintf(stderr, "Couldn't get unbound port from VMX guest.\n");
+ DPRINTF("Couldn't get unbound port from VMX guest.\n");
goto error_out;
}
sp->vcpu_iodata[i].vp_eport = vp_eport;
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_linux_build.c Wed Jun 07 14:07:36 2006 +0100
@@ -276,7 +276,7 @@ static int setup_pg_tables_pae(int xc_ha
nmfn = xc_make_page_below_4G(xc_handle, dom, page_array[ppt_alloc]);
if ( nmfn == 0 )
{
- fprintf(stderr, "Couldn't get a page below 4GB :-(\n");
+ DPRINTF("Couldn't get a page below 4GB :-(\n");
goto error_out;
}
page_array[ppt_alloc] = nmfn;
@@ -510,14 +510,14 @@ static int setup_guest(int xc_handle,
#define _p(a) ((void *) (a))
- printf("VIRTUAL MEMORY ARRANGEMENT:\n"
+ IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n"
" Loaded kernel: %p->%p\n"
" Init. ramdisk: %p->%p\n"
" TOTAL: %p->%p\n",
_p(dsi.v_kernstart), _p(dsi.v_kernend),
_p(vinitrd_start), _p(vinitrd_end),
_p(dsi.v_start), _p(v_end));
- printf(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
+ IPRINTF(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
(load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
&dsi);
@@ -541,7 +541,7 @@ static int setup_guest(int xc_handle,
*store_mfn = page_array[1];
*console_mfn = page_array[2];
- printf("start_info: 0x%lx at 0x%lx, "
+ IPRINTF("start_info: 0x%lx at 0x%lx, "
"store_mfn: 0x%lx at 0x%lx, "
"console_mfn: 0x%lx at 0x%lx\n",
page_array[0], nr_pages,
@@ -684,8 +684,8 @@ static int setup_guest(int xc_handle,
goto error_out;
}
- printf("Supported features = { %08x }.\n", supported_features[0]);
- printf("Required features = { %08x }.\n", required_features[0]);
+ IPRINTF("Supported features = { %08x }.\n", supported_features[0]);
+ IPRINTF("Required features = { %08x }.\n", required_features[0]);
}
for ( i = 0; i < XENFEAT_NR_SUBMAPS; i++ )
@@ -766,22 +766,22 @@ static int setup_guest(int xc_handle,
#define _p(a) ((void *) (a))
- printf("VIRTUAL MEMORY ARRANGEMENT:\n");
- printf(" Loaded kernel: %p->%p\n", _p(dsi.v_kernstart),
+ IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n");
+ IPRINTF(" Loaded kernel: %p->%p\n", _p(dsi.v_kernstart),
_p(dsi.v_kernend));
if ( initrd->len )
- printf(" Initial ramdisk: %p->%p\n", _p(vinitrd_start),
+ IPRINTF(" Initial ramdisk: %p->%p\n", _p(vinitrd_start),
_p(vinitrd_start + initrd->len));
- printf(" Phys-Mach map: %p\n", _p(vphysmap_start));
- printf(" Start info: %p\n", _p(vstartinfo_start));
- printf(" Store page: %p\n", _p(vstoreinfo_start));
- printf(" Console page: %p\n", _p(vconsole_start));
+ IPRINTF(" Phys-Mach map: %p\n", _p(vphysmap_start));
+ IPRINTF(" Start info: %p\n", _p(vstartinfo_start));
+ IPRINTF(" Store page: %p\n", _p(vstoreinfo_start));
+ IPRINTF(" Console page: %p\n", _p(vconsole_start));
if ( shadow_mode_enabled )
- printf(" Shared Info page: %p\n", _p(vsharedinfo_start));
- printf(" Page tables: %p\n", _p(vpt_start));
- printf(" Boot stack: %p\n", _p(vstack_start));
- printf(" TOTAL: %p->%p\n", _p(dsi.v_start), _p(v_end));
- printf(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
+ IPRINTF(" Shared Info page: %p\n", _p(vsharedinfo_start));
+ IPRINTF(" Page tables: %p\n", _p(vpt_start));
+ IPRINTF(" Boot stack: %p\n", _p(vstack_start));
+ IPRINTF(" TOTAL: %p->%p\n", _p(dsi.v_start), _p(v_end));
+ IPRINTF(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
if ( ((v_end - dsi.v_start)>>PAGE_SHIFT) > nr_pages )
{
@@ -883,7 +883,7 @@ static int setup_guest(int xc_handle,
((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
count) )
{
- fprintf(stderr,"m2p update failure p=%lx m=%"PRIx64"\n",
+ DPRINTF("m2p update failure p=%lx m=%"PRIx64"\n",
count, (uint64_t)page_array[count]);
munmap(physmap, PAGE_SIZE);
goto error_out;
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_linux_restore.c Wed Jun 07 14:07:36 2006 +0100
@@ -320,7 +320,7 @@ int xc_linux_restore(int xc_handle, int
if (j == -1) {
verify = 1;
- fprintf(stderr, "Entering page verify mode\n");
+ DPRINTF("Entering page verify mode\n");
continue;
}
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_linux_save.c Wed Jun 07 14:07:36 2006 +0100
@@ -288,7 +288,7 @@ static int print_stats(int xc_handle, ui
d1_cpu_now = xc_domain_get_cpu_usage(xc_handle, domid, /* FIXME */ 0)/1000;
if ( (d0_cpu_now == -1) || (d1_cpu_now == -1) )
- fprintf(stderr, "ARRHHH!!\n");
+ DPRINTF("ARRHHH!!\n");
wall_delta = tv_delta(&wall_now,&wall_last)/1000;
@@ -298,7 +298,7 @@ static int print_stats(int xc_handle, ui
d1_cpu_delta = (d1_cpu_now - d1_cpu_last)/1000;
if (print)
- fprintf(stderr,
+ DPRINTF(
"delta %lldms, dom0 %d%%, target %d%%, sent %dMb/s, "
"dirtied %dMb/s %" PRId32 " pages\n",
wall_delta,
@@ -339,14 +339,14 @@ static int analysis_phase(int xc_handle,
xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_CLEAN,
arr, max_pfn, NULL);
- fprintf(stderr, "#Flush\n");
+ DPRINTF("#Flush\n");
for ( i = 0; i < 40; i++ ) {
usleep(50000);
now = llgettimeofday();
xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_PEEK,
NULL, 0, &stats);
- fprintf(stderr, "now= %lld faults= %" PRId32 " dirty= %" PRId32
+ DPRINTF("now= %lld faults= %" PRId32 " dirty= %" PRId32
" dirty_net= %" PRId32 " dirty_block= %" PRId32"\n",
((now-start)+500)/1000,
stats.fault_count, stats.dirty_count,
@@ -961,7 +961,7 @@ int xc_linux_save(int xc_handle, int io_
}
if (debug)
- fprintf(stderr, "%d pfn= %08lx mfn= %08lx [mfn]= %08lx"
+ DPRINTF("%d pfn= %08lx mfn= %08lx [mfn]= %08lx"
" sum= %08lx\n",
iter,
(pfn_type[j] & LTAB_MASK) | pfn_batch[j],
@@ -1042,7 +1042,7 @@ int xc_linux_save(int xc_handle, int io_
int minusone = -1;
memset(to_send, 0xff, BITMAP_SIZE);
debug = 0;
- fprintf(stderr, "Entering debug resend-all mode\n");
+ DPRINTF("Entering debug resend-all mode\n");
/* send "-1" to put receiver into debug mode */
if(!write_exact(io_fd, &minusone, sizeof(int))) {
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_pagetab.c
--- a/tools/libxc/xc_pagetab.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_pagetab.c Wed Jun 07 14:07:36 2006 +0100
@@ -75,7 +75,7 @@ unsigned long xc_translate_foreign_addre
#endif
if (xc_vcpu_getcontext(xc_handle, dom, vcpu, &ctx) != 0) {
- fprintf(stderr, "failed to retreive vcpu context\n");
+ DPRINTF("failed to retreive vcpu context\n");
goto out;
}
cr3 = ((unsigned long long)xen_cr3_to_pfn(ctx.ctrlreg[3])) << PAGE_SHIFT;
@@ -87,12 +87,12 @@ unsigned long xc_translate_foreign_addre
#elif defined(__x86_64__)
pml = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ, cr3 >>
PAGE_SHIFT);
if (pml == NULL) {
- fprintf(stderr, "failed to map PML4\n");
+ DPRINTF("failed to map PML4\n");
goto out;
}
pmle = *(unsigned long long *)(pml + 8 * ((virt >> L4_PAGETABLE_SHIFT_PAE)
& L4_PAGETABLE_MASK_PAE));
if((pmle & 1) == 0) {
- fprintf(stderr, "page entry not present in PML4\n");
+ DPRINTF("page entry not present in PML4\n");
goto out_unmap_pml;
}
#endif
@@ -102,7 +102,7 @@ unsigned long xc_translate_foreign_addre
if (pt_levels >= 3) {
pdppage = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ,
pmle >> PAGE_SHIFT);
if (pdppage == NULL) {
- fprintf(stderr, "failed to map PDP\n");
+ DPRINTF("failed to map PDP\n");
goto out_unmap_pml;
}
if (pt_levels >= 4)
@@ -114,7 +114,7 @@ unsigned long xc_translate_foreign_addre
pdpe = *(unsigned long long *)(pdp + 8 * ((virt >>
L3_PAGETABLE_SHIFT_PAE) & L3_PAGETABLE_MASK_PAE));
if((pdpe & 1) == 0) {
- fprintf(stderr, "page entry not present in PDP\n");
+ DPRINTF("page entry not present in PDP\n");
goto out_unmap_pdp;
}
} else {
@@ -125,7 +125,7 @@ unsigned long xc_translate_foreign_addre
pd = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ, pdpe >>
PAGE_SHIFT);
if (pd == NULL) {
- fprintf(stderr, "failed to map PD\n");
+ DPRINTF("failed to map PD\n");
goto out_unmap_pdp;
}
@@ -135,21 +135,21 @@ unsigned long xc_translate_foreign_addre
pde = *(unsigned long long *)(pd + 4 * ((virt >> L2_PAGETABLE_SHIFT) &
L2_PAGETABLE_MASK));
if ((pde & 1) == 0) {
- fprintf(stderr, "page entry not present in PD\n");
+ DPRINTF("page entry not present in PD\n");
goto out_unmap_pd;
}
/* Page Table */
if (pde & 0x00000008) { /* 4M page (or 2M in PAE mode) */
- fprintf(stderr, "Cannot currently cope with 2/4M pages\n");
+ DPRINTF("Cannot currently cope with 2/4M pages\n");
exit(-1);
} else { /* 4k page */
pt = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ,
pde >> PAGE_SHIFT);
if (pt == NULL) {
- fprintf(stderr, "failed to map PT\n");
+ DPRINTF("failed to map PT\n");
goto out_unmap_pd;
}
@@ -159,7 +159,7 @@ unsigned long xc_translate_foreign_addre
pte = *(unsigned long long *)(pt + 4 * ((virt >>
L1_PAGETABLE_SHIFT) & L1_PAGETABLE_MASK));
if ((pte & 0x00000001) == 0) {
- fprintf(stderr, "page entry not present in PT\n");
+ DPRINTF("page entry not present in PT\n");
goto out_unmap_pt;
}
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_private.c Wed Jun 07 14:07:36 2006 +0100
@@ -294,10 +294,10 @@ int xc_get_pfn_list(int xc_handle,
if (ret >= 0) {
int i, j;
for (i = 0; i < op.u.getmemlist.num_pfns; i += 16) {
- fprintf(stderr, "0x%x: ", i);
+ DPRINTF("0x%x: ", i);
for (j = 0; j < 16; j++)
- fprintf(stderr, "0x%lx ", pfn_buf[i + j]);
- fprintf(stderr, "\n");
+ DPRINTF("0x%lx ", pfn_buf[i + j]);
+ DPRINTF("\n");
}
}
#endif
@@ -440,14 +440,14 @@ unsigned long xc_make_page_below_4G(
if ( xc_domain_memory_decrease_reservation(
xc_handle, domid, 1, 0, &old_mfn) != 0 )
{
- fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn);
+ DPRINTF("xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn);
return 0;
}
if ( xc_domain_memory_increase_reservation(
xc_handle, domid, 1, 0, 32, &new_mfn) != 0 )
{
- fprintf(stderr,"xc_make_page_below_4G increase failed. mfn=%lx\n",mfn);
+ DPRINTF("xc_make_page_below_4G increase failed. mfn=%lx\n",mfn);
return 0;
}
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_private.h Wed Jun 07 14:07:36 2006 +0100
@@ -28,25 +28,50 @@
#define DECLARE_DOM0_OP dom0_op_t op
#endif
-
#define PAGE_SHIFT XC_PAGE_SHIFT
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
-#define ERROR(_m, _a...) \
+#define DEBUG 1
+#define INFO 1
+#define PROGRESS 0
+
+#if INFO
+#define IPRINTF(_f, _a...) printf(_f , ## _a)
+#else
+#define IPRINTF(_f, _a...) ((void)0)
+#endif
+
+#if DEBUG
+#define DPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
+#else
+#define DPRINTF(_f, _a...) ((void)0)
+#endif
+
+#if PROGRESS
+#define PPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
+#else
+#define PPRINTF(_f, _a...)
+#endif
+
+#define ERR(_f, _a...) do { \
+ DPRINTF(_f ": %d\n" , ## _a, errno); \
+ fflush(stderr); } \
+while (0)
+
+#define ERROR(_m, _a...) \
+do { \
+ int __saved_errno = errno; \
+ DPRINTF("ERROR: " _m "\n" , ## _a ); \
+ errno = __saved_errno; \
+} while (0)
+
+#define PERROR(_m, _a...) \
do { \
int __saved_errno = errno; \
- fprintf(stderr, "ERROR: " _m "\n" , ## _a ); \
+ DPRINTF("ERROR: " _m " (%d = %s)\n" , ## _a , \
+ __saved_errno, strerror(__saved_errno)); \
errno = __saved_errno; \
-} while (0)
-
-
-#define PERROR(_m, _a...) \
-do { \
- int __saved_errno = errno; \
- fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \
- __saved_errno, strerror(__saved_errno)); \
- errno = __saved_errno; \
} while (0)
static inline void safe_munlock(const void *addr, size_t len)
@@ -88,7 +113,7 @@ static inline int do_dom0_op(int xc_hand
if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
{
if ( errno == EACCES )
- fprintf(stderr, "Dom0 operation failed -- need to"
+ DPRINTF("Dom0 operation failed -- need to"
" rebuild the user-space tool set?\n");
}
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_ptrace.c Wed Jun 07 14:07:36 2006 +0100
@@ -143,7 +143,7 @@ online_vcpus_changed(cpumap_t cpumap)
{
if (handlers.td_create) handlers.td_create(index - 1);
} else {
- printf("thread death: %d\n", index - 1);
+ IPRINTF("thread death: %d\n", index - 1);
if (handlers.td_death) handlers.td_death(index - 1);
}
changed_cpumap &= ~(1 << (index - 1));
@@ -368,13 +368,13 @@ map_domain_va(
nr_pages = npgs;
if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
{
- printf("Could not allocate memory\n");
+ IPRINTF("Could not allocate memory\n");
return NULL;
}
if ( xc_get_pfn_list(xc_handle, current_domid,
page_array, nr_pages) != nr_pages )
{
- printf("Could not get the page frame list\n");
+ IPRINTF("Could not get the page frame list\n");
return NULL;
}
}
@@ -433,7 +433,7 @@ __xc_waitdomain(
retval = do_dom0_op(xc_handle, &op);
if ( retval || (op.u.getdomaininfo.domain != domain) )
{
- printf("getdomaininfo failed\n");
+ IPRINTF("getdomaininfo failed\n");
goto done;
}
*status = op.u.getdomaininfo.flags;
@@ -454,7 +454,7 @@ __xc_waitdomain(
}
done:
if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
- printf("get_online_cpumap failed\n");
+ IPRINTF("get_online_cpumap failed\n");
if (online_cpumap != cpumap)
online_vcpus_changed(cpumap);
return retval;
@@ -595,7 +595,7 @@ xc_ptrace(
if ( retval || (op.u.getdomaininfo.domain != current_domid) )
goto out_error_dom0;
if ( op.u.getdomaininfo.flags & DOMFLAGS_PAUSED )
- printf("domain currently paused\n");
+ IPRINTF("domain currently paused\n");
else if ((retval = xc_domain_pause(xc_handle, current_domid)))
goto out_error_dom0;
op.cmd = DOM0_SETDEBUGGING;
@@ -605,7 +605,7 @@ xc_ptrace(
goto out_error_dom0;
if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
- printf("get_online_cpumap failed\n");
+ IPRINTF("get_online_cpumap failed\n");
if (online_cpumap != cpumap)
online_vcpus_changed(cpumap);
break;
@@ -619,7 +619,7 @@ xc_ptrace(
goto out_unsupported; /* XXX not yet supported */
case PTRACE_TRACEME:
- printf("PTRACE_TRACEME is an invalid request under Xen\n");
+ IPRINTF("PTRACE_TRACEME is an invalid request under Xen\n");
goto out_error;
}
@@ -633,7 +633,7 @@ xc_ptrace(
out_unsupported:
#ifdef DEBUG
- printf("unsupported xc_ptrace request %s\n", ptrace_names[request]);
+ IPRINTF("unsupported xc_ptrace request %s\n", ptrace_names[request]);
#endif
errno = ENOSYS;
return -1;
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_ptrace.h
--- a/tools/libxc/xc_ptrace.h Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_ptrace.h Wed Jun 07 14:07:36 2006 +0100
@@ -160,7 +160,6 @@ struct gdb_regs {
}
#endif
-#define printval(x) printf("%s = %lx\n", #x, (long)x);
#endif
typedef void (*thr_ev_handler_t)(long);
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xc_ptrace_core.c
--- a/tools/libxc/xc_ptrace_core.c Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xc_ptrace_core.c Wed Jun 07 14:07:36 2006 +0100
@@ -85,7 +85,7 @@ map_domain_va_core(unsigned long domfd,
map_mtop_offset(page_phys[cpu]));
if (v == MAP_FAILED)
{
- printf("cr3 %lx pde %lx page %lx pti %lx\n", cr3[cpu], pde, page,
l1_table_offset_i386(va));
+ IPRINTF("cr3 %lx pde %lx page %lx pti %lx\n", cr3[cpu], pde, page,
l1_table_offset_i386(va));
page_phys[cpu] = 0;
return NULL;
}
@@ -113,7 +113,7 @@ xc_waitdomain_core(
return -1;
if (header.xch_magic != XC_CORE_MAGIC) {
- printf("Magic number missmatch: 0x%08x (file) != "
+ IPRINTF("Magic number missmatch: 0x%08x (file) != "
" 0x%08x (code)\n", header.xch_magic,
XC_CORE_MAGIC);
return -1;
@@ -132,7 +132,7 @@ xc_waitdomain_core(
if ((p2m_array = malloc(nr_pages * sizeof(unsigned long))) == NULL)
{
- printf("Could not allocate p2m_array\n");
+ IPRINTF("Could not allocate p2m_array\n");
return -1;
}
@@ -142,7 +142,7 @@ xc_waitdomain_core(
if ((m2p_array = malloc((1<<20) * sizeof(unsigned long))) == NULL)
{
- printf("Could not allocate m2p array\n");
+ IPRINTF("Could not allocate m2p array\n");
return -1;
}
bzero(m2p_array, sizeof(unsigned long)* 1 << 20);
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xg_private.h Wed Jun 07 14:07:36 2006 +0100
@@ -12,6 +12,7 @@
#include "xenctrl.h"
#include "xenguest.h"
+#include "xc_private.h"
#include <xen/sys/privcmd.h>
#include <xen/memory.h>
@@ -129,23 +130,6 @@ typedef unsigned long l4_pgentry_t;
(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
#endif
-#define ERROR(_m, _a...) \
-do { \
- int __saved_errno = errno; \
- fprintf(stderr, "ERROR: " _m "\n" , ## _a ); \
- errno = __saved_errno; \
-} while (0)
-
-
-#define PERROR(_m, _a...) \
-do { \
- int __saved_errno = errno; \
- fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \
- __saved_errno, strerror(__saved_errno)); \
- errno = __saved_errno; \
-} while (0)
-
-
struct domain_setup_info
{
unsigned long v_start;
diff -r cca6641d4087 -r f8af7041bf5b tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h Wed Jun 07 13:42:21 2006 +0100
+++ b/tools/libxc/xg_save_restore.h Wed Jun 07 14:07:36 2006 +0100
@@ -5,28 +5,6 @@
*/
#include "xc_private.h"
-
-#define DEBUG 1
-#define PROGRESS 0
-
-#define ERR(_f, _a...) do { \
- fprintf(stderr, _f ": %d\n" , ## _a, errno);\
- fflush(stderr); } \
-while (0)
-
-#if DEBUG
-#define DPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
-#else
-#define DPRINTF(_f, _a...) ((void)0)
-#endif
-
-
-#if PROGRESS
-#define PPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
-#else
-#define PPRINTF(_f, _a...)
-#endif
-
/*
** We process save/restore/migrate in batches of pages; the below
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|