From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRPxH-0002pH-GI for qemu-devel@nongnu.org; Wed, 02 Oct 2013 13:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRPxC-0002q9-CF for qemu-devel@nongnu.org; Wed, 02 Oct 2013 13:11:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRPxC-0002q1-31 for qemu-devel@nongnu.org; Wed, 02 Oct 2013 13:11:14 -0400 Message-ID: <524C53A9.6060607@redhat.com> Date: Wed, 02 Oct 2013 11:11:05 -0600 From: Eric Blake MIME-Version: 1.0 References: <1380029714-5239-1-git-send-email-pl@kamp.de> <1380029714-5239-21-git-send-email-pl@kamp.de> In-Reply-To: <1380029714-5239-21-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="85tLmMC8gnhuL5HNXceVWrk1TVbKkblGF" Subject: Re: [Qemu-devel] [PATCHv3 20/20] block/raw: copy BlockLimits on raw_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, stefanha@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --85tLmMC8gnhuL5HNXceVWrk1TVbKkblGF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/24/2013 07:35 AM, Peter Lieven wrote: > Signed-off-by: Peter Lieven > --- > block/raw_bsd.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/block/raw_bsd.c b/block/raw_bsd.c > index 8dc7bba..7af26ad 100644 > --- a/block/raw_bsd.c > +++ b/block/raw_bsd.c > @@ -159,6 +159,7 @@ static int raw_open(BlockDriverState *bs, QDict *op= tions, int flags, > Error **errp) > { > bs->sg =3D bs->file->sg; > + memcpy(&bs->bl, &bs->file->bl, sizeof(struct BlockLimits)); Personally, I think that sizeof(var) is more robust, because if the declaration of var is ever changed, you don't have to remember to also touch up the memcpy. As in: memcpy(&bs->bl, &bs->file->bl, sizeof(bs->bl)); But there's plenty of examples of sizeof(type) in the codebase even when a var is handy, so you are not alone, and that's not a reason for me to request a respin. On the other hand, why use memcpy() at all? bs->bl =3D bs->file->bl; should do the same trick, with less typing. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --85tLmMC8gnhuL5HNXceVWrk1TVbKkblGF 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.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSTFOpAAoJEKeha0olJ0NqtUUH/Ax5xHFC457ZQZ8h4UFRI8Ip 9BuELfhn+LgGEZCfSKE0GIBOo3kkN9daeYBbtaZB48zMvq2du7XBuSrEI7ohCXgx C1G0yOx1qevAw5X2odtIg/T//UWLEsfTEWbNSGHcqgbf8nb3K878KpNXE9LSOwaG wOaz0MPjonzy5R3zCEaIPlcws4rAzSA1R0VhxFj3/vQYoQJiLX5W83cIMetjqmNm xZev7HHb2ciMB2H2R1azXtVKMT795vLFC7YeJ86KD7K9wQe5Ww81FOYi1weC8nxh BA8HfLX8PvDVa3zeWMoET7/hmeRj93F0XiXCDsiDbmnROme5yYxBkQ17JDsdoOY= =4R8s -----END PGP SIGNATURE----- --85tLmMC8gnhuL5HNXceVWrk1TVbKkblGF--