WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] This patch will cause xcsdump to display more verbose in

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] This patch will cause xcsdump to display more verbose information about the
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Sun, 20 Mar 2005 14:03:52 +0000
Delivery-date: Sun, 20 Mar 2005 20:03:56 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
ChangeSet 1.1329, 2005/03/20 14:03:52+00:00, iap10@xxxxxxxxxxxxxxxxxxxx

        This patch will cause xcsdump to display more verbose information about 
the 
        xcs traffic.
        
        This includes human-readable names of the message type and subtype and 
        all of the parameters and their values.  It's against today's 
        xen-unstable and has been tested against a number of xen-unstable 
        snapshots going back a few weeks (one line has to be removed to support 
        older versions of xen-unstable).
        
        The message types displayed are configurable via a bitmask passed as a 
        '-v' option in xcsdump.
        
        The code is very useful for figuring out what management tools (Xend, 
        VM-Tools) are actually doing.  I would not have been able to write 
        vm-tools without it.
        
        Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
        Signed-off-by: ian@xxxxxxxxxxxxx



 Makefile  |    4 
 dump.c    |  526 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dump.h    |   28 +++
 xcsdump.c |   81 ++++++---
 4 files changed, 609 insertions(+), 30 deletions(-)


diff -Nru a/tools/xcs/Makefile b/tools/xcs/Makefile
--- a/tools/xcs/Makefile        2005-03-20 15:03:29 -05:00
+++ b/tools/xcs/Makefile        2005-03-20 15:03:29 -05:00
@@ -33,9 +33,9 @@
 clean:
        $(RM) *.a *.so *.o *.rpm $(BIN) xcsdump
 
-xcsdump: xcsdump.c
+xcsdump: xcsdump.c dump.c
        $(CC) $(CFLAGS) -o xcsdump xcsdump.c -L$(XEN_LIBXC) -L$(XEN_LIBXUTIL) \
-              ctrl_interface.c evtchn.c  -lxc -lxutil
+              ctrl_interface.c evtchn.c dump.c -lxc -lxutil
 
 $(BIN): $(OBJS)
        $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_LIBXUTIL) -lxc -lxutil 
