diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:30:19 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:30:19 +0100 |
commit | 5cc436c1d2b3b0be3f42104582f53eec3969b43a (patch) | |
tree | 1e30ade146ee7287c486d1309b5d3d2c69a2d9b9 /tools/libxc/xc_tbuf.c | |
parent | 7f9a888af4b65cb8c22cea3c8295d30d0fedd623 (diff) | |
download | xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.gz xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.bz2 xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.zip |
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 <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_tbuf.c')
-rw-r--r-- | tools/libxc/xc_tbuf.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c index aa21d849bb..6e77ac892f 100644 --- a/tools/libxc/xc_tbuf.c +++ b/tools/libxc/xc_tbuf.c @@ -17,7 +17,7 @@ #include "xc_private.h" #include <xen/trace.h> -static int tbuf_enable(int xc_handle, int enable) +static int tbuf_enable(xc_interface *xch, int enable) { DECLARE_SYSCTL; @@ -28,10 +28,10 @@ static int tbuf_enable(int xc_handle, int enable) else sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_disable; - return xc_sysctl(xc_handle, &sysctl); + return xc_sysctl(xch, &sysctl); } -int xc_tbuf_set_size(int xc_handle, unsigned long size) +int xc_tbuf_set_size(xc_interface *xch, unsigned long size) { DECLARE_SYSCTL; @@ -40,10 +40,10 @@ int xc_tbuf_set_size(int xc_handle, unsigned long size) sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_size; sysctl.u.tbuf_op.size = size; - return xc_sysctl(xc_handle, &sysctl); + return xc_sysctl(xch, &sysctl); } -int xc_tbuf_get_size(int xc_handle, unsigned long *size) +int xc_tbuf_get_size(xc_interface *xch, unsigned long *size) { struct t_info *t_info; int rc; @@ -53,11 +53,11 @@ int xc_tbuf_get_size(int xc_handle, unsigned long *size) sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info; - rc = xc_sysctl(xc_handle, &sysctl); + rc = xc_sysctl(xch, &sysctl); if ( rc != 0 ) return rc; - t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, + t_info = xc_map_foreign_range(xch, DOMID_XEN, sysctl.u.tbuf_op.size, PROT_READ | PROT_WRITE, sysctl.u.tbuf_op.buffer_mfn); @@ -69,7 +69,7 @@ int xc_tbuf_get_size(int xc_handle, unsigned long *size) return 0; } -int xc_tbuf_enable(int xc_handle, unsigned long pages, unsigned long *mfn, +int xc_tbuf_enable(xc_interface *xch, unsigned long pages, unsigned long *mfn, unsigned long *size) { DECLARE_SYSCTL; @@ -80,16 +80,16 @@ int xc_tbuf_enable(int xc_handle, unsigned long pages, unsigned long *mfn, * set (since trace buffers cannot be reallocated). If we really have no * buffers at all then tbuf_enable() will fail, so this is safe. */ - (void)xc_tbuf_set_size(xc_handle, pages); + (void)xc_tbuf_set_size(xch, pages); - if ( tbuf_enable(xc_handle, 1) != 0 ) + if ( tbuf_enable(xch, 1) != 0 ) return -1; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info; - rc = xc_sysctl(xc_handle, &sysctl); + rc = xc_sysctl(xch, &sysctl); if ( rc == 0 ) { *size = sysctl.u.tbuf_op.size; @@ -99,12 +99,12 @@ int xc_tbuf_enable(int xc_handle, unsigned long pages, unsigned long *mfn, return 0; } -int xc_tbuf_disable(int xc_handle) +int xc_tbuf_disable(xc_interface *xch) { - return tbuf_enable(xc_handle, 0); + return tbuf_enable(xch, 0); } -int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask) +int xc_tbuf_set_cpu_mask(xc_interface *xch, uint32_t mask) { DECLARE_SYSCTL; int ret = -1; @@ -126,7 +126,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask) goto out; } - ret = do_sysctl(xc_handle, &sysctl); + ret = do_sysctl(xch, &sysctl); unlock_pages(&bytemap, sizeof(bytemap)); @@ -134,7 +134,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask) return ret; } -int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask) +int xc_tbuf_set_evt_mask(xc_interface *xch, uint32_t mask) { DECLARE_SYSCTL; @@ -143,6 +143,6 @@ int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask) sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_evt_mask; sysctl.u.tbuf_op.evt_mask = mask; - return do_sysctl(xc_handle, &sysctl); + return do_sysctl(xch, &sysctl); } |