From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwt48-0006sc-3l for qemu-devel@nongnu.org; Wed, 19 Oct 2016 11:46:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwt47-00066l-6a for qemu-devel@nongnu.org; Wed, 19 Oct 2016 11:46:04 -0400 Date: Wed, 19 Oct 2016 17:45:53 +0200 From: Kevin Wolf Message-ID: <20161019154553.GG5336@noname.redhat.com> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eRtJSFbw+EEWtPj3" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v4] raw_bsd: add offset and size options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: =?utf-8?B?VG9tw6HFoSBHb2xlbWJpb3Zza8O9?= , qemu-devel@nongnu.org, Max Reitz , Markus Armbruster , qemu-block@nongnu.org, "Daniel P . Berrange" --eRtJSFbw+EEWtPj3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 19.10.2016 um 17:38 hat Eric Blake geschrieben: > On 10/19/2016 07:27 AM, Tom=C3=A1=C5=A1 Golembiovsk=C3=BD wrote: > > Added two new options 'offset' and 'size'. This makes it possible to use > > only part of the file as a device. This can be used e.g. to limit the > > access only to single partition in a disk image or use a disk inside a > > tar archive (like OVA). > >=20 > > When 'size' is specified we do our best to honour it. > >=20 > > Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD > > --- > > block/raw_bsd.c | 168 +++++++++++++++++++++++++++++++++++++++++++= +++++++- > > qapi/block-core.json | 16 ++++- > > 2 files changed, 180 insertions(+), 4 deletions(-) > >=20 > > diff --git a/block/raw_bsd.c b/block/raw_bsd.c > > index 588d408..25b5ba8 100644 > > --- a/block/raw_bsd.c > > +++ b/block/raw_bsd.c > > @@ -31,6 +31,30 @@ > > #include "qapi/error.h" > > #include "qemu/option.h" > > =20 > > +typedef struct BDRVRawState { > > + uint64_t offset; > > + uint64_t size; > > + bool has_size; > > +} BDRVRawState; >=20 > This seems like it is duplicating a struct that QAPI should be able to > give us for free, if we would just use it. Possibly it has the same fields as BlockdevOptionsRaw, but I would use QAPI structs only for configuring a block device and not for its state after opening it (i.e. bs->opaque). So I agree with the explicit definition here. Kevin --eRtJSFbw+EEWtPj3 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJYB5UxAAoJEH8JsnLIjy/W/KAQAI2ta7arBJQjeTH/wis787I7 ZNU5jcJEV7/8zar2mU1NuQZ4LIMTlDLt8/CCPKPBt46v9PtIB9yRsx5MWhVaWwvV TKpqnW/vrlzQnTGmorAY7bd6UcH6QyX/oGljHPGhIYo5dsKJbOzHHxRTxZXTGWjh o2ncjcjUlchDY0er3WfyDsW4QjALp2FeMUYibFJGXN3lb3qG1em/lHJkX/cPMyXu tKjh0ALcsy/vD4zXX+uydg1D0Z/CFznGyy/SgQR1hQWvVKdJA2qCjygMs4IM3kwI VgecI11Tkua4Ckwk1cV/OVntzGY2Bco/WLWxasupU3MZveTY9mN49Mda9Ktbwfp+ ztslK8VoDeZQouFJwD5TEuw64zdNxzkQ3rPgqyceQ7UJnj799NVz3cgakUWDrK1Q jP9AyUsVgjFCYUN/JfzhlkwsR4Yvt8AsUWD1Kvs6eKEYtRjtLXXG4zLRlfjZxtOG DjQ1ofgmzRv3gfnLengnWv7h9wD2uUPYprV2z3NS/VNynEoqkcaXakOoy4aBFjAL NFJXls1LXRxBWdjpVGGhJFsrrt/yZawuhZwf/cKySE5yEN09daHWKKSXJ+JUn74Q 6rbtLq5pqKIsk9OLreM8gvuSSQkJp0tb8/pAJoUXrTSBQGz2tYBEpXv6L0pxngcr aW5dkGcf1Zk9OFX8pqhY =20IH -----END PGP SIGNATURE----- --eRtJSFbw+EEWtPj3--