[Libosinfo] [libosinfo 3/3] Implement osinfo_platform_get_all_devices()

Christophe Fergeau cfergeau at redhat.com
Wed Apr 3 15:38:36 UTC 2013


On Tue, Apr 02, 2013 at 05:39:47PM +0300, Zeeshan Ali (Khattak) wrote:
> On Tue, Apr 2, 2013 at 12:17 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> > +static void get_all_devices_cb(OsinfoProduct *product, gpointer user_data)
> > +{
> > +    OsinfoDeviceList *devices;
> > +    OsinfoList *tmp_list;
> > +    struct GetAllDevicesData *foreach_data = (struct GetAllDevicesData *)user_data;
> > +
> > +    g_return_if_fail(OSINFO_IS_PLATFORM(product));
> > +
> > +    devices = osinfo_platform_get_devices(OSINFO_PLATFORM(product),
> > +                                          foreach_data->filter);
> > +    tmp_list = osinfo_list_new_union(OSINFO_LIST(foreach_data->devices),
> > +                                     OSINFO_LIST(devices));
> > +    g_object_unref(foreach_data->devices);
> > +    g_object_unref(devices);
> > +    foreach_data->devices = OSINFO_DEVICELIST(tmp_list);
> > +}
> 
> Some docs would be nice.

About to send a patch adding this.

> 
> > +OsinfoDeviceList *osinfo_platform_get_all_devices(OsinfoPlatform *platform,
> > +                                                  OsinfoFilter *filter)
> > +{
> > +    struct GetAllDevicesData foreach_data = {
> > +        .filter = filter,
> > +        .devices = osinfo_devicelist_new()
> > +    };
> > +
> > +    osinfo_product_foreach_related(OSINFO_PRODUCT(platform),
> > +                                   OSINFO_PRODUCT_FOREACH_FLAG_UPGRADES,
> > +                                   get_all_devices_cb,
> > +                                   &foreach_data);
> 
> Seems in _os_get_all_devices() we are looking for  `DERIVES_FROM |
> CLONES`, Some reasoning for this contrast would be nice.

First note, this was missing OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM
Reason is that the platforms we currently have use <upgrades> and
<derives-from>.
OSes use <clones> in addition to these 2, which I don't think make sense
for platforms. OSes don't follow <upgrades> as devices working for OS N-1
may no longer work in OS N.

I'm not sure if you want the reasoning in answer to this email, or added to
some place in the commit?

Once again, sorry for missing this review before pushing,

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20130403/853a0416/attachment.sig>


More information about the Libosinfo mailing list