[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 04/15] block: Simplify find_block_job() and make

From: Alberto Garcia
Subject: Re: [Qemu-block] [PATCH 04/15] block: Simplify find_block_job() and make it accept a job ID
Date: Wed, 22 Jun 2016 09:32:00 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Tue 21 Jun 2016 11:36:24 PM CEST, Eric Blake <address@hidden> wrote:
> 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 **errp)
>>> Can this signature just be const char *id_or_device, rather than two
>>> parameters,...
>> 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.

Yeah, it *shouldn't*, but is it a good idea to leave this door open just
to have a slightly simpler internal API?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]