From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBBVv-0002Gr-0Q for qemu-devel@nongnu.org; Mon, 10 Sep 2012 17:27:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBBVq-0003IJ-SW for qemu-devel@nongnu.org; Mon, 10 Sep 2012 17:27:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBBVq-0003I9-Jn for qemu-devel@nongnu.org; Mon, 10 Sep 2012 17:27:22 -0400 Message-ID: <504E5B34.1000604@redhat.com> Date: Mon, 10 Sep 2012 15:27:16 -0600 From: Eric Blake MIME-Version: 1.0 References: <1347265586-17698-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1347265586-17698-3-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1347265586-17698-3-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBC8BBD2660283E8C61152706" Subject: Re: [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBC8BBD2660283E8C61152706 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/10/2012 02:26 AM, Wenchao Xia wrote: > This patch contains type and defines used in APIs, one file for publi= c usage > by user, one for libqblock internal usage. >=20 > Signed-off-by: Wenchao Xia > --- > 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 >=20 As mentioned in 1/6, this should come earlier in the series, as it lays the fundamentals used by other new files. > diff --git a/libqblock/libqblock-internal.h b/libqblock/libqblock-inter= nal.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. > +++ b/libqblock/libqblock-types.h > +/* this library is designed around this core struct. */ > +struct QBlockState; > + > +/* every thread would have a broker. */ s/would/should/ > + > +/** > + * 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 no= t 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? --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigBC8BBD2660283E8C61152706 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQTls0AAoJEKeha0olJ0NqMuYIAKbe+wpLmQ+wfDRoksijwJJX TSWVApG2YzPbASLT/RJbW/CglNNfQ13V1G5UGQiCsSpNpWUukDiMEO6thbmmWrTk xdFEqlfCWM3tHiaj2uSerJLGQBsO8cscJEdVO+tUuslp7Co4F7gaCsA2phhEM4Nu oB2fIb5EZn68d67kNJvosSDFmDidnJZrR8sQyKSBEQnDFUIKCQQywJw2/p7Z6Mdl +wDBJU15/1JPH5bihNq/AVLVod9gG8j+rFrgjCOAyw52IJZdEwy0pVcjaT3QJ0wF jEQex8MoLcLXPEDILP/abhyx4IeFDUZf5A3rkF98n39fHCdJX0VxLrWabg6Xgxo= =eQ/m -----END PGP SIGNATURE----- --------------enigBC8BBD2660283E8C61152706--