Re: [PATCH v5 04/10] libxl: convert libxl_device_disk_add to an asyn op

Roger Pau Monne
Thu, 07 Jun 2012 16:42:20 -0000

Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH v5 04/10] libxl: convert
libxl_device_disk_add to an asyn op"):
>> This patch converts libxl_device_disk_add to an ao operation that
>> waits for device backend to reach state XenbusStateInitWait and then
>> marks the operation as completed. This is not really useful now, but
>> will be used by latter patches that will launch hotplug scripts after
>> we reached the desired xenbus state.
>
> Just spotted:
>
>> +void libxl__initiate_device_add(libxl__egc *egc, libxl__ao_device
*aodev)
>> +{
> ...
>> +    libxl__ev_devstate_init(&aodev->ds);
>> +    rc = libxl__ev_devstate_wait(gc,&aodev->ds,
device_backend_callback,
>> +                                 state_path, XenbusStateInitWait,
>> +                                 LIBXL_INIT_TIMEOUT * 1000);
>
> Another unneeded _init.

Ok, I thought that you need to call libxl__ev_devstate_init before
libxl__ev_devstate_wait? I just saw that _wait performs the _init itself
(but without calling _init).

Can''t we remove _init, if it''s not needed? Having and _init
function
makes people thing they have to use it, and the comments doesn''t say
anything about _wait calling _init itself.

> I won''t comment on any more of these I find.