From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFTLW-0007CH-Pu for qemu-devel@nongnu.org; Tue, 21 Jun 2016 17:36:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFTLV-0006yY-OX for qemu-devel@nongnu.org; Tue, 21 Jun 2016 17:36:34 -0400 References: <57683B94.2060902@redhat.com> From: Eric Blake Message-ID: <5769B358.8060702@redhat.com> Date: Tue, 21 Jun 2016 15:36:24 -0600 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mDPQUAnIOINLWBtSclR3LQqrgLAlrRMLI" Subject: Re: [Qemu-devel] [PATCH 04/15] block: Simplify find_block_job() and make it accept a job ID List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Max Reitz , Kevin Wolf , Jeff Cody This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mDPQUAnIOINLWBtSclR3LQqrgLAlrRMLI From: Eric Blake To: Alberto Garcia , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Max Reitz , Kevin Wolf , Jeff Cody Message-ID: <5769B358.8060702@redhat.com> Subject: Re: [PATCH 04/15] block: Simplify find_block_job() and make it accept a job ID References: <57683B94.2060902@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/21/2016 06:27 AM, Alberto Garcia wrote: > On Mon 20 Jun 2016 08:53:08 PM CEST, Eric Blake wrote: >>> +static BlockJob *find_block_job(const char *id, const char *device, >>> + AioContext **aio_context, Error **er= rp) >> >> Can this signature just be const char *id_or_device, rather than two >> parameters,... >=20 > But what if there's a name clash? All jobs have an id. And legacy users never set an id, so the id of legacy jobs will always be generated (and you can tell by the # character in the name that it was a generated id). Basically, I'm proposing a hierarchical lookup: If the id matches, then you use it. If the id doesn't match, then do a device lookup name. New code that knows to set the id should never pass anything but valid ids, so we only have to worry about the case of new code trying to check the status of a job that no longer exists and accidentally getting the status of an unrelated job that happened to belong to a device with the same name - but any new code shouldn't be that stupid as to use job ids that match device ids. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --mDPQUAnIOINLWBtSclR3LQqrgLAlrRMLI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXabNYAAoJEKeha0olJ0NqMGsIAIg99peeoYT/TNwExHhed52o J5WNfUEEz0CZSTbL+JlBiyCvSNEB7VeEnrmgq9bfRABQ0p1sLiQheQNurWT9Ddn3 SSMZzt8tdwb85K2+vREL3+N/C2piUQwD28kNESjjWCmCDbXZphIY+zI/bfGDgvDx H1vN5ncNZr0QtMhVYoAyfI2Osz9rWWmcu6Ca9t2d999vuYq1hvSdeMY2lnTeTfKq nDUWjS5UXKnxMiz46VuSd4OAaFVq8hbd7WfG9xeudDnHnJSms6nLTSfpU4YZYXeM oezafQ4J7JbYvG2mr4ITkQ0J/Eg18hB9y0cZ3xV/6oqbyQ1Mj9JIs/CXY94az78= =VPoi -----END PGP SIGNATURE----- --mDPQUAnIOINLWBtSclR3LQqrgLAlrRMLI--