From: Wei Liu Subject: Re: [RFC Patch v3 16/18] update libxl__device_disk_from_xs_be() to support blktap device Date: Fri, 12 Sep 2014 11:35:31 +0100 Message-ID: <20140912103531.GG31343@zion.uk.xensource.com> References: <1409908261-18682-1-git-send-email-wency@cn.fujitsu.com> <1409908261-18682-17-git-send-email-wency@cn.fujitsu.com> <1410176567.10156.201.camel@kazak.uk.xensource.com> <5411562D.8000604@cn.fujitsu.com> <20140912085315.GB31343@zion.uk.xensource.com> <5412B6C6.7060708@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <5412B6C6.7060708@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wen Congyang Cc: Wei Liu , Ian Campbell , Dong Eddie , Jiang Yunhong , Ian Jackson , xen devel , Shriram Rajagopalan , Yang Hongyang , Lai Jiangshan List-Id: xen-devel@lists.xenproject.org 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@lists.xen.org > >> http://lists.xen.org/xen-devel > > . > >