Skip to contentSkip to conversation

Simple patch to quiet some messages in xc_domain.c

PATCH New Ben Thomas 1 participant 1 message Jun 6, 2006

lore
Share & tools
lore

Ben Thomas

author
#0 lore raw

PATCH 1/1 Simple patch to quiet some messages in xc_domain.c

xc_domain.c has a few fprintfs producing information about some error cases. These probably should be handled as debugging messages, and this patch implements one approach to this. The affected APIs are unaffected and continue to return the appropriate error status. They just are no longer as chatty when doing so.

Signature · 5 lines
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
[email protected]                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851
tools/libxc/xc_domain.c +13 -4
diff -r c191c649cdb3 tools/libxc/xc_domain.c
@@ -9,6 +9,15 @@
 #include "xc_private.h"
 #include <xen/memory.h>
 
+#define DEBUG 0
+
+#if DEBUG
+#define DPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
+#else
+#define DPRINTF(_f, _a...) ((void)0)
+#endif
+
+
 int xc_domain_create(int xc_handle,
                      uint32_t ssidref,
                      xen_domain_handle_t handle,
@@ -310,7 +319,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 +347,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 +358,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 +389,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;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel