From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
qemu-devel@nongnu.org, blauwirbel@gmail.com, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH V4 2/5] libqblock type defines
Date: Fri, 28 Sep 2012 11:00:08 +0800 [thread overview]
Message-ID: <506512B8.5090903@linux.vnet.ibm.com> (raw)
In-Reply-To: <50642765.7090900@redhat.com>
于 2012-9-27 18:16, Paolo Bonzini 写道:
> Il 27/09/2012 11:52, Wenchao Xia ha scritto:
>>>
>>> Please use QBO_ instead of QB_ throughout. Also write COMPAT instead of
>>> CPT, and remove CPT_NONE since 0.10 is the default:
>>>
>> __NONE is used to indicate whether this property is set or get, so
>> it is actually have 3 status than just 2: Not set, V010, V110. It
>> is the same reason that I use __NONE in bool values, especially __NONE
>> could represent it is not got in information retrieving.
>
> Yes, that I guessed. I thought in many cases we can anticipate that the
> default is not going to change, but perhaps it's better to be safe
> (which is what you did).
>
> Please do change FALSE/TRUE to OFF/METADATA for preallocation enums, and
> please remove MONOLITHIC from QBO_FMT_VMDK_SUBFMT_MONOLITHIC_NONE.
>
OK, these should be changed.
>> Maybe I should rename them to __NOTSET.
>
> Perhaps "_DEFAULT" is even bette?
>
> Paolo
>
Yep, _DEFAULT seems good to me.
>>>>
>>>> +typedef struct QBlockStaticInfoAddr {
>>>> + uint64_t *virt_size;
>>>> + QBlockProtInfo *backing_loc;
>>>> + bool *encrypt;
>>>> +} QBlockStaticInfoAddr;
>>>
>>> Why the indirection?
>>>
>> It helps user to get these important members, otherwise
>> user will need
>> Switch (fmt) {
>> case RAW:
>> ....
>> case QCOW2:
>> ...
>> }
>> for every attribute. The indirection address will let user directly
>> access the members.
>
> Ah, ok, now I understand. Interesting. An alternative could be to add
> generic accessors like these:
>
> uint64_t qblock_get_virt_size(QBlockFmtInfo *fmt);
> QBlockProtInfo *qblock_get_backing_loc(QBlockFmtInfo *fmt);
> bool qblock_get_encrypt(QBlockFmtInfo *fmt);
>
> etc. that include the switch statement.
>
I think it is reasonable use generic accessors instead of embbed
structure, maybe an additional helper function should be added as:
QBlockStaticInfoAddr *qblock_get_static_info_addr(QBlockStaticInfo
*info)
In this way only one switch statement is needed in source code,
and only one new API is added.
> Paolo
>
--
Best Regards
Wenchao Xia
next prev parent reply other threads:[~2012-09-28 3:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 2:23 [Qemu-devel] [PATCH V4 0/5] libqblock qemu block layer library Wenchao Xia
2012-09-27 2:23 ` [Qemu-devel] [PATCH V4 1/5] libqblock build system Wenchao Xia
2012-09-27 8:06 ` Paolo Bonzini
2012-09-27 9:39 ` Wenchao Xia
2012-09-27 2:23 ` [Qemu-devel] [PATCH V4 2/5] libqblock type defines Wenchao Xia
2012-09-27 8:25 ` Paolo Bonzini
2012-09-27 9:52 ` Wenchao Xia
2012-09-27 10:16 ` Paolo Bonzini
2012-09-28 3:00 ` Wenchao Xia [this message]
2012-09-28 7:51 ` Paolo Bonzini
2012-09-28 10:52 ` Wenchao Xia
2012-09-28 10:58 ` Paolo Bonzini
2012-09-27 2:24 ` [Qemu-devel] [PATCH V4 3/5] libqblock API Wenchao Xia
2012-09-27 2:24 ` [Qemu-devel] [PATCH V4 4/5] libqblock test build system Wenchao Xia
2012-09-27 8:30 ` Paolo Bonzini
2012-09-27 9:56 ` Wenchao Xia
2012-09-27 10:17 ` Paolo Bonzini
2012-09-28 3:04 ` Wenchao Xia
2012-09-28 7:52 ` Paolo Bonzini
2012-09-28 9:46 ` Wenchao Xia
2012-09-27 2:24 ` [Qemu-devel] [PATCH V4 5/5] libqblock test example Wenchao Xia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=506512B8.5090903@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).