All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v6 05/13] libxl: convert libxl__device_disk_local_attach to an async op
Date: Tue, 26 Jun 2012 11:27:14 +0100	[thread overview]
Message-ID: <4FE98E82.9060801@citrix.com> (raw)
In-Reply-To: <20451.24777.528406.191318@mariner.uk.xensource.com>

Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH v6 05/13] libxl: convert libxl__device_disk_local_attach to an async op"):
>> This will be needed in future patches, when libxl__device_disk_add
>> becomes async also. Create a new status structure that defines the
>> local attach of a disk device and use it in
>> libxl__device_disk_local_attach.
>
> This is looking good.  I have a couple of comments:

Thanks for the review!

>
>> diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
>> index 7ebc0df..182a975 100644
>> --- a/tools/libxl/libxl_bootloader.c
>> +++ b/tools/libxl/libxl_bootloader.c
> ...
>> +static void bootloader_fisnihed_cb(libxl__egc *egc,
>                            ^^^^^^^^
> `finished'.  You have apparently managed to misspell this everywhere
> you mention it!

Probably copy-pasted it wrong everywhere, fixed.

>> +                                   libxl__disk_local_state *dls,
>> +                                   int rc);
>> +
>>   static void bootloader_callback(libxl__egc *egc, libxl__bootloader_state *bl,
>>                                   int rc)
>>   {
>>       bootloader_cleanup(egc, bl);
>> +
>> +    if (bl->diskpath) {
>> +        bl->dls.callback = bootloader_fisnihed_cb;
>> +        libxl__device_disk_local_detach(egc,&bl->dls);
>> +        return;
>> +    }
>
> Can we make libxl__device_disk_local_detach idempotent (and perhaps
> call it `libxl__device_disk_local_attached_initiate_cleanup' or
> something, if you can think of a name that's less than a paragraph) ?

I'm not sure the "attached" in the name is correct, because the device 
might have failed to attach, and still we are going to call this 
function. How about "libxl__device_disk_local_initiate_detach"? (still 
quite long). Then the attach function should be renamed to 
libxl__device_disk_local_initiate_attach.

> If so then this would be simpler and wouldn't need to test
> bl->diskpath.

Ok, I've moved the test for bl->dls.diskpath to 
libxl__device_disk_local_detach, so we have a more linear flow of callbacks.

>
>> +static void bootloader_disk_attached_cb(libxl__egc *egc,
>> +                                        libxl__disk_local_state *dls,
>> +                                        int rc)
> ...
>> +    bl->diskpath = bl->dls.diskpath;
>
> Now that we have a bl->dls.diskpath, surely we can do away with
> bl->diskpath ?  I'm not a fan of having multiple variables with the
> same information in them, unless it's essential.  It just leads to
> confusion and error.

Done.

>> +/*
>> + * Make a disk available in this (the control) domain. Calls dls->callback
>> + * when finished.
>> + */
>> +_hidden void libxl__device_disk_local_attach(libxl__egc *egc,
>> +                                             libxl__disk_local_state *dls);
>> +_hidden void libxl__device_disk_local_detach(libxl__egc *egc,
>> +                                             libxl__disk_local_state *dls);
>
> You really need to explain the rules for one of these dls's.
>
> Is it something like this:
>
>       * A libxl__disk_local_state may be in the following states:
>       *    Undefined, Idle, Attaching, Attached, Detaching

Ok, I've added the init function and the description of what this 
functions do, together with the rename it should be a little bit more clear.

>      typedef void libxl__disk_local_state_callback(libxl__egc*,
>                                                    libxl__disk_local_state*,
>                                                    int rc);
>
>     _hidden void libxl__device_disk_local_attach(libxl__egc *egc,
>                                                  libxl__disk_local_state *dls);
>         /* Undefined/Idle ->  Attaching.  Will call callback.
>          * On entry to callback, if rc!=0 dls is Idle;
>          * if rc==0 it is Attached and dls->diskpath is usable. */
>
>     _hidden void libxl__device_disk_local_detach(libxl__egc *egc,
>                                                  libxl__disk_local_state *dls);
>         /* Attached ->  Detaching.  Will call callback.
>          * On entry to callback, dls is Idle, regardless of
>          * success or failure. */
>
> And my suggestion about idempotency would change this latter comment
> to:
>         /* Idle/Attached ->  Detaching.  Will call callback.
>          * On entry to callback, dls is Idle, regardless of
>          * success or failure. */
>
> And the bootloader code might want this:
>
>     _hidden void libxl__device_disk_local_init(libxl__disk_local_state *dls);
>         /* Undefined/Idle ->  Idle */
>
> Or you can explain it in prose if you like.
>
> Ian.

  reply	other threads:[~2012-06-26 10:27 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 12:21 [PATCH v6 00/13] execute hotplug scripts from libxl Roger Pau Monne
2012-05-30 13:07 ` [PATCH v5 01/10] " Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 01/10] libxl: change libxl__ao_device_remove to libxl__ao_device Roger Pau Monne
2012-06-07 10:53     ` Ian Jackson
2012-06-11 10:09       ` Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 02/10] libxl: move device model creation prototypes Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 03/10] libxl: convert libxl_domain_destroy to an async op Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 04/10] libxl: convert libxl_device_disk_add to an asyn op Roger Pau Monne
2012-06-07 11:38     ` Ian Jackson
2012-06-11 12:33       ` Roger Pau Monne
2012-06-07 14:20     ` Ian Jackson
2012-06-07 16:42       ` Roger Pau Monne
2012-06-07 16:47         ` Ian Jackson
2012-06-07 14:25     ` Ian Jackson
2012-06-07 16:55       ` Roger Pau Monne
2012-06-07 17:05         ` Ian Jackson
2012-06-07 17:07           ` Roger Pau Monne
2012-06-07 17:11             ` Ian Jackson
2012-05-30 13:07   ` [PATCH v5 05/10] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-06-07 14:26     ` Ian Jackson
2012-05-30 13:07   ` [PATCH v5 06/10] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 07/10] libxl: set nic type to VIF by default Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 08/10] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-06-07 14:40     ` Ian Jackson
2012-05-30 13:07   ` [PATCH v5 09/10] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-06-07 14:48     ` Ian Jackson
2012-06-11 14:34       ` Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 10/10] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-06-07 14:50     ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 01/13] libxl: change ao_device_remove to ao_device Roger Pau Monne
2012-06-15 16:45   ` Ian Jackson
2012-06-18  8:58     ` Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 02/13] libxl: move device model creation prototypes Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 03/13] libxl: convert libxl_domain_destroy to an async op Roger Pau Monne
2012-06-21 17:34   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 04/13] libxl: move bootloader data strucutres and prototypes Roger Pau Monne
2012-06-21 17:35   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 05/13] libxl: convert libxl__device_disk_local_attach to an async op Roger Pau Monne
2012-06-21 17:58   ` Ian Jackson
2012-06-26 10:27     ` Roger Pau Monne [this message]
2012-07-03 15:14   ` Ian Campbell
2012-06-14 12:21 ` [PATCH v6 06/13] libxl: convert libxl_device_disk_add " Roger Pau Monne
2012-06-22 11:33   ` Ian Jackson
2012-06-26 15:04     ` Roger Pau Monne
2012-06-26 15:14       ` Roger Pau Monne
2012-06-26 17:19       ` Ian Jackson
2012-06-27 17:35         ` Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 07/13] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-06-22 11:37   ` Ian Jackson
2012-06-22 12:01     ` Ian Campbell
2012-06-26 16:17     ` Roger Pau Monne
2012-06-26 17:22       ` Ian Jackson
2012-06-28  9:53         ` Roger Pau Monne
2012-06-28  9:56           ` Ian Campbell
2012-06-28 13:30             ` Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 08/13] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-07-03  8:33   ` Ian Campbell
2012-06-14 12:21 ` [PATCH v6 09/13] libxl: rename _IOEMU nic type to VIF_IOEMU Roger Pau Monne
2012-06-22 11:39   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 10/13] libxl: set nic type to VIF by default Roger Pau Monne
2012-06-22 11:40   ` Ian Jackson
2012-06-26 16:20     ` Roger Pau Monne
2012-06-26 16:58       ` Pasi Kärkkäinen
2012-06-27  8:50         ` Ian Campbell
2012-06-28  9:22           ` Roger Pau Monne
2012-06-28  9:26             ` Ian Campbell
2012-06-28  9:41               ` Roger Pau Monne
2012-06-28  9:54                 ` Ian Campbell
2012-06-28 10:07                   ` Roger Pau Monne
2012-06-28 10:10                     ` Ian Campbell
2012-06-28 13:29                       ` Roger Pau Monne
2012-06-28  9:28             ` Roger Pau Monne
2012-06-26 17:22       ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 11/13] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 12/13] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-06-22 11:43   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 13/13] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-06-22 11:47   ` [PATCH v5 09/10] libxl: call hotplug scripts for nic devices from libxl [and 1 more messages] Ian Jackson
2012-06-26  8:57     ` Roger Pau Monne
2012-07-03  8:27 ` [PATCH v6 00/13] execute hotplug scripts from libxl Ian Campbell
2012-07-03  9:19 ` Ian Campbell
2012-07-03  9:26   ` Ian Campbell
2012-07-03 12:54   ` Ian Jackson
2012-07-03 13:04     ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE98E82.9060801@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.