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

Re: [Xen-devel] [RFC Patch v3 16/18] update libxl__device_disk_from_xs_be() to support blktap device



On Fri, Sep 12, 2014 at 05:03:02PM +0800, Wen Congyang wrote:
> On 09/12/2014 04:53 PM, Wei Liu wrote:
> > On Thu, Sep 11, 2014 at 03:58:37PM +0800, Wen Congyang wrote:
> >> On 09/08/2014 07:42 PM, Ian Campbell wrote:
> >>> On Fri, 2014-09-05 at 17:10 +0800, Wen Congyang wrote:
> >>>>
> >>>> +int libxl_string_to_format(libxl_ctx *ctx, char *s, libxl_disk_format
> >>>> *format)
> >>>> +{
> >>>
> >>> This already exists as libxl_disk_format_to_string.
> >>
> >> Another question:
> >> We store format:file to tapdisk-params/params. But we store aio if the 
> >> format
> >> is raw. libxl_disk_format_to_string() doesn't recognize aio...
> >>
> > 
> > I think you're talking about libxl_disk_format_from_string...
> 
> Yes
> 
> > 
> > FWIW, have you looked at libxl__device_disk_string_of_format?
> 
> char *libxl__device_disk_string_of_format(libxl_disk_format format)
> {
>     switch (format) {
>         case LIBXL_DISK_FORMAT_QCOW: return "qcow";
>         case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
>         case LIBXL_DISK_FORMAT_VHD: return "vhd";
>         case LIBXL_DISK_FORMAT_RAW:
>         case LIBXL_DISK_FORMAT_EMPTY: return "aio";
>         default: return NULL;
>     }
> }
> 
> If the format is LIBXL_DISK_FORMAT_RAW, we store "aio" in 
> tapdisk-params/params,
> But libxl_disk_format_from_string():
> libxl_enum_string_table libxl_disk_format_string_table[] = {
>     { .s = "unknown", .v = LIBXL_DISK_FORMAT_UNKNOWN },
>     { .s = "qcow", .v = LIBXL_DISK_FORMAT_QCOW },
>     { .s = "qcow2", .v = LIBXL_DISK_FORMAT_QCOW2 },
>     { .s = "vhd", .v = LIBXL_DISK_FORMAT_VHD },
>     { .s = "raw", .v = LIBXL_DISK_FORMAT_RAW },
>     { .s = "empty", .v = LIBXL_DISK_FORMAT_EMPTY },
>     { NULL, -1 },
> };
> 
> int libxl_disk_format_from_string(const char *s, libxl_disk_format *e)
> {
>     return libxl__enum_from_string(libxl_disk_format_string_table,
>                                    s, (int *)e);
> }
> If the string is "aio", libxl_disk_format_from_string() will return 
> ERROR_FAIL.
> 

Heh, interesting. This looks like a bug to me. But I'm not sure whether
this is for backward compatibility.

Git blame shows that libxl__device_disk_string_of_format hasn't been
touched for quite a while. I don't have enough knowledge of how this
came into being.

> We have two choices:
> 1. Introduce a new API

IMHO this has the risk of becoming out-of-sync in the future,
just like libxl__device_disk_string_of_format (if it is the case for
it).

Note that functions in _libxl_types*.[ch] are autogenerated so whenever
we make change to IDL they get regenerated, so that always reflects the
current interface.

Wei.

> 2. store "raw" in tapdisk-params/params
> 
> Thanks
> Wen Congyang
> 
> > 
> > Wei.
> > 
> >> Is it ok to change the value stored in tapdisk-params/params?
> >>
> >> Thanks
> >> Wen Congyang
> >>
> >>>
> >>> Ian.
> >>>
> >>> .
> >>>
> >>
> >>
> >> _______________________________________________
> >> Xen-devel mailing list
> >> Xen-devel@xxxxxxxxxxxxx
> >> http://lists.xen.org/xen-devel
> > .
> > 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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