From 5cc436c1d2b3b0be3f42104582f53eec3969b43a Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 28 May 2010 09:30:19 +0100 Subject: libxc: eliminate static variables, use xentoollog; API change This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson --- tools/xentrace/setsize.c | 2 +- tools/xentrace/xenctx.c | 6 +++--- tools/xentrace/xentrace.c | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tools/xentrace') diff --git a/tools/xentrace/setsize.c b/tools/xentrace/setsize.c index fcb1fcb6b0..ad8791502c 100644 --- a/tools/xentrace/setsize.c +++ b/tools/xentrace/setsize.c @@ -6,7 +6,7 @@ int main(int argc, char * argv[]) { unsigned long size; - int xc_handle = xc_interface_open(); + xc_interface *xc_handle = xc_interface_open(0,0,0); if ( xc_tbuf_get_size(xc_handle, &size) != 0 ) { diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index 0797c521c9..b16b5c40ad 100644 --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -28,7 +28,7 @@ #include #include -int xc_handle = 0; +xc_interface *xc_handle = 0; int domid = 0; int frame_ptrs = 0; int stack_trace = 0; @@ -823,7 +823,7 @@ static void dump_ctx(int vcpu) vcpu_guest_context_any_t ctx; xc_dominfo_t dominfo; - xc_handle = xc_interface_open(); /* for accessing control interface */ + xc_handle = xc_interface_open(0,0,0); /* for accessing control interface */ ret = xc_domain_getinfo(xc_handle, domid, 1, &dominfo); if (ret < 0) { @@ -890,7 +890,7 @@ static void dump_ctx(int vcpu) } } - xc_interface_close(xc_handle); + ret = xc_interface_close(xc_handle); if (ret < 0) { perror("xc_interface_close"); exit(-1); diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c index dd5471a3e9..6291cde033 100644 --- a/tools/xentrace/xentrace.c +++ b/tools/xentrace/xentrace.c @@ -72,7 +72,7 @@ settings_t opts; int interrupted = 0; /* gets set if we get a SIGHUP */ -static int xc_handle = -1; +static xc_interface *xc_handle; static int event_fd = -1; static int virq_port = -1; static int outfd = 1; @@ -424,10 +424,10 @@ fail: static void disable_tbufs(void) { - int xc_handle = xc_interface_open(); + xc_interface *xc_handle = xc_interface_open(0,0,0); int ret; - if ( xc_handle < 0 ) + if ( !xc_handle ) { perror("Couldn't open xc handle to disable tbufs."); goto out; @@ -578,7 +578,7 @@ static void event_init(void) rc = xc_evtchn_open(); if (rc < 0) { - perror(xc_get_last_error()->message); + perror("event channel open"); exit(EXIT_FAILURE); } event_fd = rc; @@ -1014,10 +1014,10 @@ int main(int argc, char **argv) parse_args(argc, argv); - xc_handle = xc_interface_open(); - if ( xc_handle < 0 ) + xc_handle = xc_interface_open(0,0,0); + if ( !xc_handle ) { - perror(xc_get_last_error()->message); + perror("xenctrl interface open"); exit(EXIT_FAILURE); } -- cgit v1.2.3