qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
	qemu-devel@nongnu.org, blauwirbel@gmail.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines
Date: Tue, 11 Sep 2012 11:26:13 +0800	[thread overview]
Message-ID: <504EAF55.7020802@linux.vnet.ibm.com> (raw)
In-Reply-To: <504E5B34.1000604@redhat.com>

于 2012-9-11 5:27, Eric Blake 写道:
> On 09/10/2012 02:26 AM, Wenchao Xia wrote:
>>    This patch contains type and defines used in APIs, one file for public usage
>> by user, one for libqblock internal usage.
>>
>> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
>> ---
>>   libqblock/libqblock-internal.h |   50 ++++++++
>>   libqblock/libqblock-types.h    |  251 ++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 301 insertions(+), 0 deletions(-)
>>   create mode 100644 libqblock/libqblock-internal.h
>>   create mode 100644 libqblock/libqblock-types.h
>>
>
> As mentioned in 1/6, this should come earlier in the series, as it lays
> the fundamentals used by other new files.
>
   OK.

>> diff --git a/libqblock/libqblock-internal.h b/libqblock/libqblock-internal.h
>> new file mode 100644
>> index 0000000..fa27ed4
>> --- /dev/null
>> +++ b/libqblock/libqblock-internal.h
>> @@ -0,0 +1,50 @@
>
>> +
>> +#define QB_ERR_STRING_SIZE (1024)
>> +struct QBroker {
>> +    /* last error */
>> +    char err_msg[QB_ERR_STRING_SIZE];
>
> Is this fixed-width struct going to bite us in the future?  Suppose I
> pass in a file name that is already 1000 bytes long; it seems like I
> might be able to get you to overflow this buffer if your error message
> includes the name of my offending file.
>
   Yes it will, thanks for mention me. The resource will always have a
limit, I guess I can just increase the size to 4k to solve the issue.

>> +++ b/libqblock/libqblock-types.h
>> +/* this library is designed around this core struct. */
>> +struct QBlockState;
>> +
>> +/* every thread would have a broker. */
>
> s/would/should/
>
  OK.

>> +
>> +/**
>> + * QBlockStaticInfo: information about the block image.
>> + *
>> + * @loc: location info.
>> + * @fmt_type: format type.
>> + * @virt_size: virtual size in bytes.
>> + * @backing_loc: backing file location, its type is QB_PROT_NONE if not exist.
>> + * @encrypt: encrypt flag.
>> + * @sector_size: how many bytes in a sector, it is 512 usually.
>> + */
>> +struct QBlockStaticInfo {
>> +    struct QBlockProtInfo loc;
>> +    enum QBlockFmtType fmt_type;
>> +    uint64_t virt_size;
>> +    /* advance info */
>> +    struct QBlockProtInfo backing_loc;
>> +    bool encrypt;
>> +    int sector_size;
>> +};
>
> No reserved space for potential growth in this structure?
>
   It could have or not. If new members are added in the tail, then
reserved bytes is not needed, for that this structure's instance
will be allocated in libqblock API.


-- 
Best Regards

Wenchao Xia

  reply	other threads:[~2012-09-11  3:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10  8:26 [Qemu-devel] [PATCH V2 0/6] libqblock, qemu block layer library Wenchao Xia
2012-09-10  8:26 ` [Qemu-devel] [PATCH V2 1/6] libqblock API design Wenchao Xia
2012-09-10 21:07   ` Eric Blake
2012-09-11  3:16     ` Wenchao Xia
2012-09-14  2:03       ` Wenchao Xia
2012-09-11 20:28   ` Blue Swirl
2012-09-12  2:54     ` Wenchao Xia
2012-09-12  8:19     ` Kevin Wolf
2012-09-12  9:21       ` Wenchao Xia
2012-09-14 19:08       ` Blue Swirl
2012-09-10  8:26 ` [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines Wenchao Xia
2012-09-10 21:27   ` Eric Blake
2012-09-11  3:26     ` Wenchao Xia [this message]
2012-09-11  4:12       ` Eric Blake
2012-09-11 20:31   ` Blue Swirl
2012-09-11 22:52     ` Eric Blake
2012-09-12  3:05       ` Wenchao Xia
2012-09-12 12:59         ` Eric Blake
2012-09-13  3:24           ` Wenchao Xia
2012-09-13  3:33             ` Eric Blake
2012-09-13  3:49               ` Eric Blake
2012-09-14 18:11                 ` Blue Swirl
2012-09-17  2:23                   ` Wenchao Xia
2012-09-17 19:08                     ` Blue Swirl
2012-09-14 18:02       ` Blue Swirl
2012-09-10  8:26 ` [Qemu-devel] [PATCH V2 3/6] libqblock error handling Wenchao Xia
2012-09-10 21:33   ` Eric Blake
2012-09-11  4:36     ` Wenchao Xia
2012-09-11 20:32   ` Blue Swirl
2012-09-12  2:58     ` Wenchao Xia
2012-09-14 17:09       ` Blue Swirl
2012-09-10  8:26 ` [Qemu-devel] [PATCH V2 4/6] libqblock export some qemu block function Wenchao Xia
2012-09-10  8:26 ` [Qemu-devel] [PATCH V2 5/6] libqblock building system Wenchao Xia
2012-09-10  8:26 ` [Qemu-devel] [PATCH V2 6/6] 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=504EAF55.7020802@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).