[libosinfo PATCH 10/18] loader: Deal with "removed" devices for an OS

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

 



Let's make the loader aware of the "removed" attribute that can be 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 1f93fc4..6240fd1 100644
--- a/osinfo/osinfo_devicelink.h
+++ b/osinfo/osinfo_devicelink.h
@@ -46,6 +46,7 @@ typedef struct _OsinfoDeviceLinkPrivate OsinfoDeviceLinkPrivate;
 
 #define OSINFO_DEVICELINK_PROP_DRIVER   "driver"
 #define OSINFO_DEVICELINK_PROP_DEPRECATED   "deprecated"
+#define OSINFO_DEVICELINK_PROP_REMOVED      "removed"
 
 /* object */
 struct _OsinfoDeviceLink
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 2198822..ed1f1d3 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -646,6 +646,15 @@ static void osinfo_loader_device_link(OsinfoLoader *loader,
             xmlFree(deprecated);
         }
 
+        gchar *removed = (gchar *)xmlGetProp(related[i],
+                                             BAD_CAST OSINFO_DEVICELINK_PROP_REMOVED);
+        if (removed != NULL) {
+            osinfo_entity_set_param_boolean(OSINFO_ENTITY(devlink),
+                                            OSINFO_DEVICELINK_PROP_REMOVED,
+                                            g_str_equal(removed, "true") ? TRUE : FALSE);
+            xmlFree(removed);
+        }
+
         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