[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] lsevtchn: Improve this evtchn reporting tool.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1220612195 -3600 # Node ID be573a356c90c0344a1986e760e54f6017f1fada # Parent 1a785d213573ebbbfb94947de16ed4e34618e727 lsevtchn: Improve this evtchn reporting tool. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/libxc/xc_evtchn.c | 15 ++------------ tools/libxc/xenctrl.h | 6 ++--- tools/xcutils/lsevtchn.c | 48 ++++++++++++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 36 deletions(-) diff -r 1a785d213573 -r be573a356c90 tools/libxc/xc_evtchn.c --- a/tools/libxc/xc_evtchn.c Fri Sep 05 11:18:20 2008 +0100 +++ b/tools/libxc/xc_evtchn.c Fri Sep 05 11:56:35 2008 +0100 @@ -59,17 +59,8 @@ int xc_evtchn_reset(int xc_handle, return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg), 0); } -int xc_evtchn_status(int xc_handle, - uint32_t dom, - uint32_t port) +int xc_evtchn_status(int xc_handle, xc_evtchn_status_t *status) { - int rc; - struct evtchn_status arg = { .dom = (domid_t)dom, - .port = (evtchn_port_t)port }; - - rc = do_evtchn_op(xc_handle, EVTCHNOP_status, &arg, sizeof(arg), 1); - if ( rc == 0 ) - rc = arg.status; - - return rc; + return do_evtchn_op(xc_handle, EVTCHNOP_status, status, + sizeof(*status), 1); } diff -r 1a785d213573 -r be573a356c90 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri Sep 05 11:18:20 2008 +0100 +++ b/tools/libxc/xenctrl.h Fri Sep 05 11:56:35 2008 +0100 @@ -502,9 +502,9 @@ xc_evtchn_alloc_unbound(int xc_handle, int xc_evtchn_reset(int xc_handle, uint32_t dom); -int xc_evtchn_status(int xc_handle, - uint32_t dom, - uint32_t port); + +typedef struct evtchn_status xc_evtchn_status_t; +int xc_evtchn_status(int xc_handle, xc_evtchn_status_t *status); /* * Return a handle to the event channel driver, or -1 on failure, in which case diff -r 1a785d213573 -r be573a356c90 tools/xcutils/lsevtchn.c --- a/tools/xcutils/lsevtchn.c Fri Sep 05 11:18:20 2008 +0100 +++ b/tools/xcutils/lsevtchn.c Fri Sep 05 11:56:35 2008 +0100 @@ -8,49 +8,55 @@ #include <xenctrl.h> #include <xenguest.h> -int -main(int argc, char **argv) +int main(int argc, char **argv) { - int xc_fd; - int domid = 0, port = 0, status; - const char *msg; + int xc_fd, domid, port, rc; + xc_evtchn_status_t status; - if ( argc > 1 ) - domid = strtol(argv[1], NULL, 10); + domid = (argc > 1) ? strtol(argv[1], NULL, 10) : 0; xc_fd = xc_interface_open(); if ( xc_fd < 0 ) errx(1, "failed to open control interface"); - while ( (status = xc_evtchn_status(xc_fd, domid, port)) >= 0 ) + for ( port = 0; ; port++ ) { - switch ( status ) + status.dom = domid; + status.port = port; + rc = xc_evtchn_status(xc_fd, &status); + if ( rc < 0 ) + break; + + if ( status.status == EVTCHNSTAT_closed ) + continue; + + printf("%4d: VCPU %u: ", port, status.vcpu); + + switch ( status.status ) { - case EVTCHNSTAT_closed: - msg = "Channel is not in use."; - break; case EVTCHNSTAT_unbound: - msg = "Channel is waiting interdom connection."; + printf("Interdomain (Waiting connection) - Remote Domain %u", + status.u.unbound.dom); break; case EVTCHNSTAT_interdomain: - msg = "Channel is connected to remote domain."; + printf("Interdomain (Connected) - Remote Domain %u, Port %u", + status.u.interdomain.dom, status.u.interdomain.port); break; case EVTCHNSTAT_pirq: - msg = "Channel is bound to a phys IRQ line."; + printf("Physical IRQ %u", status.u.pirq); break; case EVTCHNSTAT_virq: - msg = "Channel is bound to a virtual IRQ line."; + printf("Virtual IRQ %u", status.u.virq); break; case EVTCHNSTAT_ipi: - msg = "Channel is bound to a virtual IPI line."; + printf("IPI"); break; default: - msg = "Unknown."; + printf("Unknown"); break; + } - } - printf("%03d: %d: %s\n", port, status, msg); - port++; + printf("\n"); } xc_interface_close(xc_fd); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |