[libosinfo PATCH 07/18] loader: Deal with "deprecated" devices for an OS

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

 



Let's make the loader aware of the "deprecated" attribute that can set
for a device linked from an OS entry.

https://gitlab.com/libosinfo/osinfo-db/issues/13

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 osinfo/osinfo_devicelink.h | 1 +
 osinfo/osinfo_loader.c     | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/osinfo/osinfo_devicelink.h b/osinfo/osinfo_devicelink.h
index 1ca6402..1f93fc4 100644
--- a/osinfo/osinfo_devicelink.h
+++ b/osinfo/osinfo_devicelink.h
@@ -45,6 +45,7 @@ typedef struct _OsinfoDeviceLinkClass   OsinfoDeviceLinkClass;
 typedef struct _OsinfoDeviceLinkPrivate OsinfoDeviceLinkPrivate;
 
 #define OSINFO_DEVICELINK_PROP_DRIVER   "driver"
+#define OSINFO_DEVICELINK_PROP_DEPRECATED   "deprecated"
 
 /* object */
 struct _OsinfoDeviceLink
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index d1bf61d..2198822 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -637,6 +637,15 @@ static void osinfo_loader_device_link(OsinfoLoader *loader,
             devlink = osinfo_deployment_add_device(OSINFO_DEPLOYMENT(entity), dev);
         }
 
+        gchar *deprecated = (gchar *)xmlGetProp(related[i],
+                                                BAD_CAST OSINFO_DEVICELINK_PROP_DEPRECATED);
+        if (deprecated != NULL) {
+            osinfo_entity_set_param_boolean(OSINFO_ENTITY(devlink),
+                                            OSINFO_DEVICELINK_PROP_DEPRECATED,
+                                            g_str_equal(deprecated, "true") ? TRUE : FALSE);
+            xmlFree(deprecated);
+        }
+
         xmlNodePtr saved = ctxt->node;
         ctxt->node = related[i];
         osinfo_loader_entity(loader, OSINFO_ENTITY(devlink), keys, ctxt, root, err);
-- 
2.19.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux