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] [PATCH] libxl: Fix blktap2 for xl cset 21586:c3c2bcafe47

To: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: Fix blktap2 for xl cset 21586:c3c2bcafe471
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 11 Jun 2010 12:20:20 +0100
Cc: Xen <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 11 Jun 2010 04:22:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1276254567.4191.2905.camel@xxxxxxxxxxxxxxxxxxx>
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: <121121275eff812547ab.1276210314@xxxxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.00.1006111136170.3401@kaball-desktop> <1276254567.4191.2905.camel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Fri, 11 Jun 2010, Daniel Stodden wrote:
> On Fri, 2010-06-11 at 06:38 -0400, Stefano Stabellini wrote:
> 
> > 
> > This code doesn't compile:
> > 
> > libxl_sprintf(ctx, devname);
> > 
> > In any case you can just use libxl_ptr_add to add a ptr to libxl memory
> > tracking.
> 
> It compiles for me. Please fix it and send an update.

Sure, this is the fix:

---

diff -r 630956366c2c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Jun 11 09:35:25 2010 +0100
+++ b/tools/libxl/libxl.c       Fri Jun 11 12:19:33 2010 +0100
@@ -1253,15 +1253,13 @@
 static char *make_blktap2_device(struct libxl_ctx *ctx,
                                 const char *name, const char *type)
 {
-    char *params, *devname = NULL, *rv = NULL;
+    char *params, *devname = NULL;
     int err;
     params = libxl_sprintf(ctx, "%s:%s", type, name);
     err = tap_ctl_create(params, &devname);
-    if (!err) {
-        rv = libxl_sprintf(ctx, devname);
-        free(devname);
-    }
-    return rv;
+    if (!err)
+        libxl_ptr_add(ctx, devname);
+    return err ? NULL : devname;
 }
 
 int libxl_device_disk_add(struct libxl_ctx *ctx, uint32_t domid, 
libxl_device_disk *disk)

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

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