[Libosinfo] [libosinfo PATCH v2 09/15] os: Add osinfo_os_get_device_links_internal()

Fabiano Fidêncio fidencio at redhat.com
Mon Nov 12 10:30:56 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_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, 21 insertions(+), 11 deletions(-)

diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 42fa2d8..217e62e 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -327,17 +327,11 @@ OsinfoDeviceList *osinfo_os_get_devices_by_property(OsinfoOs *os,
     return devices;
 }
 
-/**
- * osinfo_os_get_device_links:
- * @os: an operating system
- * @filter: (allow-none)(transfer none): an optional device property filter
- *
- * Get all devices matching a given filter. The filter
- * matches against the links, not the devices.
- *
- * Returns: (transfer full): A list of device links
- */
-OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoFilter *filter)
+
+static OsinfoDeviceLinkList *
+osinfo_os_get_device_links_internal(OsinfoOs *os,
+                                    OsinfoFilter *filter,
+                                    gboolean include_removed)
 {
     g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
     g_return_val_if_fail(!filter || OSINFO_IS_FILTER(filter), NULL);
@@ -360,6 +354,22 @@ OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoFilter *fil
 }
 
 
+/**
+ * osinfo_os_get_device_links:
+ * @os: an operating system
+ * @filter: (allow-none)(transfer none): an optional device property filter
+ *
+ * Get all devices matching a given filter. The filter
+ * matches against the links, not the devices.
+ *
+ * Returns: (transfer full): A list of device links
+ */
+OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoFilter *filter)
+{
+    return osinfo_os_get_device_links_internal(os, filter, FALSE);
+}
+
+
 struct GetAllDeviceLinksData {
     OsinfoFilter *filter;
     OsinfoDeviceLinkList *device_links;
-- 
2.19.1




More information about the Libosinfo mailing list