[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xl: Make blktap support optional



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.