From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyjFh-00069v-6a for qemu-devel@nongnu.org; Wed, 10 Dec 2014 10:32:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyjFX-0008RM-FM for qemu-devel@nongnu.org; Wed, 10 Dec 2014 10:32:33 -0500 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:44446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyjFX-0008Qn-9C for qemu-devel@nongnu.org; Wed, 10 Dec 2014 10:32:23 -0500 Received: by mail-wi0-f180.google.com with SMTP id n3so5557846wiv.13 for ; Wed, 10 Dec 2014 07:32:22 -0800 (PST) Date: Wed, 10 Dec 2014 15:32:19 +0000 From: Stefan Hajnoczi Message-ID: <20141210153219.GD30812@stefanha-thinkpad.redhat.com> References: <1417613866-25890-1-git-send-email-mreitz@redhat.com> <1417613866-25890-5-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="P+33d92oIH25kiaB" Content-Disposition: inline In-Reply-To: <1417613866-25890-5-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 04/26] qcow2: Only return status from qcow2_get_refcount List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi --P+33d92oIH25kiaB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 03, 2014 at 02:37:24PM +0100, Max Reitz wrote: > Refcounts can theoretically be of type uint64_t; in order to be able to > represent the full range, qcow2_get_refcount() cannot use a single > variable to represent both all refcount values and also keep some values > reserved for errors. >=20 > One solution would be to add an Error pointer parameter to > qcow2_get_refcount(); however, no caller could (currently) pass that > error message, so it would have to be emitted immediately and be > passed to the next caller by returning -EIO or something similar. > Therefore, an Error parameter does not offer any advantages here. >=20 > The solution applied by this patch is simpler to use. Because no caller > would be able to pass the error message, they would have to print it and > free it, whereas with this patch the caller only needs to pass the > returned integer (which is often a no-op from the code perspective, > because that integer will be stored in a variable "ret" which will be > returned by the fail path of many callers). >=20 > Signed-off-by: Max Reitz > --- > block/qcow2-cluster.c | 8 ++--- > block/qcow2-refcount.c | 79 +++++++++++++++++++++++++++-----------------= ------ > block/qcow2.h | 3 +- > 3 files changed, 49 insertions(+), 41 deletions(-) Reviewed-by: Stefan Hajnoczi --P+33d92oIH25kiaB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUiGeDAAoJEJykq7OBq3PItUYH/i4zrjY6FHh+dRz8vKaAhKED MXkqd2ocHO8jYBWw+5Nh7QIaBER6z4+lhtEGdK5Yy8CHyREn310j57ApZ5XHRk2N nTrqtM+sBspBvIEUftMfhNVDBRv9JqvAUo+s3EOGXzyecPR6daMoBqoJCBeZYw7T /HcRd/BlFIo0ZCWoo6/xsH4aXO8F6ssUvGktYAx7n5/x163UOF8qmuUTIG4cEJVq MaG7LZ3mTXW/DzfgL0jmkm1lDmGZfcHzPRaIAqoWOoFWCLM2qDRXx13oRS5koZ+0 DIlJXm3CB6QZOAaEf44I2nblsjvDERK0JxAqvJqdvWGjBY/a9geQFApHSLOxIiM= =Opgd -----END PGP SIGNATURE----- --P+33d92oIH25kiaB--