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-devel

Re: [Xen-devel] libxc: fix bug of xc_tbuf_get_size()

To: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] libxc: fix bug of xc_tbuf_get_size()
From: George Dunlap <dunlapg@xxxxxxxxx>
Date: Fri, 12 Feb 2010 17:09:41 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Fri, 12 Feb 2010 09:09:59 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=8t2TWadvv0xtfAQOmge+B/xrsJZza2oFJi3cyJcDRw0=; b=gMkI4ffugQVaXMy860OOhtcbyyx35KLrTYbOzGZ78kxndngjoWQR/T4aDCVRnfcR/f iGM7nzj4jU5/4+tZSC8MpPn8Ps5HQvlJJUqzXKSnSCb6ptLTE38p22Fp5sxcJ8l77Emv r91Z+O5PwDbQNYhXa+u6HysUi6AmeQ4v75pLA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=RA5y5IllA3smQZ8F7zAonZx3EH+RFaqM9VBO5UZzNDdU513wBIyFZMSYvh5KueOygw LDjl2bfRt+0gtAnQO/YjDpaS51HGwuVtjnQoYEIQldRv91FLzvehY4uvzIFifGISgI0N BW/qJZK4Dpe6eWfZdjMWefwdhrumI7T7Hru9I=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4B713F85.5040103@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4B713F85.5040103@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
(Replying to the whole list)

This is changing a function that is only used in one place in the Xen
source tree; the change makes sense.

Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

On Tue, Feb 9, 2010 at 10:57 AM, Yu Zhiguo <yuzg@xxxxxxxxxxxxxx> wrote:
> 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>
>
> 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,
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

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

<Prev in Thread] Current Thread [Next in Thread>