[Libosinfo] [libosinfo PATCH v2 10/15] os: Add osinfo_os_get_all_device_links_internal()

Fabiano Fidêncio fidencio at redhat.com
Mon Nov 12 10:30:57 UTC 2018


The addition of this new function is basically preparing the ground for
the changes that are coming in the next commits where
osinfo_os_get_all_device_links() will have to deal with "removed"
devices.

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

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_os.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 217e62e..687e3ed 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -393,18 +393,10 @@ static void get_all_device_links_cb(OsinfoProduct *product, gpointer user_data)
     foreach_data->device_links = OSINFO_DEVICELINKLIST(tmp_list);
 }
 
-/**
- * osinfo_os_get_all_device_links:
- * @os: an operating system
- * @filter: (allow-none)(transfer none): an optional device property filter
- *
- * Get all devicelinks matching a given filter but unlike
- * osinfo_os_get_device_links this function also retrieves devices from all
- * derived and cloned operating systems.
- *
- * Returns: (transfer full): A list of OsinfoDeviceLink
- */
-OsinfoDeviceLinkList *osinfo_os_get_all_device_links(OsinfoOs *os, OsinfoFilter *filter)
+static OsinfoDeviceLinkList *
+osinfo_os_get_all_device_links_internal(OsinfoOs *os,
+                                        OsinfoFilter *filter,
+                                        gboolean include_removed)
 {
     struct GetAllDeviceLinksData foreach_data = {
         .filter = filter,
@@ -420,6 +412,22 @@ OsinfoDeviceLinkList *osinfo_os_get_all_device_links(OsinfoOs *os, OsinfoFilter
     return foreach_data.device_links;
 }
 
+/**
+ * osinfo_os_get_all_device_links:
+ * @os: an operating system
+ * @filter: (allow-none)(transfer none): an optional device property filter
+ *
+ * Get all devicelinks matching a given filter but unlike
+ * osinfo_os_get_device_links this function also retrieves devices from all
+ * derived and cloned operating systems.
+ *
+ * Returns: (transfer full): A list of OsinfoDeviceLink
+ */
+OsinfoDeviceLinkList *osinfo_os_get_all_device_links(OsinfoOs *os, OsinfoFilter *filter)
+{
+    return osinfo_os_get_all_device_links_internal(os, filter, FALSE);
+}
+
 /**
  * osinfo_os_add_device:
  * @os: an operating system
-- 
2.19.1




More information about the Libosinfo mailing list