[libosinfo PATCH v2 08/15] os: Add osinfo_os_get_devices_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_devices() 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 | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index ec1d679..42fa2d8 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -204,16 +204,10 @@ OsinfoOs *osinfo_os_new(const gchar *id)
 }
 
 
-/**
- * osinfo_os_get_devices:
- * @os: an operating system
- * @filter: (allow-none)(transfer none): an optional device property filter
- *
- * Get all devices matching a given filter
- *
- * Returns: (transfer full): A list of devices
- */
-OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter)
+static OsinfoDeviceList *
+osinfo_os_get_devices_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);
@@ -235,6 +229,21 @@ OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter)
     return newList;
 }
 
+
+/**
+ * osinfo_os_get_devices:
+ * @os: an operating system
+ * @filter: (allow-none)(transfer none): an optional device property filter
+ *
+ * Get all devices matching a given filter
+ *
+ * Returns: (transfer full): A list of devices
+ */
+OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter)
+{
+    return osinfo_os_get_devices_internal(os, filter, FALSE);
+}
+
 struct GetAllDevicesData {
     OsinfoFilter *filter;
     OsinfoDeviceList *devices;
-- 
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