From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkvR2-0002ai-PY for qemu-devel@nongnu.org; Thu, 15 May 2014 09:11:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkvQw-0002tp-Bs for qemu-devel@nongnu.org; Thu, 15 May 2014 09:10:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkvQv-0002tc-W6 for qemu-devel@nongnu.org; Thu, 15 May 2014 09:10:50 -0400 Date: Thu, 15 May 2014 09:10:16 -0400 From: Jeff Cody Message-ID: <20140515131016.GI8452@localhost.localdomain> References: <50765faa0041d43d22dd14a0128d3b55850571ac.1400123059.git.jcody@redhat.com> <20140515122657.GH2812@irqsave.net> <5374B9A7.9040106@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <5374B9A7.9040106@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 5/5] block: extend block-commit to accept a string for the backing file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , kwolf@redhat.com, pkrempa@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, May 15, 2014 at 06:57:11AM -0600, Eric Blake wrote: > On 05/15/2014 06:26 AM, Beno=EEt Canet wrote: > > The Wednesday 14 May 2014 =E0 23:20:19 (-0400), Jeff Cody wrote : > >> On some image chains, QEMU may not always be able to resolve the > >> filenames properly, when updating the backing file of an image > >> after a block commit. > >> >=20 > >> } else { > >> commit_start(bs, base_bs, top_bs, speed, on_error, block_jo= b_cb, bs, > >> - &local_err); > >> + backing_file, &local_err); > >=20 > > I don't know QAPI well enough to be sure but are we certain that if=20 > > has_backing_file =3D=3D false then backing_file =3D=3D NULL and not s= ome > > random pointer ? > >=20 > > If am thinking to add has_backing_file ? backing_file : NULL here. >=20 > We are moving towards having qapi guarantee sane defaults for FOO when > has_FOO is false; but aren't there yet. You are correct that this need= s > to guarantee that we aren't passing random memory. > The QAPI code generator for the QMP input marshaller initializes all pointers to NULL, and all bools to false. If has_ is false, then the associated pointer will also be NULL, so it is safe to just pass backing_file.