[PATCH][RFC] guarantee that udi get generated before process FDI

David Zeuthen david at fubar.dk
Thu Dec 21 11:02:33 PST 2006


On Wed, 2006-12-20 at 16:25 +0100, Danny Kukawka wrote:
> Hi,
> 
> this patch is a result of discussions at IRC with Sergey Lapin and David. 
> 
> The problem is: in the most cases the udi of a device get generated fist after 
> the policy and information FDI files get processed. Because of this you can't 
> use FDI rules to match a special device udi (the udi of the device is 
> something like '/org/freedesktop/Hal/devices/temp/100' until a correct udi 
> get generated) e.g. to spawn a child device because the rule get never 
> proccessed again for this device.
> 
> To fix this I moved the generation of the udi before the calls to process the 
> policy and information fdi-files. The mean also to move some 
> hal_util_callout_device_add() calls (to process the FDI files after the 
> call).
> 
> I changed this for all backends, but could test this only for Linux. I'm not 
> complete shure if this new workflow maybe cause some adverse effects, but the 
> output of lshal look the same as before on some of my test machines.
> 
> Please check the patch and comment.

This looks good to me and, for the record, it's already what we do with
block devices, see add_blockdev_probing_helper_done() in blockdev.c in
hald/linux. So, the device discovery process would be

 1. device is added => new device object
 2. information is merged to the device object by reading data
    from the device (in-process in hald and via helpers)
 3. udi is computed
 4. information is merged from device information files
 5. callouts are run
 6. device object is announced

Your patch for the Solaris bits looks wrong to me

> --- a/hald/solaris/devinfo_storage.c
> +++ b/hald/solaris/devinfo_storage.c
> @@ -1172,11 +1172,11 @@ devinfo_storage_probing_done (HalDevice 
>  
>         devinfo_storage_set_nicknames (d);
>  
> -        /* Merge properties from .fdi files */
> +       hal_util_callout_device_add (d, devinfo_callouts_add_done,
> end_token, NULL);
> +        
> +       /* Merge properties from .fdi files */
>          di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
>          di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
> -
> -       hal_util_callout_device_add (d, devinfo_callouts_add_done,
> end_token, NULL);

Otherwise it looks good though I haven't tried it. Thanks.

     David




More information about the hal mailing list