From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>, xen-devel@lists.xensource.com
Subject: libxc: fix bug of xc_tbuf_get_size()
Date: Tue, 09 Feb 2010 18:57:09 +0800 [thread overview]
Message-ID: <4B713F85.5040103@cn.fujitsu.com> (raw)
The size in pages of trace buffer should be t_info->tbuf_size
rather than t_info pages.
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -15,6 +15,7 @@
*/
#include "xc_private.h"
+#include <xen/trace.h>
static int tbuf_enable(int xc_handle, int enable)
{
@@ -44,6 +45,7 @@
int xc_tbuf_get_size(int xc_handle, unsigned long *size)
{
+ struct t_info *t_info;
int rc;
DECLARE_SYSCTL;
@@ -52,9 +54,19 @@
sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info;
rc = xc_sysctl(xc_handle, &sysctl);
- if (rc == 0)
- *size = sysctl.u.tbuf_op.size;
- return rc;
+ if ( rc != 0 )
+ return rc;
+
+ t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
+ sysctl.u.tbuf_op.size, PROT_READ | PROT_WRITE,
+ sysctl.u.tbuf_op.buffer_mfn);
+
+ if ( t_info == NULL || t_info->tbuf_size == 0 )
+ return -1;
+
+ *size = t_info->tbuf_size;
+
+ return 0;
}
int xc_tbuf_enable(int xc_handle, unsigned long pages, unsigned long *mfn,
next reply other threads:[~2010-02-09 10:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 10:57 Yu Zhiguo [this message]
2010-02-10 9:17 ` libxc: fix bug of xc_tbuf_get_size() Keir Fraser
2010-02-10 11:30 ` Yu Zhiguo
2010-02-12 17:09 ` George Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B713F85.5040103@cn.fujitsu.com \
--to=yuzg@cn.fujitsu.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.