[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 1/4] xentrace: Use PERROR from xc_private. instead of our own.



However, the xc_private PERROR uses 'xch' while we call said
structure 'xc_handle' - so this patch also changes the variable
to xch.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 tools/xentrace/xentrace.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index 8a38e32..16034e3 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -30,15 +30,7 @@
 #include <xen/trace.h>
 
 #include <xenctrl.h>
-
-#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)
-
+#include "xc_private.h"
 
 /***** Compile time configuration of defaults ********************************/
 
@@ -72,7 +64,7 @@ settings_t opts;
 
 int interrupted = 0; /* gets set if we get a SIGHUP */
 
-static xc_interface *xc_handle;
+static xc_interface *xch;
 static xc_evtchn *xce_handle = NULL;
 static int virq_port = -1;
 static int outfd = 1;
@@ -447,7 +439,7 @@ static void get_tbufs(unsigned long *mfn, unsigned long 
*size)
     if(!opts.tbuf_size)
       opts.tbuf_size = DEFAULT_TBUF_SIZE;
 
-    ret = xc_tbuf_enable(xc_handle, opts.tbuf_size, mfn, size);
+    ret = xc_tbuf_enable(xch, opts.tbuf_size, mfn, size);
 
     if ( ret != 0 )
     {
@@ -471,7 +463,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, 
unsigned int num,
     int i;
 
     /* Map t_info metadata structure */
-    tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+    tbufs.t_info = xc_map_foreign_range(xch, DOMID_XEN, tinfo_size,
                                         PROT_READ, tbufs_mfn);
 
     if ( tbufs.t_info == 0 ) 
@@ -506,7 +498,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, 
unsigned int num,
         for ( j=0; j<tbufs.t_info->tbuf_size; j++)
             pfn_list[j] = (xen_pfn_t)mfn_list[j];
 
-        tbufs.meta[i] = xc_map_foreign_batch(xc_handle, DOMID_XEN,
+        tbufs.meta[i] = xc_map_foreign_batch(xch, DOMID_XEN,
                                              PROT_READ | PROT_WRITE,
                                              pfn_list,
                                              tbufs.t_info->tbuf_size);
@@ -532,10 +524,10 @@ static void set_mask(uint32_t mask, int type)
     int ret = 0;
 
     if (type == 1) {
-        ret = xc_tbuf_set_cpu_mask(xc_handle, mask);
+        ret = xc_tbuf_set_cpu_mask(xch, mask);
         fprintf(stderr, "change cpumask to 0x%x\n", mask);
     } else if (type == 0) {
-        ret = xc_tbuf_set_evt_mask(xc_handle, mask);
+        ret = xc_tbuf_set_evt_mask(xch, mask);
         fprintf(stderr, "change evtmask to 0x%x\n", mask);
     }
 
@@ -554,7 +546,7 @@ static unsigned int get_num_cpus(void)
     xc_physinfo_t physinfo = { 0 };
     int ret;
     
-    ret = xc_physinfo(xc_handle, &physinfo);
+    ret = xc_physinfo(xch, &physinfo);
     
     if ( ret != 0 )
     {
@@ -1010,8 +1002,8 @@ int main(int argc, char **argv)
 
     parse_args(argc, argv);
 
-    xc_handle = xc_interface_open(0,0,0);
-    if ( !xc_handle ) 
+    xch = xc_interface_open(0,0,0);
+    if ( !xch )
     {
         perror("xenctrl interface open");
         exit(EXIT_FAILURE);
-- 
1.7.7.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.