diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-05-16 09:18:25 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-05-16 09:18:25 +0100 |
commit | b152f0ed7a5b3294fc70a60ca56496737a7e903f (patch) | |
tree | 6a209bb15439626573c139278b6c70f3f3691415 /tools/libxc/xc_tbuf.c | |
parent | 1c9887d59b3a49d3350ed1a72199b90a292284a8 (diff) | |
download | xen-b152f0ed7a5b3294fc70a60ca56496737a7e903f.tar.gz xen-b152f0ed7a5b3294fc70a60ca56496737a7e903f.tar.bz2 xen-b152f0ed7a5b3294fc70a60ca56496737a7e903f.zip |
Use common code for enabling tracing via xenmon and xentrace, also fixing
the last two remaining xc_private.h users outside of libxc.
Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/libxc/xc_tbuf.c')
-rw-r--r-- | tools/libxc/xc_tbuf.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c index ea64c8533f..699ebd355e 100644 --- a/tools/libxc/xc_tbuf.c +++ b/tools/libxc/xc_tbuf.c @@ -16,7 +16,7 @@ #include "xc_private.h" -int xc_tbuf_enable(int xc_handle, int enable) +static int tbuf_enable(int xc_handle, int enable) { DECLARE_DOM0_OP; @@ -30,7 +30,7 @@ int xc_tbuf_enable(int xc_handle, int enable) return xc_dom0_op(xc_handle, &op); } -int xc_tbuf_set_size(int xc_handle, uint32_t size) +int xc_tbuf_set_size(int xc_handle, unsigned long size) { DECLARE_DOM0_OP; @@ -42,7 +42,7 @@ int xc_tbuf_set_size(int xc_handle, uint32_t size) return xc_dom0_op(xc_handle, &op); } -int xc_tbuf_get_size(int xc_handle, uint32_t *size) +int xc_tbuf_get_size(int xc_handle, unsigned long *size) { int rc; DECLARE_DOM0_OP; @@ -57,10 +57,17 @@ int xc_tbuf_get_size(int xc_handle, uint32_t *size) return rc; } -int xc_tbuf_get_mfn(int xc_handle, unsigned long *mfn) +int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn, + unsigned long *size) { - int rc; DECLARE_DOM0_OP; + int rc; + + if ( xc_tbuf_set_size(xc_handle, cnt) != 0 ) + return -1; + + if ( tbuf_enable(xc_handle, 1) != 0 ) + return -1; op.cmd = DOM0_TBUFCONTROL; op.interface_version = DOM0_INTERFACE_VERSION; @@ -68,8 +75,17 @@ int xc_tbuf_get_mfn(int xc_handle, unsigned long *mfn) rc = xc_dom0_op(xc_handle, &op); if ( rc == 0 ) - *mfn = op.u.tbufcontrol.buffer_mfn; - return rc; + { + *size = op.u.tbufcontrol.size; + *mfn = op.u.tbufcontrol.buffer_mfn; + } + + return 0; +} + +int xc_tbuf_disable(int xc_handle) +{ + return tbuf_enable(xc_handle, 0); } int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask) @@ -95,3 +111,4 @@ int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask) return do_dom0_op(xc_handle, &op); } + |