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] xl: Make blktap support optional

To: Christoph Egger <Christoph.Egger@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xl: Make blktap support optional
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Mon, 16 Aug 2010 16:20:22 +0100
Cc: Ian, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Mon, 16 Aug 2010 08:26:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <201008131606.24873.Christoph.Egger@xxxxxxx>
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: <201008131606.24873.Christoph.Egger@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2010-08-13 at 15:06 +0100, Christoph Egger wrote:
> diff -r 2760576b0d7c -r 9996d4f06e70 tools/libxl/libxl_blktap2.c
> --- /dev/null
> +++ b/tools/libxl/libxl_blktap2.c
> @@ -0,0 +1,51 @@
> +/*
> + * Copyright (C) 2010      Advanced Micro Devices
> + * Author Christoph Egger <Christoph.Egger@xxxxxxx>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl.h"
> +#include "libxl_osdeps.h"
> +#include "libxl_internal.h"
> +
> +#include "tap-ctl.h"
> +
> +int libxl_blktap_enabled(libxl_ctx *ctx)
> +{
> +    const char *msg;
> +    return !tap_ctl_check(&msg);
> +}
> +
> +const char *libxl_blktap_devpath(libxl_ctx *ctx,
> +                                 const char *disk,
> +                                 libxl_disk_phystype phystype)
> +{
> +    const char *type;
> +    char *params, *devname;
> +    int minor, err;
> +
> +    type = device_disk_string_of_phystype(phystype);
> +    minor = tap_ctl_find_minor(type, disk);
> +    if (minor >= 0) {
> +        devname = libxl_sprintf(ctx, "/dev/xen/blktap-2/tapdev%d", minor);
> +        if (devname)
> +            return devname;
> +    }

This actually breaks the build on linux. It's because this part of the
patch needs a re-base since libxl_sprintf() etc. no longer takes a ctx
argument. You will need to initialise a gc to do the libxl_sprintf() and
then strdup() the result for the caller. The parts where you patched out
of libxl.c had equivalent changes.

> +    params = libxl_sprintf(ctx, "%s:%s", type, disk);
> +    err = tap_ctl_create(params, &devname);
> +    if (!err) {
> +        libxl_ptr_add(ctx, devname);
> +        return devname;
> +    }

libxl_ptr_add will no longer be necessary when re-based as above.

> +
> +    return NULL;
> +} 

Other than that, which changed under your feet, I think the patch is
fine.


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

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