[libosinfo PATCH 12/18] os: Add osinfo_os_get_device_links_internal()

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

 



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@xxxxxxxxxx>
---
 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 f5288c2..bb4b5df 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

_______________________________________________
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