WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxc: fix bug in xc_tbuf_get_size()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: fix bug in xc_tbuf_get_size()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 11 Feb 2010 14:50:17 -0800
Delivery-date: Thu, 11 Feb 2010 14:50:20 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1265808616 0
# Node ID 4b2aa9c350e69857da79b8bc3fe825797577bf2a
# Parent  f5fba6214a205c7db80c5af3425a8cafc98f5504
libxc: fix bug in xc_tbuf_get_size()

The size in pages of trace buffer should be t_info->tbuf_size
rather than t_info pages.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
---
 tools/libxc/xc_tbuf.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff -r f5fba6214a20 -r 4b2aa9c350e6 tools/libxc/xc_tbuf.c
--- a/tools/libxc/xc_tbuf.c     Wed Feb 10 13:27:55 2010 +0000
+++ b/tools/libxc/xc_tbuf.c     Wed Feb 10 13:30:16 2010 +0000
@@ -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_set_size(int xc_handle, unsi
 
 int xc_tbuf_get_size(int xc_handle, unsigned long *size)
 {
+    struct t_info *t_info;
     int rc;
     DECLARE_SYSCTL;
 
@@ -52,9 +54,19 @@ int xc_tbuf_get_size(int xc_handle, unsi
     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,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: fix bug in xc_tbuf_get_size(), Xen patchbot-unstable <=