diff -Nru a/tools/xcs/dump.c b/tools/xcs/dump.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/xcs/dump.c  2005-03-20 15:03:29 -05:00
@@ -0,0 +1,526 @@
+/*\
+ *  Copyright (C) International Business Machines  Corp., 2005
+ *  Author(s): Anthony Liguori <aliguori@xxxxxxxxxx>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ * 
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ * 
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+\*/
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "dump.h"
+
+#define str(a) # a
+#define error(a, ...) do { \
+ _error("%s:%s():L%d: " a, __FILE__, __FUNCTION__, __LINE__, ## __VA_ARGS__);\
+  exit(1); \
+} while (0)
+#define warn(a, ...) do { \
+ _error("%s:%s():L%d: " a, __FILE__, __FUNCTION__, __LINE__, ## __VA_ARGS__);\
+} while (0)
+#define debug(a, ...) do { \
+ _error(a, ## __VA_ARGS__);\
+} while (0)
+
+void _error(const char *fmt, ...);
+
+#define debug_begin(a, b) debug("CMSG_" a "_" b " {")
+#define debug_end(a, b) debug("}")
+#define debug_field(a, b, c) debug("\t." str(b) " = " c, a->b)
+#define debug_field_mac(a, b) \
+  debug("\t." str(b) " = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", \
+        a->b[0], a->b[1], a->b[2], a->b[3], a->b[4], a->b[5])
+
+#define debug_dump(a, b, c) debug_hex("\t." str(b) " = ", a->b, a->c)
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+
+static int strcount(const char *str, char ch)
+{
+       int i;
+       int count = 0;
+
+       for (i = 0; str[i]; i++) {
+               if (str[i] == ch) {
+                       count++;
+               }
+       }
+
+       return count;
+}
+
+void debug_hex(const char *info, const uint8_t *data, size_t length)
+{
+       int indent = strlen(info) + (strcount(info, '\t') * 8 - 1);
+       int words_per_row = (2 * (80 - indent - 2) / 7) & ~1;
+       size_t i;
+
+       for (i = 0; i < length; i += words_per_row) {
+               size_t ind;
+
+               if (i == 0) {
+                       fprintf(stderr, "%s", info);
+               } else {
+                       int j;
+                       for (j = 0; j < indent; j++) {
+                               fprintf(stderr, " ");
+                       }
+               }
+
+               for (ind = 0; ind < words_per_row; ind++) {
+                       if (ind % 2 == 0) {
+                               fprintf(stderr, " ");
+                       }
+
+                       if (i + ind < length) {
+                               fprintf(stderr, "%.2X", data[i + ind]);
+                       } else {
+                               fprintf(stderr, "  ");
+                       }
+               }
+
+               fprintf(stderr, " ");
+
+               for (ind = 0; ind < words_per_row; ind++) {
+                       if (i + ind < length) {
+                               if (isprint(data[i + ind])) {
+                                       fprintf(stderr, "%c", data[i + ind]);
+                               } else {
+                                       fprintf(stderr, ".");
+                               }
+                       } else {
+                               fprintf(stderr, " ");
+                       }
+               }
+               fprintf(stderr, "\n");
+       }
+}
+
+void dump_msg(const control_msg_t *msg, uint64_t flags)
+{
+       if ((flags & (1 << msg->type)) == 0) {
+               return;
+       }
+
+       switch (msg->type) {
+       case CMSG_CONSOLE:
+               if (msg->subtype == CMSG_CONSOLE_DATA) {
+                       debug_begin("CONSOLE", "DATA");
+                       debug_field(msg, length, "%u");
+                       debug_dump(msg, msg, length);
+                       debug_end("CONSOLE", "DATA");
+               } else {
+                       debug_begin("CONSOLE", "UNKNOWN");
+                       debug_field(msg, subtype, "%u");
+                       debug_field(msg, length, "%u");
+                       debug_dump(msg, msg, length);
+                       debug_end("CONSOLE", "UNKNOWN");
+               }
+               break;
+       case CMSG_BLKIF_BE:
+               if (msg->subtype == CMSG_BLKIF_BE_CREATE) {
+                       blkif_be_create_t *load;
+                       load = (blkif_be_create_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "CREATE");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "CREATE");
+               } else if (msg->subtype == CMSG_BLKIF_BE_DESTROY) {
+                       blkif_be_destroy_t *load;
+                       load = (blkif_be_destroy_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "DESTROY");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "DESTROY");
+               } else if (msg->subtype == CMSG_BLKIF_BE_CONNECT) {
+                       blkif_be_connect_t *load;
+                       load = (blkif_be_connect_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "CONNECT");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, shmem_frame, "%lu");
+                       debug_field(load, evtchn, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "CONNECT");
+               } else if (msg->subtype == CMSG_BLKIF_BE_DISCONNECT) {
+                       blkif_be_disconnect_t *load;
+                       load = (blkif_be_disconnect_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "DISCONNECT");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "DISCONNECT");
+               } else if (msg->subtype == CMSG_BLKIF_BE_VBD_CREATE) {
+                       blkif_be_vbd_create_t *load;
+                       load = (blkif_be_vbd_create_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "VBD_CREATE");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, vdevice, "%u");
+                       debug_field(load, readonly, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "VBD_CREATE");
+               } else if (msg->subtype == CMSG_BLKIF_BE_VBD_DESTROY) {
+                       blkif_be_vbd_destroy_t *load;
+                       load = (blkif_be_vbd_destroy_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "VBD_DESTROY");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, vdevice, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "VBD_DESTROY");
+               } else if (msg->subtype == CMSG_BLKIF_BE_VBD_GROW) {
+                       blkif_be_vbd_grow_t *load;
+                       load = (blkif_be_vbd_grow_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "VBD_GROW");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, extent.sector_start, "%llu");
+                       debug_field(load, extent.sector_length, "%llu");
+                       debug_field(load, extent.device, "%u");
+                       debug_field(load, vdevice, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "VBD_GROW");
+               } else if (msg->subtype == CMSG_BLKIF_BE_VBD_SHRINK) {
+                       blkif_be_vbd_shrink_t *load;
+                       load = (blkif_be_vbd_shrink_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "VBD_SHRINK");
+                       debug_field(load, domid, "%u");
+                       debug_field(load, blkif_handle, "%u");
+                       debug_field(load, vdevice, "%u");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "VBD_SHRINK");
+               } else if (msg->subtype == CMSG_BLKIF_BE_DRIVER_STATUS) {
+                       blkif_be_driver_status_t *load;
+                       load = (blkif_be_driver_status_t *)msg->msg;
+                       debug_begin("BLKIF_BE", "DRIVER_STATUS");
+                       debug_field(load, status, "%u");
+                       debug_end("BLKIF_BE", "DRIVER_STATUS");
+               } else {
+                       debug_begin("BLKIF_BE", "UNKNOWN");
+                       debug_field(msg, subtype, "%u");
+                       debug_field(msg, length, "%u");
+                       debug_dump(msg, msg, length);
+                       debug_end("BLKIF_BE", "UNKNOWN");
+               }
+               break;
+       case CMSG_BLKIF_FE:
+               if (msg->subtype == CMSG_BLKIF_FE_INTERFACE_STATUS) {
+                       blkif_fe_interface_status_t *load;
+                       load = (blkif_fe_interface_status_t *)msg->msg;
+                       debug_begin("BLKIF_FE", "INTERFACE_STATUS");
+                       debug_field(load, handle, "%u");
+                       debug_field(load, status, "%u");
+                       debug_field(load, evtchn, "%u");
+                       debug_field(load, domid, "%u");


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] This patch will cause xcsdump to display more verbose information about the, BitKeeper Bot <=