[virt-tools-list] [libosinfo 03/10] os: API to add & list device drivers

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Wed Dec 5 14:02:59 UTC 2012


From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>

---
 osinfo/libosinfo.syms |  3 +++
 osinfo/osinfo_os.c    | 29 +++++++++++++++++++++++++++++
 osinfo/osinfo_os.h    |  3 +++
 3 files changed, 35 insertions(+)

diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 0f1d751..1d7b983 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -358,6 +358,9 @@ LIBOSINFO_0.2.2 {
 	osinfo_install_script_get_path_format;
 
 	osinfo_install_script_get_product_key_format;
+
+	osinfo_os_get_device_drivers;
+	osinfo_os_add_device_driver;
 } LIBOSINFO_0.2.1;
 
 /* Symbols in next release...
diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 18a1458..b91c4d9 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -54,6 +54,8 @@ struct _OsinfoOsPrivate
     OsinfoResourcesList *recommended;
 
     OsinfoInstallScriptList *scripts;
+
+    OsinfoDeviceDriverList *device_drivers;
 };
 
 struct _OsinfoOsDeviceLink {
@@ -114,6 +116,8 @@ osinfo_os_finalize (GObject *object)
 
     g_object_unref(os->priv->scripts);
 
+    g_object_unref(os->priv->device_drivers);
+
     /* Chain up to the parent class */
     G_OBJECT_CLASS (osinfo_os_parent_class)->finalize (object);
 }
@@ -179,6 +183,7 @@ osinfo_os_init (OsinfoOs *os)
     os->priv->minimum = osinfo_resourceslist_new ();
     os->priv->recommended = osinfo_resourceslist_new ();
     os->priv->scripts = osinfo_install_scriptlist_new ();
+    os->priv->device_drivers = osinfo_device_driverlist_new ();
 }
 
 /**
@@ -572,6 +577,30 @@ void osinfo_os_add_install_script(OsinfoOs *os, OsinfoInstallScript *script)
     osinfo_list_add(OSINFO_LIST(os->priv->scripts), OSINFO_ENTITY(script));
 }
 
+/**
+ * osinfo_os_get_device_drivers:
+ * @os: an operating system
+ *
+ * Gets list of all available device drivers for OS @os.
+ *
+ * Returns: (transfer none): A list of device drivers
+ */
+OsinfoDeviceDriverList *osinfo_os_get_device_drivers(OsinfoOs *os)
+{
+    g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
+
+    return os->priv->device_drivers;
+}
+
+void osinfo_os_add_device_driver(OsinfoOs *os, OsinfoDeviceDriver *driver)
+{
+    g_return_if_fail(OSINFO_IS_OS(os));
+    g_return_if_fail(OSINFO_IS_DEVICE_DRIVER(driver));
+
+    osinfo_list_add(OSINFO_LIST(os->priv->device_drivers),
+                    OSINFO_ENTITY(driver));
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h
index 4ca9c68..ae4f0e9 100644
--- a/osinfo/osinfo_os.h
+++ b/osinfo/osinfo_os.h
@@ -105,6 +105,9 @@ OsinfoInstallScript *osinfo_os_find_install_script(OsinfoOs *os, const gchar *pr
 OsinfoInstallScriptList *osinfo_os_get_install_script_list(OsinfoOs *os);
 void osinfo_os_add_install_script(OsinfoOs *os, OsinfoInstallScript *script);
 
+OsinfoDeviceDriverList *osinfo_os_get_device_drivers(OsinfoOs *os);
+void osinfo_os_add_device_driver(OsinfoOs *os, OsinfoDeviceDriver *driver);
+
 #endif /* __OSINFO_OS_H__ */
 /*
  * Local variables:
-- 
1.8.0.1




More information about the virt-tools-list mailing list