summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2010-09-02 10:40:12 +0100
committerDaniel P. Berrange <berrange@redhat.com>2010-09-02 10:48:15 +0100
commiteafe748ae1aa1fe46357b698f90ed5dc98d03971 (patch)
tree5274be8a9f83a50a3f122759c34b4bbdfc59b7fb
parent2e0120280a2eee32a7097f1b62d4d729c0ded413 (diff)
Rename 'OsinfoHypervisor' to 'OsinfoPlatform'
Not all virtualization technologies are hypervisors. Rename the OsinfoHypervisor object to the more general term OsinfoPlatform. * data/libosinfo-dummy-data.xml: Rename 'hypervisor' element to 'platform' * docs/reference/Libosinfo-docs.xml, docs/reference/Libosinfo-docs.xml docs/reference/Libosinfo.types: Update docs for new object name * examples/demo.js, examples/demo.py: Update for object name * osinfo/osinfo_hypervisor.c, osinfo/osinfo_hypervisor.h, osinfo/osinfo_hypervisorlist.c, osinfo/osinfo_hypervisorlist.h, osinfo/osinfo_platform.h, osinfo/osinfo_platformlist.c, osinfo/osinfo_platformlist.h, osinfo/osinfo_platform.c, osinfo/osinfo.h, osinfo/osinfo_db.c , osinfo/osinfo_db.h, osinfo/osinfo_device.c, osinfo/osinfo_devicelink.c, osinfo/osinfo_devicelink.c, osinfo/osinfo_os.h, osinfo/osinfo_loader.c, osinfo/libosinfo.syms, osinfo/Makefile.am: Rename OsinfoHypervisor to OsinfoPlatform * test/Makefile.am, test/test-os.c, test/test-hypervisor.c, test/test-platform.c, test/test-db.c: Update for object name
-rw-r--r--data/libosinfo-dummy-data.xml20
-rw-r--r--docs/reference/Libosinfo-docs.xml4
-rw-r--r--docs/reference/Libosinfo-sections.txt72
-rw-r--r--docs/reference/Libosinfo.types4
-rwxr-xr-xexamples/demo.js2
-rwxr-xr-xexamples/demo.py2
-rw-r--r--osinfo/Makefile.am8
-rw-r--r--osinfo/libosinfo.syms28
-rw-r--r--osinfo/osinfo.h4
-rw-r--r--osinfo/osinfo_db.c42
-rw-r--r--osinfo/osinfo_db.h14
-rw-r--r--osinfo/osinfo_device.c4
-rw-r--r--osinfo/osinfo_devicelink.c4
-rw-r--r--osinfo/osinfo_hypervisor.h83
-rw-r--r--osinfo/osinfo_hypervisorlist.c165
-rw-r--r--osinfo/osinfo_hypervisorlist.h82
-rw-r--r--osinfo/osinfo_loader.c70
-rw-r--r--osinfo/osinfo_os.c92
-rw-r--r--osinfo/osinfo_os.h10
-rw-r--r--osinfo/osinfo_platform.c (renamed from osinfo/osinfo_hypervisor.c)84
-rw-r--r--osinfo/osinfo_platform.h83
-rw-r--r--osinfo/osinfo_platformlist.c165
-rw-r--r--osinfo/osinfo_platformlist.h82
-rw-r--r--test/Makefile.am16
-rw-r--r--test/osinfo.suppression4
-rw-r--r--test/test-db.c44
-rw-r--r--test/test-loader.c4
-rw-r--r--test/test-os.c8
-rw-r--r--test/test-platform.c (renamed from test/test-hypervisor.c)36
-rw-r--r--test/test-platformlist.c (renamed from test/test-hypervisorlist.c)56
30 files changed, 646 insertions, 646 deletions
diff --git a/data/libosinfo-dummy-data.xml b/data/libosinfo-dummy-data.xml
index 257cb3f..1f28a49 100644
--- a/data/libosinfo-dummy-data.xml
+++ b/data/libosinfo-dummy-data.xml
@@ -39,7 +39,7 @@
<name>3CRPAG175 Wireless PC Card</name>
</device>
-<hypervisor id="http://qemu.org/qemu-kvm-0.11.0">
+<platform id="http://qemu.org/qemu-kvm-0.11.0">
<name>KVM</name>
<version>0.11.0</version>
<updates-version>0.10.0</updates-version>
@@ -51,9 +51,9 @@
<device id="http://pci-ids.ucw.cz/read/PC/1274/1371/80864541" />
<device id="http://pci-ids.ucw.cz/read/PC/a727/0013" />
</devices>
-</hypervisor>
+</platform>
-<hypervisor id="http://bits.xensource.com/oss-xen/release/3.4.1">
+<platform id="http://bits.xensource.com/oss-xen/release/3.4.1">
<name>Xen</name>
<version>3.4.1</version>
<devices>
@@ -61,7 +61,7 @@
<device id="http://pci-ids.ucw.cz/read/PC/1274/1371/80864541" />
<device id="http://pci-ids.ucw.cz/read/PC/a727/0013" />
</devices>
-</hypervisor>
+</platform>
<os id="http://fedoraproject.org/fedora-11">
<upgrades id="http://fedoraproject.org/fedora-10" />
@@ -70,7 +70,7 @@
<vendor>Fedora Project</vendor>
<vendor>Red Hat</vendor>
- <hypervisor id="http://qemu.org/qemu-kvm-0.11.0">
+ <platform id="http://qemu.org/qemu-kvm-0.11.0">
<devices>
<device id="http://pci-ids.ucw.cz/read/PC/1274/5000">
<driver>es1370</driver>
@@ -85,9 +85,9 @@
<driver>3com</driver>
</device>
</devices>
- </hypervisor>
+ </platform>
- <!-- Device support for unspecified hypervisor -->
+ <!-- Device support for unspecified platform -->
<devices>
<device id="http://pci-ids.ucw.cz/read/PC/1002/4382">
<driver>es1391</driver>
@@ -103,7 +103,7 @@
<name>Fedora 10</name>
<vendor>Fedora Project</vendor>
- <hypervisor id="http://qemu.org/qemu-kvm-0.11.0">
+ <platform id="http://qemu.org/qemu-kvm-0.11.0">
<devices>
<device id="http://pci-ids.ucw.cz/read/PC/1002/4382">
<driver>ac97</driver>
@@ -115,9 +115,9 @@
<driver>3com</driver>
</device>
</devices>
- </hypervisor>
+ </platform>
- <!-- Device support for unspecified hypervisor -->
+ <!-- Device support for unspecified platform -->
<devices>
<device id="http://pci-ids.ucw.cz/read/PC/1274/5000">
<driver>ac97</driver>
diff --git a/docs/reference/Libosinfo-docs.xml b/docs/reference/Libosinfo-docs.xml
index 1b6c92b..76f9451 100644
--- a/docs/reference/Libosinfo-docs.xml
+++ b/docs/reference/Libosinfo-docs.xml
@@ -22,8 +22,8 @@
<xi:include href="xml/osinfo_devicelinklist.xml"/>
<xi:include href="xml/osinfo_entity.xml"/>
<xi:include href="xml/osinfo_filter.xml"/>
- <xi:include href="xml/osinfo_hypervisor.xml"/>
- <xi:include href="xml/osinfo_hypervisorlist.xml"/>
+ <xi:include href="xml/osinfo_platform.xml"/>
+ <xi:include href="xml/osinfo_platformlist.xml"/>
<xi:include href="xml/osinfo_list.xml"/>
<xi:include href="xml/osinfo_loader.xml"/>
<xi:include href="xml/osinfo_os.xml"/>
diff --git a/docs/reference/Libosinfo-sections.txt b/docs/reference/Libosinfo-sections.txt
index 216ad18..0ad7783 100644
--- a/docs/reference/Libosinfo-sections.txt
+++ b/docs/reference/Libosinfo-sections.txt
@@ -5,14 +5,14 @@ OsinfoDb
OsinfoDbClass
OsinfoDbPrivate
osinfo_db_new
-osinfo_db_get_hypervisor
+osinfo_db_get_platform
osinfo_db_get_device
osinfo_db_get_os
osinfo_db_get_os_list
-osinfo_db_get_hypervisor_list
+osinfo_db_get_platform_list
osinfo_db_get_device_list
osinfo_db_add_os
-osinfo_db_add_hypervisor
+osinfo_db_add_platform
osinfo_db_add_device
osinfo_db_unique_values_for_property_in_os
osinfo_db_unique_values_for_property_in_hv
@@ -100,23 +100,23 @@ OSINFO_OS_GET_CLASS
</SECTION>
<SECTION>
-<FILE>osinfo_hypervisor</FILE>
-<TITLE>OsinfoHypervisor</TITLE>
-OsinfoHypervisor
-OsinfoHypervisorClass
-OsinfoHypervisorPrivate
-osinfo_hypervisor_new
-osinfo_hypervisor_get_devices
-osinfo_hypervisor_get_device_links
-osinfo_hypervisor_add_device
+<FILE>osinfo_platform</FILE>
+<TITLE>OsinfoPlatform</TITLE>
+OsinfoPlatform
+OsinfoPlatformClass
+OsinfoPlatformPrivate
+osinfo_platform_new
+osinfo_platform_get_devices
+osinfo_platform_get_device_links
+osinfo_platform_add_device
<SUBSECTION Standard>
-OSINFO_HYPERVISOR
-OSINFO_IS_HYPERVISOR
-OSINFO_TYPE_HYPERVISOR
-osinfo_hypervisor_get_type
-OSINFO_HYPERVISOR_CLASS
-OSINFO_IS_HYPERVISOR_CLASS
-OSINFO_HYPERVISOR_GET_CLASS
+OSINFO_PLATFORM
+OSINFO_IS_PLATFORM
+OSINFO_TYPE_PLATFORM
+osinfo_platform_get_type
+OSINFO_PLATFORM_CLASS
+OSINFO_IS_PLATFORM_CLASS
+OSINFO_PLATFORM_GET_CLASS
</SECTION>
<SECTION>
@@ -250,24 +250,24 @@ OSINFO_OSLIST_GET_CLASS
</SECTION>
<SECTION>
-<FILE>osinfo_hypervisorlist</FILE>
-<TITLE>OsinfoHypervisorList</TITLE>
-OsinfoHypervisorList
-OsinfoHypervisorListClass
-OsinfoHypervisorListPrivate
-osinfo_hypervisorlist_new
-osinfo_hypervisorlist_new_copy
-osinfo_hypervisorlist_new_filtered
-osinfo_hypervisorlist_new_intersection
-osinfo_hypervisorlist_new_union
+<FILE>osinfo_platformlist</FILE>
+<TITLE>OsinfoPlatformList</TITLE>
+OsinfoPlatformList
+OsinfoPlatformListClass
+OsinfoPlatformListPrivate
+osinfo_platformlist_new
+osinfo_platformlist_new_copy
+osinfo_platformlist_new_filtered
+osinfo_platformlist_new_intersection
+osinfo_platformlist_new_union
<SUBSECTION Standard>
-OSINFO_HYPERVISORLIST
-OSINFO_IS_HYPERVISORLIST
-OSINFO_TYPE_HYPERVISORLIST
-osinfo_hypervisorlist_get_type
-OSINFO_HYPERVISORLIST_CLASS
-OSINFO_IS_HYPERVISORLIST_CLASS
-OSINFO_HYPERVISORLIST_GET_CLASS
+OSINFO_PLATFORMLIST
+OSINFO_IS_PLATFORMLIST
+OSINFO_TYPE_PLATFORMLIST
+osinfo_platformlist_get_type
+OSINFO_PLATFORMLIST_CLASS
+OSINFO_IS_PLATFORMLIST_CLASS
+OSINFO_PLATFORMLIST_GET_CLASS
</SECTION>
<SECTION>
diff --git a/docs/reference/Libosinfo.types b/docs/reference/Libosinfo.types
index 94d0617..e90b674 100644
--- a/docs/reference/Libosinfo.types
+++ b/docs/reference/Libosinfo.types
@@ -3,8 +3,8 @@ osinfo_device_get_type
osinfo_devicelist_get_type
osinfo_entity_get_type
osinfo_filter_get_type
-osinfo_hypervisor_get_type
-osinfo_hypervisorlist_get_type
+osinfo_platform_get_type
+osinfo_platformlist_get_type
osinfo_list_get_type
osinfo_loader_get_type
osinfo_os_get_type
diff --git a/examples/demo.js b/examples/demo.js
index 16c1989..070c880 100755
--- a/examples/demo.js
+++ b/examples/demo.js
@@ -38,7 +38,7 @@ var drvclass = "network"
//var drvclass = "audio"
var os = db.get_os(osid)
-var hv = db.get_hypervisor(hvid)
+var hv = db.get_platform(hvid)
var filter = new osinfo.Filter()
filter.add_constraint("class", drvclass)
diff --git a/examples/demo.py b/examples/demo.py
index 10a055d..a361db1 100755
--- a/examples/demo.py
+++ b/examples/demo.py
@@ -34,7 +34,7 @@ drvclass = "network"
#drvclass = "audio"
os = db.get_os(osid)
-hv = db.get_hypervisor(hvid)
+hv = db.get_platform(hvid)
fltr = osinfo.Filter()
fltr.add_constraint("class", drvclass)
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 94dad54..4c6650e 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -50,8 +50,8 @@ libosinfo_1_0_include_HEADERS = \
osinfo_devicelinklist.h \
osinfo_entity.h \
osinfo_filter.h \
- osinfo_hypervisor.h \
- osinfo_hypervisorlist.h \
+ osinfo_platform.h \
+ osinfo_platformlist.h \
osinfo_list.h \
osinfo_os.h \
osinfo_osfilter.h \
@@ -65,8 +65,8 @@ libosinfo_1_0_la_SOURCES = \
osinfo_devicelink.c \
osinfo_devicelist.c \
osinfo_devicelinklist.c \
- osinfo_hypervisor.c \
- osinfo_hypervisorlist.c \
+ osinfo_platform.c \
+ osinfo_platformlist.c \
osinfo_osfilter.c \
osinfo_oslist.c \
osinfo_os.c \
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index ed070cb..1a9afc1 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -2,14 +2,14 @@ LIBOSINFO_0.0.1 {
global:
osinfo_db_get_type;
osinfo_db_new;
- osinfo_db_get_hypervisor;
+ osinfo_db_get_platform;
osinfo_db_get_device;
osinfo_db_get_os;
osinfo_db_get_os_list;
- osinfo_db_get_hypervisor_list;
+ osinfo_db_get_platform_list;
osinfo_db_get_device_list;
osinfo_db_add_os;
- osinfo_db_add_hypervisor;
+ osinfo_db_add_platform;
osinfo_db_add_device;
osinfo_db_unique_values_for_property_in_os;
osinfo_db_unique_values_for_property_in_hv;
@@ -48,17 +48,17 @@ LIBOSINFO_0.0.1 {
osinfo_filter_get_constraint_keys;
osinfo_filter_get_constraint_values;
osinfo_filter_matches;
- osinfo_hypervisor_get_type;
- osinfo_hypervisor_new;
- osinfo_hypervisor_get_devices;
- osinfo_hypervisor_get_device_links;
- osinfo_hypervisor_add_device;
- osinfo_hypervisorlist_get_type;
- osinfo_hypervisorlist_new;
- osinfo_hypervisorlist_new_copy;
- osinfo_hypervisorlist_new_filtered;
- osinfo_hypervisorlist_new_intersection;
- osinfo_hypervisorlist_new_union;
+ osinfo_platform_get_type;
+ osinfo_platform_new;
+ osinfo_platform_get_devices;
+ osinfo_platform_get_device_links;
+ osinfo_platform_add_device;
+ osinfo_platformlist_get_type;
+ osinfo_platformlist_new;
+ osinfo_platformlist_new_copy;
+ osinfo_platformlist_new_filtered;
+ osinfo_platformlist_new_intersection;
+ osinfo_platformlist_new_union;
osinfo_list_get_type;
osinfo_list_get_length;
osinfo_list_get_nth;
diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h
index 408805e..8d554c5 100644
--- a/osinfo/osinfo.h
+++ b/osinfo/osinfo.h
@@ -32,8 +32,8 @@
#include <osinfo/osinfo_devicelink.h>
#include <osinfo/osinfo_devicelist.h>
#include <osinfo/osinfo_devicelinklist.h>
-#include <osinfo/osinfo_hypervisorlist.h>
-#include <osinfo/osinfo_hypervisor.h>
+#include <osinfo/osinfo_platformlist.h>
+#include <osinfo/osinfo_platform.h>
#include <osinfo/osinfo_oslist.h>
#include <osinfo/osinfo_os.h>
#include <osinfo/osinfo_osfilter.h>
diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index 18bba0c..8694466 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -40,7 +40,7 @@ G_DEFINE_TYPE (OsinfoDb, osinfo_db, G_TYPE_OBJECT);
struct _OsinfoDbPrivate
{
OsinfoDeviceList *devices;
- OsinfoHypervisorList *hypervisors;
+ OsinfoPlatformList *platforms;
OsinfoOsList *oses;
};
@@ -52,7 +52,7 @@ osinfo_db_finalize (GObject *object)
OsinfoDb *db = OSINFO_DB (object);
g_object_unref(db->priv->devices);
- g_object_unref(db->priv->hypervisors);
+ g_object_unref(db->priv->platforms);
g_object_unref(db->priv->oses);
/* Chain up to the parent class */
@@ -79,7 +79,7 @@ osinfo_db_init (OsinfoDb *db)
db->priv = priv = OSINFO_DB_GET_PRIVATE(db);
db->priv->devices = osinfo_devicelist_new();
- db->priv->hypervisors = osinfo_hypervisorlist_new();
+ db->priv->platforms = osinfo_platformlist_new();
db->priv->oses = osinfo_oslist_new();
}
@@ -97,18 +97,18 @@ OsinfoDb *osinfo_db_new(void)
}
/**
- * osinfo_db_get_hypervisor:
+ * osinfo_db_get_platform:
* @db: the database
- * @id: the unique hypervisor identifier
+ * @id: the unique platform identifier
*
- * Returns: (transfer none): the hypervisor, or NULL if none is found
+ * Returns: (transfer none): the platform, or NULL if none is found
*/
-OsinfoHypervisor *osinfo_db_get_hypervisor(OsinfoDb *db, const gchar *id)
+OsinfoPlatform *osinfo_db_get_platform(OsinfoDb *db, const gchar *id)
{
g_return_val_if_fail(OSINFO_IS_DB(db), NULL);
g_return_val_if_fail(id != NULL, NULL);
- return OSINFO_HYPERVISOR(osinfo_list_find_by_id(OSINFO_LIST(db->priv->hypervisors), id));
+ return OSINFO_PLATFORM(osinfo_list_find_by_id(OSINFO_LIST(db->priv->platforms), id));
}
/**
@@ -156,16 +156,16 @@ OsinfoOsList *osinfo_db_get_os_list(OsinfoDb *db)
}
/**
- * osinfo_db_get_hypervisor_list:
+ * osinfo_db_get_platform_list:
* @db: the database
*
- * Returns: (transfer full): the list of hypervisors
+ * Returns: (transfer full): the list of platforms
*/
-OsinfoHypervisorList *osinfo_db_get_hypervisor_list(OsinfoDb *db)
+OsinfoPlatformList *osinfo_db_get_platform_list(OsinfoDb *db)
{
g_return_val_if_fail(OSINFO_IS_DB(db), NULL);
- return osinfo_hypervisorlist_new_copy(db->priv->hypervisors);
+ return osinfo_platformlist_new_copy(db->priv->platforms);
}
/**
@@ -198,17 +198,17 @@ void osinfo_db_add_os(OsinfoDb *db, OsinfoOs *os)
/**
- * osinfo_db_add_hypervisor:
+ * osinfo_db_add_platform:
* @db: the database
- * @hv: (transfer none): an hypervisor
+ * @platform: (transfer none): an platform
*
*/
-void osinfo_db_add_hypervisor(OsinfoDb *db, OsinfoHypervisor *hv)
+void osinfo_db_add_platform(OsinfoDb *db, OsinfoPlatform *platform)
{
g_return_if_fail(OSINFO_IS_DB(db));
- g_return_if_fail(OSINFO_IS_HYPERVISOR(hv));
+ g_return_if_fail(OSINFO_IS_PLATFORM(platform));
- osinfo_list_add(OSINFO_LIST(db->priv->hypervisors), OSINFO_ENTITY(hv));
+ osinfo_list_add(OSINFO_LIST(db->priv->platforms), OSINFO_ENTITY(platform));
}
@@ -293,21 +293,21 @@ GList *osinfo_db_unique_values_for_property_in_os(OsinfoDb *db, const gchar *pro
/**
- * osinfo_db_unique_values_for_property_in_hv:
+ * osinfo_db_unique_values_for_property_in_platform:
* @db: the database
* @propName: a property name
*
* Get all unique values for a named property amongst all
- * hypervisors in the database
+ * platforms in the database
*
* Returns: (transfer container)(element-type utf8): a list of strings
*/
-GList *osinfo_db_unique_values_for_property_in_hv(OsinfoDb *db, const gchar *propName)
+GList *osinfo_db_unique_values_for_property_in_platform(OsinfoDb *db, const gchar *propName)
{
g_return_val_if_fail(OSINFO_IS_DB(db), NULL);
g_return_val_if_fail(propName != NULL, NULL);
- return osinfo_db_unique_values_for_property_in_entity(OSINFO_LIST(db->priv->hypervisors), propName);
+ return osinfo_db_unique_values_for_property_in_entity(OSINFO_LIST(db->priv->platforms), propName);
}
diff --git a/osinfo/osinfo_db.h b/osinfo/osinfo_db.h
index c7a1e4c..1f93ac2 100644
--- a/osinfo/osinfo_db.h
+++ b/osinfo/osinfo_db.h
@@ -23,10 +23,10 @@
*/
#include <glib-object.h>
-#include <osinfo/osinfo_hypervisor.h>
+#include <osinfo/osinfo_platform.h>
#include <osinfo/osinfo_os.h>
#include <osinfo/osinfo_device.h>
-#include <osinfo/osinfo_hypervisorlist.h>
+#include <osinfo/osinfo_platformlist.h>
#include <osinfo/osinfo_oslist.h>
#include <osinfo/osinfo_devicelist.h>
@@ -73,23 +73,23 @@ GType osinfo_db_get_type(void);
OsinfoDb *osinfo_db_new(void);
-OsinfoHypervisor *osinfo_db_get_hypervisor(OsinfoDb *db, const gchar *id);
+OsinfoPlatform *osinfo_db_get_platform(OsinfoDb *db, const gchar *id);
OsinfoDevice *osinfo_db_get_device(OsinfoDb *db, const gchar *id);
OsinfoOs *osinfo_db_get_os(OsinfoDb *db, const gchar *id);
OsinfoOsList *osinfo_db_get_os_list(OsinfoDb *db);
-OsinfoHypervisorList *osinfo_db_get_hypervisor_list(OsinfoDb *db);
+OsinfoPlatformList *osinfo_db_get_platform_list(OsinfoDb *db);
OsinfoDeviceList *osinfo_db_get_device_list(OsinfoDb *db);
void osinfo_db_add_os(OsinfoDb *db, OsinfoOs *os);
-void osinfo_db_add_hypervisor(OsinfoDb *db, OsinfoHypervisor *hv);
+void osinfo_db_add_platform(OsinfoDb *db, OsinfoPlatform *platform);
void osinfo_db_add_device(OsinfoDb *db, OsinfoDevice *device);
// Get me all unique values for property "vendor" among operating systems
GList *osinfo_db_unique_values_for_property_in_os(OsinfoDb *db, const gchar *propName);
-// Get me all unique values for property "vendor" among hypervisors
-GList *osinfo_db_unique_values_for_property_in_hv(OsinfoDb *db, const gchar *propName);
+// Get me all unique values for property "vendor" among platforms
+GList *osinfo_db_unique_values_for_property_in_platform(OsinfoDb *db, const gchar *propName);
// Get me all unique values for property "vendor" among devices
GList *osinfo_db_unique_values_for_property_in_dev(OsinfoDb *db, const gchar *propName);
diff --git a/osinfo/osinfo_device.c b/osinfo/osinfo_device.c
index 5563bb7..3d26257 100644
--- a/osinfo/osinfo_device.c
+++ b/osinfo/osinfo_device.c
@@ -31,11 +31,11 @@ G_DEFINE_TYPE (OsinfoDevice, osinfo_device, OSINFO_TYPE_ENTITY);
/**
* SECTION:osinfo_device
* @short_description: A hardware device
- * @see_also: #OsinfoOs, #OsinfoHypervisor
+ * @see_also: #OsinfoOs, #OsinfoPlatform
*
* #OsinfoDevice is an entity representing some kind of hardware
* device. Devices can be associated with operating systems
- * and hypervisors.
+ * and platforms.
*/
struct _OsinfoDevicePrivate
diff --git a/osinfo/osinfo_devicelink.c b/osinfo/osinfo_devicelink.c
index cb72c4c..0b24359 100644
--- a/osinfo/osinfo_devicelink.c
+++ b/osinfo/osinfo_devicelink.c
@@ -31,11 +31,11 @@ G_DEFINE_TYPE (OsinfoDeviceLink, osinfo_devicelink, OSINFO_TYPE_ENTITY);
/**
* SECTION:osinfo_devicelink
* @short_description: A hardware devicelink
- * @see_also: #OsinfoOs, #OsinfoHypervisor
+ * @see_also: #OsinfoOs, #OsinfoPlatform
*
* #OsinfoDeviceLink is an entity representing some kind of hardware
* devicelink. DeviceLinks can be associated with operating systems
- * and hypervisors.
+ * and platforms.
*/
struct _OsinfoDeviceLinkPrivate
diff --git a/osinfo/osinfo_hypervisor.h b/osinfo/osinfo_hypervisor.h
deleted file mode 100644
index aed6831..0000000
--- a/osinfo/osinfo_hypervisor.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * libosinfo: a virtualization hypervisor
- *
- * Copyright (C) 2009-2010 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors:
- * Arjun Roy <arroy@redhat.com>
- * Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <glib-object.h>
-#include <osinfo/osinfo_device.h>
-#include <osinfo/osinfo_devicelist.h>
-
-#ifndef __OSINFO_HYPERVISOR_H__
-#define __OSINFO_HYPERVISOR_H__
-
-/*
- * Type macros.
- */
-#define OSINFO_TYPE_HYPERVISOR (osinfo_hypervisor_get_type ())
-#define OSINFO_HYPERVISOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_HYPERVISOR, OsinfoHypervisor))
-#define OSINFO_IS_HYPERVISOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_HYPERVISOR))
-#define OSINFO_HYPERVISOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_HYPERVISOR, OsinfoHypervisorClass))
-#define OSINFO_IS_HYPERVISOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_HYPERVISOR))
-#define OSINFO_HYPERVISOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_HYPERVISOR, OsinfoHypervisorClass))
-
-typedef struct _OsinfoHypervisor OsinfoHypervisor;
-
-typedef struct _OsinfoHypervisorClass OsinfoHypervisorClass;
-
-typedef struct _OsinfoHypervisorPrivate OsinfoHypervisorPrivate;
-
-/* object */
-struct _OsinfoHypervisor
-{
- OsinfoEntity parent_instance;
-
- /* public */
-
- /* private */
- OsinfoHypervisorPrivate *priv;
-};
-
-/* class */
-struct _OsinfoHypervisorClass
-{
- OsinfoEntityClass parent_class;
-
- /* class members */
-};
-
-GType osinfo_hypervisor_get_type(void);
-
-OsinfoHypervisor *osinfo_hypervisor_new(const gchar *id);
-
-OsinfoDeviceList *osinfo_hypervisor_get_devices(OsinfoHypervisor *hv, OsinfoFilter *filter);
-OsinfoDeviceLinkList *osinfo_hypervisor_get_device_links(OsinfoHypervisor *hv, OsinfoFilter *filter);
-
-OsinfoDeviceLink *osinfo_hypervisor_add_device(OsinfoHypervisor *hv, OsinfoDevice *dev);
-
-#endif /* __OSINFO_HYPERVISOR_H__ */
-/*
- * Local variables:
- * indent-tabs-mode: nil
- * c-indent-level: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/osinfo/osinfo_hypervisorlist.c b/osinfo/osinfo_hypervisorlist.c
deleted file mode 100644
index 424b526..0000000
--- a/osinfo/osinfo_hypervisorlist.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * libosinfo:
- *
- * Copyright (C) 2009-2010 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors:
- * Arjun Roy <arroy@redhat.com>
- * Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <osinfo/osinfo.h>
-
-G_DEFINE_TYPE (OsinfoHypervisorList, osinfo_hypervisorlist, OSINFO_TYPE_LIST);
-
-#define OSINFO_HYPERVISORLIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_HYPERVISORLIST, OsinfoHypervisorListPrivate))
-
-/**
- * SECTION:osinfo_hypervisorlist
- * @short_description: A list of hypervisor platforms
- * @see_also: #OsinfoList, #OsinfoHypervisor
- *
- * #OsinfoHypervisorList is a list specialization that stores
- * only #OsinfoHypervisor objects.
- */
-
-struct _OsinfoHypervisorListPrivate
-{
- gboolean unused;
-};
-
-static void
-osinfo_hypervisorlist_finalize (GObject *object)
-{
- /* Chain up to the parent class */
- G_OBJECT_CLASS (osinfo_hypervisorlist_parent_class)->finalize (object);
-}
-
-/* Init functions */
-static void
-osinfo_hypervisorlist_class_init (OsinfoHypervisorListClass *klass)
-{
- GObjectClass *g_klass = G_OBJECT_CLASS (klass);
-
- g_klass->finalize = osinfo_hypervisorlist_finalize;
- g_type_class_add_private (klass, sizeof (OsinfoHypervisorListPrivate));
-}
-
-static void
-osinfo_hypervisorlist_init (OsinfoHypervisorList *list)
-{
- OsinfoHypervisorListPrivate *priv;
- list->priv = priv = OSINFO_HYPERVISORLIST_GET_PRIVATE(list);
-
-}
-
-
-/**
- * osinfo_hypervisorlist_new:
- *
- * Construct a new hypervisor list that is initially empty.
- *
- * Returns: (transfer full): an empty hypervisor list
- */
-OsinfoHypervisorList *osinfo_hypervisorlist_new(void)
-{
- return g_object_new(OSINFO_TYPE_HYPERVISORLIST,
- "element-type", OSINFO_TYPE_HYPERVISOR,
- NULL);
-}
-
-/**
- * osinfo_hypervisorlist_new_copy:
- * @source: the hypervisor list to copy
- *
- * Construct a new hypervisor list that is filled with hypervisors
- * from @source
- *
- * Returns: (transfer full): a copy of the hypervisor list
- */
-OsinfoHypervisorList *osinfo_hypervisorlist_new_copy(OsinfoHypervisorList *source)
-{
- OsinfoHypervisorList *newList = osinfo_hypervisorlist_new();
- osinfo_list_add_all(OSINFO_LIST(newList),
- OSINFO_LIST(source));
- return newList;
-}
-
-/**
- * osinfo_hypervisorlist_new_filtered:
- * @source: the hypervisor list to copy
- * @filter: the filter to apply
- *
- * Construct a new hypervisor list that is filled with hypervisors
- * from @source that match @filter
- *
- * Returns: (transfer full): a filtered copy of the hypervisor list
- */
-OsinfoHypervisorList *osinfo_hypervisorlist_new_filtered(OsinfoHypervisorList *source, OsinfoFilter *filter)
-{
- OsinfoHypervisorList *newList = osinfo_hypervisorlist_new();
- osinfo_list_add_filtered(OSINFO_LIST(newList),
- OSINFO_LIST(source),
- filter);
- return newList;
-}
-
-/**
- * osinfo_hypervisorlist_new_intersection:
- * @sourceOne: the first hypervisor list to copy
- * @sourceTwo: the second hypervisor list to copy
- *
- * Construct a new hypervisor list that is filled with only the
- * hypervisors that are present in both @sourceOne and @sourceTwo.
- *
- * Returns: (transfer full): an intersection of the two hypervisor lists
- */
-OsinfoHypervisorList *osinfo_hypervisorlist_new_intersection(OsinfoHypervisorList *sourceOne, OsinfoHypervisorList *sourceTwo)
-{
- OsinfoHypervisorList *newList = osinfo_hypervisorlist_new();
- osinfo_list_add_intersection(OSINFO_LIST(newList),
- OSINFO_LIST(sourceOne),
- OSINFO_LIST(sourceTwo));
- return newList;
-}
-
-/**
- * osinfo_hypervisorlist_new_union:
- * @sourceOne: the first hypervisor list to copy
- * @sourceTwo: the second hypervisor list to copy
- *
- * Construct a new hypervisor list that is filled with all the
- * hypervisors that are present in either @sourceOne and @sourceTwo.
- *
- * Returns: (transfer full): a union of the two hypervisor lists
- */
-OsinfoHypervisorList *osinfo_hypervisorlist_new_union(OsinfoHypervisorList *sourceOne, OsinfoHypervisorList *sourceTwo)
-{
- OsinfoHypervisorList *newList = osinfo_hypervisorlist_new();
- osinfo_list_add_union(OSINFO_LIST(newList),
- OSINFO_LIST(sourceOne),
- OSINFO_LIST(sourceTwo));
- return newList;
-}
-
-/*
- * Local variables:
- * indent-tabs-mode: nil
- * c-indent-level: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/osinfo/osinfo_hypervisorlist.h b/osinfo/osinfo_hypervisorlist.h
deleted file mode 100644
index ca700f6..0000000
--- a/osinfo/osinfo_hypervisorlist.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * libosinfo: a list of hypervisors
- *
- * Copyright (C) 2009-2010 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors:
- * Arjun Roy <arroy@redhat.com>
- * Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <glib-object.h>
-#include <osinfo/osinfo_filter.h>
-#include <osinfo/osinfo_list.h>
-
-#ifndef __OSINFO_HYPERVISORLIST_H__
-#define __OSINFO_HYPERVISORLIST_H__
-
-/*
- * Type macros.
- */
-#define OSINFO_TYPE_HYPERVISORLIST (osinfo_hypervisorlist_get_type ())
-#define OSINFO_HYPERVISORLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_HYPERVISORLIST, OsinfoHypervisorList))
-#define OSINFO_IS_HYPERVISORLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_HYPERVISORLIST))
-#define OSINFO_HYPERVISORLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_HYPERVISORLIST, OsinfoHypervisorListClass))
-#define OSINFO_IS_HYPERVISORLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_HYPERVISORLIST))
-#define OSINFO_HYPERVISORLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_HYPERVISORLIST, OsinfoHypervisorListClass))
-
-typedef struct _OsinfoHypervisorList OsinfoHypervisorList;
-
-typedef struct _OsinfoHypervisorListClass OsinfoHypervisorListClass;
-
-typedef struct _OsinfoHypervisorListPrivate OsinfoHypervisorListPrivate;
-
-/* object */
-struct _OsinfoHypervisorList
-{
- OsinfoList parent_instance;
-
- /* public */
-
- /* private */
- OsinfoHypervisorListPrivate *priv;
-};
-
-/* class */
-struct _OsinfoHypervisorListClass
-{
- OsinfoListClass parent_class;
-
- /* class members */
-};
-
-GType osinfo_hypervisorlist_get_type(void);
-
-OsinfoHypervisorList *osinfo_hypervisorlist_new(void);
-OsinfoHypervisorList *osinfo_hypervisorlist_new_copy(OsinfoHypervisorList *source);
-OsinfoHypervisorList *osinfo_hypervisorlist_new_filtered(OsinfoHypervisorList *source, OsinfoFilter *filter);
-OsinfoHypervisorList *osinfo_hypervisorlist_new_intersection(OsinfoHypervisorList *sourceOne, OsinfoHypervisorList *sourceTwo);
-OsinfoHypervisorList *osinfo_hypervisorlist_new_union(OsinfoHypervisorList *sourceOne, OsinfoHypervisorList *sourceTwo);
-
-#endif /* __OSINFO_HYPERVISORLIST_H__ */
-/*
- * Local variables:
- * indent-tabs-mode: nil
- * c-indent-level: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 7b65ab6..de61b48 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -221,16 +221,16 @@ static OsinfoOs *osinfo_loader_get_os(OsinfoLoader *loader,
}
-static OsinfoHypervisor *osinfo_loader_get_hypervisor(OsinfoLoader *loader,
+static OsinfoPlatform *osinfo_loader_get_platform(OsinfoLoader *loader,
const gchar *id)
{
- OsinfoHypervisor *hv = osinfo_db_get_hypervisor(loader->priv->db, id);
- if (!hv) {
- hv = osinfo_hypervisor_new(id);
- osinfo_db_add_hypervisor(loader->priv->db, hv);
- g_object_unref(hv);
+ OsinfoPlatform *platform = osinfo_db_get_platform(loader->priv->db, id);
+ if (!platform) {
+ platform = osinfo_platform_new(id);
+ osinfo_db_add_platform(loader->priv->db, platform);
+ g_object_unref(platform);
}
- return hv;
+ return platform;
}
@@ -257,7 +257,7 @@ static void osinfo_loader_device(OsinfoLoader *loader,
static void osinfo_loader_device_link(OsinfoLoader *loader,
OsinfoOs *os,
- OsinfoHypervisor *hv,
+ OsinfoPlatform *platform,
const gchar *xpath,
xmlXPathContextPtr ctxt,
xmlNodePtr root,
@@ -283,9 +283,9 @@ static void osinfo_loader_device_link(OsinfoLoader *loader,
OsinfoDeviceLink *link = NULL;
if (os) {
- link = osinfo_os_add_device(os, hv, dev);
- } else if (hv) {
- link = osinfo_hypervisor_add_device(hv, dev);
+ link = osinfo_os_add_device(os, platform, dev);
+ } else if (platform) {
+ link = osinfo_platform_add_device(platform, dev);
}
xmlNodePtr saved = ctxt->node;
@@ -300,7 +300,7 @@ static void osinfo_loader_device_link(OsinfoLoader *loader,
}
-static void osinfo_loader_hypervisor(OsinfoLoader *loader,
+static void osinfo_loader_platform(OsinfoLoader *loader,
xmlXPathContextPtr ctxt,
xmlNodePtr root,
GError **err)
@@ -310,18 +310,18 @@ static void osinfo_loader_hypervisor(OsinfoLoader *loader,
"name", "version", NULL,
};
if (!id) {
- OSINFO_ERROR(err, "Missing hypervisor id property");
+ OSINFO_ERROR(err, "Missing platform id property");
return;
}
- OsinfoHypervisor *hypervisor = osinfo_loader_get_hypervisor(loader, id);
+ OsinfoPlatform *platform = osinfo_loader_get_platform(loader, id);
g_free(id);
- osinfo_loader_entity(loader, OSINFO_ENTITY(hypervisor), keys, ctxt, root, err);
+ osinfo_loader_entity(loader, OSINFO_ENTITY(platform), keys, ctxt, root, err);
if (*err)
return;
- osinfo_loader_device_link(loader, NULL, hypervisor,
+ osinfo_loader_device_link(loader, NULL, platform,
"./devices/device", ctxt, root, err);
if (*err)
return;
@@ -359,38 +359,38 @@ static void osinfo_loader_os_relshp(OsinfoLoader *loader,
}
-static void osinfo_loader_os_hypervisor(OsinfoLoader *loader,
+static void osinfo_loader_os_platform(OsinfoLoader *loader,
OsinfoOs *os,
xmlXPathContextPtr ctxt,
xmlNodePtr root,
GError **err)
{
- xmlNodePtr *hvs = NULL;
- int nhvs = osinfo_loader_nodeset("./hypervisor", ctxt, &hvs, err);
+ xmlNodePtr *platforms = NULL;
+ int nplatforms = osinfo_loader_nodeset("./platform", ctxt, &platforms, err);
int i;
if (*err)
return;
- for (i = 0 ; i < nhvs ; i++) {
- gchar *id = (gchar *)xmlGetProp(hvs[i], BAD_CAST "id");
+ for (i = 0 ; i < nplatforms ; i++) {
+ gchar *id = (gchar *)xmlGetProp(platforms[i], BAD_CAST "id");
if (!id) {
- OSINFO_ERROR(err, "Missing os hypervisor id property");
+ OSINFO_ERROR(err, "Missing os platform id property");
goto cleanup;
}
- OsinfoHypervisor *hv = osinfo_loader_get_hypervisor(loader, id);
+ OsinfoPlatform *platform = osinfo_loader_get_platform(loader, id);
g_free(id);
xmlNodePtr saved = ctxt->node;
- ctxt->node = hvs[i];
- osinfo_loader_device_link(loader, os, hv,
- "./devices/device", ctxt, hvs[i], err);
+ ctxt->node = platforms[i];
+ osinfo_loader_device_link(loader, os, platform,
+ "./devices/device", ctxt, platforms[i], err);
ctxt->node = saved;
if (*err)
goto cleanup;
}
cleanup:
- g_free(hvs);
+ g_free(platforms);
}
@@ -442,7 +442,7 @@ static void osinfo_loader_os(OsinfoLoader *loader,
if (*err)
return;
- osinfo_loader_os_hypervisor(loader, os, ctxt, root, err);
+ osinfo_loader_os_platform(loader, os, ctxt, root, err);
if (*err)
return;
@@ -468,14 +468,14 @@ static void osinfo_loader_root(OsinfoLoader *loader,
* Advance tag
* If closing libosinfo tag, break
* If non element tag, continue
- * If element tag, and element is not os, hypervisor or device, error
+ * If element tag, and element is not os, platform or device, error
* Else, switch on tag type and handle reading in data
* After loop, return success if no error
* If there was an error, clean up lib data acquired so far
*/
xmlNodePtr *oss = NULL;
xmlNodePtr *devices = NULL;
- xmlNodePtr *hypervisors = NULL;
+ xmlNodePtr *platforms = NULL;
if (!xmlStrEqual(root->name, BAD_CAST "libosinfo")) {
OSINFO_ERROR(err, "Incorrect root element");
@@ -496,14 +496,14 @@ static void osinfo_loader_root(OsinfoLoader *loader,
goto cleanup;
}
- int nhypervisor = osinfo_loader_nodeset("./hypervisor", ctxt, &hypervisors, err);
+ int nplatform = osinfo_loader_nodeset("./platform", ctxt, &platforms, err);
if (*err)
goto cleanup;
- for (i = 0 ; i < nhypervisor ; i++) {
+ for (i = 0 ; i < nplatform ; i++) {
xmlNodePtr saved = ctxt->node;
- ctxt->node = hypervisors[i];
- osinfo_loader_hypervisor(loader, ctxt, hypervisors[i], err);
+ ctxt->node = platforms[i];
+ osinfo_loader_platform(loader, ctxt, platforms[i], err);
ctxt->node = saved;
if (*err)
goto cleanup;
@@ -523,7 +523,7 @@ static void osinfo_loader_root(OsinfoLoader *loader,
}
cleanup:
- g_free(hypervisors);
+ g_free(platforms);
g_free(oss);
g_free(devices);
}
diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 0fd9d48..034a222 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -31,7 +31,7 @@ G_DEFINE_TYPE (OsinfoOs, osinfo_os, OSINFO_TYPE_ENTITY);
/**
* SECTION:osinfo_os
* @short_description: An operating system
- * @see_also: #OsinfoOs, #OsinfoHypervisor
+ * @see_also: #OsinfoOs, #OsinfoPlatform
*
* #OsinfoOs is an entity representing an operating system.
* Operating systems have a list of supported devices.
@@ -51,10 +51,10 @@ G_DEFINE_TYPE (OsinfoOs, osinfo_os, OSINFO_TYPE_ENTITY);
*/
struct _OsinfoOsPrivate
{
- // OS-Hypervisor specific information
- // Key: gchar* (hypervisor id)
+ // OS-Platform specific information
+ // Key: gchar* (platform id)
// Value: GList: Element Value: List of device_link structs
- GHashTable *hypervisors;
+ GHashTable *platforms;
// Value: List of device_link structs
GList *deviceLinks;
@@ -101,7 +101,7 @@ osinfo_os_finalize (GObject *object)
g_list_foreach(os->priv->deviceLinks, osinfo_device_link_free, NULL);
g_list_free(os->priv->deviceLinks);
- g_hash_table_unref(os->priv->hypervisors);
+ g_hash_table_unref(os->priv->platforms);
g_list_foreach(os->priv->osLinks, osinfo_os_link_free, NULL);
g_list_free(os->priv->osLinks);
@@ -121,7 +121,7 @@ osinfo_os_class_init (OsinfoOsClass *klass)
}
static void
-osinfo_os_hypervisor_devices_free(gpointer opaque)
+osinfo_os_platform_devices_free(gpointer opaque)
{
GList *deviceLinks = opaque;
@@ -137,10 +137,10 @@ osinfo_os_init (OsinfoOs *os)
os->priv->deviceLinks = NULL;
os->priv->osLinks = NULL;
- os->priv->hypervisors = g_hash_table_new_full(g_str_hash,
+ os->priv->platforms = g_hash_table_new_full(g_str_hash,
g_str_equal,
g_free,
- osinfo_os_hypervisor_devices_free);
+ osinfo_os_platform_devices_free);
}
@@ -163,20 +163,20 @@ OsinfoOs *osinfo_os_new(const gchar *id)
/**
* osinfo_os_get_preferred_device:
* @os: the operating system entity
- * @hv: (transfer none)(allow-none): an optional hypervisor to restrict to
+ * @platform: (transfer none)(allow-none): an optional platform to restrict to
* @filter: (transfer none)(allow-none): a device metadata filter
*
- * Get the preferred device matching a given filter and hypervisor
+ * Get the preferred device matching a given filter and platform
*
* Returns: (transfer none): a device, or NULL
*/
-OsinfoDevice *osinfo_os_get_preferred_device(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter)
+OsinfoDevice *osinfo_os_get_preferred_device(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter)
{
g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
- g_return_val_if_fail(!hv || OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(!platform || OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(OSINFO_IS_FILTER(filter), NULL);
- OsinfoDeviceLink *link = osinfo_os_get_preferred_device_link(os, hv, filter);
+ OsinfoDeviceLink *link = osinfo_os_get_preferred_device_link(os, platform, filter);
if (link)
return osinfo_devicelink_get_target(link);
return NULL;
@@ -186,25 +186,25 @@ OsinfoDevice *osinfo_os_get_preferred_device(OsinfoOs *os, OsinfoHypervisor *hv,
/**
* osinfo_os_get_preferred_device_link:
* @os: the operating system entity
- * @hv: (transfer none)(allow-none): an optional hypervisor to restrict to
+ * @platform: (transfer none)(allow-none): an optional platform to restrict to
* @filter: (transfer none)(allow-none): a device metadata filter
*
- * Get the preferred device link matching a given filter and hypervisor.
+ * Get the preferred device link matching a given filter and platform.
* The filter matches against attributes on the device, not the link.
*
* Returns: (transfer none): a device, or NULL
*/
-OsinfoDeviceLink *osinfo_os_get_preferred_device_link(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter)
+OsinfoDeviceLink *osinfo_os_get_preferred_device_link(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter)
{
g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
- g_return_val_if_fail(!hv || OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(!platform || OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(OSINFO_IS_FILTER(filter), NULL);
- // Check if device type info present for <os,hv>, else return NULL.
+ // Check if device type info present for <os,platform>, else return NULL.
GList *tmp;
- if (hv)
- tmp = g_hash_table_lookup(os->priv->hypervisors,
- osinfo_entity_get_id(OSINFO_ENTITY(hv)));
+ if (platform)
+ tmp = g_hash_table_lookup(os->priv->platforms,
+ osinfo_entity_get_id(OSINFO_ENTITY(platform)));
else
tmp = os->priv->deviceLinks;
@@ -259,25 +259,25 @@ OsinfoOsList *osinfo_os_get_related(OsinfoOs *os, OsinfoOsRelationship relshp)
/**
* osinfo_os_get_devices:
* @os: an operating system
- * @hv: (allow-none)(transfer none): an optional hypervisor to restrict to
+ * @platform: (allow-none)(transfer none): an optional platform to restrict to
* @filter: (allow-none)(transfer none): an optional device property filter
*
- * Get all devices matching a given filter and hypervisor
+ * Get all devices matching a given filter and platform
*
* Returns: (transfer full): A list of devices
*/
-OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter)
+OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter)
{
g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
- g_return_val_if_fail(!hv || OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(!platform || OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(!filter || OSINFO_IS_FILTER(filter), NULL);
OsinfoDeviceList *newList = osinfo_devicelist_new();
GList *tmp = NULL;
- if (hv)
- tmp = g_hash_table_lookup(os->priv->hypervisors,
- osinfo_entity_get_id(OSINFO_ENTITY(hv)));
+ if (platform)
+ tmp = g_hash_table_lookup(os->priv->platforms,
+ osinfo_entity_get_id(OSINFO_ENTITY(platform)));
else
tmp = os->priv->deviceLinks;
@@ -298,26 +298,26 @@ OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoHypervisor *hv, Osin
/**
* osinfo_os_get_device_links:
* @os: an operating system
- * @hv: (allow-none)(transfer none): an optional hypervisor to restrict to
+ * @platform: (allow-none)(transfer none): an optional platform to restrict to
* @filter: (allow-none)(transfer none): an optional device property filter
*
- * Get all devices matching a given filter and hypervisor. The filter
+ * Get all devices matching a given filter and platform. 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, OsinfoHypervisor *hv, OsinfoFilter *filter)
+OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter)
{
g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
- g_return_val_if_fail(!hv || OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(!platform || OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(!filter || OSINFO_IS_FILTER(filter), NULL);
OsinfoDeviceLinkList *newList = osinfo_devicelinklist_new();
GList *tmp = NULL;
- if (hv)
- tmp = g_hash_table_lookup(os->priv->hypervisors,
- osinfo_entity_get_id(OSINFO_ENTITY(hv)));
+ if (platform)
+ tmp = g_hash_table_lookup(os->priv->platforms,
+ osinfo_entity_get_id(OSINFO_ENTITY(platform)));
else
tmp = os->priv->deviceLinks;
@@ -337,37 +337,37 @@ OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoHypervisor
/**
* osinfo_os_add_device:
* @os: an operating system
- * @hv: (transfer none): an optional hypervisor to associated with
+ * @platform: (transfer none): an optional platform to associated with
* @dev: (transfer none): the device to associate with
*
* Associated a device with an operating system, and optionally
- * a hypervisor. The returned #OsinfoDeviceLink
+ * a platform. The returned #OsinfoDeviceLink
* can be used to record extra metadata against the link
*
* Returns: (transfer none): the device association
*/
-OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoDevice *dev)
+OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoPlatform *platform, OsinfoDevice *dev)
{
g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
- g_return_val_if_fail(!hv || OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(!platform || OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(OSINFO_IS_DEVICE(dev), NULL);
OsinfoDeviceLink *link = osinfo_devicelink_new(dev);
- if (hv) {
+ if (platform) {
GList *tmp = NULL;
gpointer origKey, origValue;
- if (g_hash_table_lookup_extended(os->priv->hypervisors,
- osinfo_entity_get_id(OSINFO_ENTITY(hv)),
+ if (g_hash_table_lookup_extended(os->priv->platforms,
+ osinfo_entity_get_id(OSINFO_ENTITY(platform)),
&origKey, &origValue)) {
- g_hash_table_steal(os->priv->hypervisors,
- osinfo_entity_get_id(OSINFO_ENTITY(hv)));
+ g_hash_table_steal(os->priv->platforms,
+ osinfo_entity_get_id(OSINFO_ENTITY(platform)));
g_free(origKey);
tmp = origValue;
}
tmp = g_list_append(tmp, link);
- g_hash_table_insert(os->priv->hypervisors,
- g_strdup(osinfo_entity_get_id(OSINFO_ENTITY(hv))), tmp);
+ g_hash_table_insert(os->priv->platforms,
+ g_strdup(osinfo_entity_get_id(OSINFO_ENTITY(platform))), tmp);
} else {
os->priv->deviceLinks = g_list_append(os->priv->deviceLinks, link);
}
diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h
index 0934f49..aea9782 100644
--- a/osinfo/osinfo_os.h
+++ b/osinfo/osinfo_os.h
@@ -76,14 +76,14 @@ GType osinfo_os_get_type(void);
OsinfoOs *osinfo_os_new(const gchar *id);
-OsinfoDevice *osinfo_os_get_preferred_device(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter);
-OsinfoDeviceLink *osinfo_os_get_preferred_device_link(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter);
+OsinfoDevice *osinfo_os_get_preferred_device(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter);
+OsinfoDeviceLink *osinfo_os_get_preferred_device_link(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter);
OsinfoOsList *osinfo_os_get_related(OsinfoOs *os, OsinfoOsRelationship relshp);
-OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter);
-OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoFilter *filter);
+OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter);
+OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoPlatform *platform, OsinfoFilter *filter);
-OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoHypervisor *hv, OsinfoDevice *dev);
+OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoPlatform *platform, OsinfoDevice *dev);
void osinfo_os_add_related_os(OsinfoOs *os, OsinfoOsRelationship relshp, OsinfoOs *otheros);
diff --git a/osinfo/osinfo_hypervisor.c b/osinfo/osinfo_platform.c
index ab7ced4..bf3ea9a 100644
--- a/osinfo/osinfo_hypervisor.c
+++ b/osinfo/osinfo_platform.c
@@ -24,26 +24,26 @@
#include <osinfo/osinfo.h>
-G_DEFINE_TYPE (OsinfoHypervisor, osinfo_hypervisor, OSINFO_TYPE_ENTITY);
+G_DEFINE_TYPE (OsinfoPlatform, osinfo_platform, OSINFO_TYPE_ENTITY);
-#define OSINFO_HYPERVISOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_HYPERVISOR, OsinfoHypervisorPrivate))
+#define OSINFO_PLATFORM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_PLATFORM, OsinfoPlatformPrivate))
/**
- * SECTION:osinfo_hypervisor
- * @short_description: An operating system
- * @see_also: #OsinfoOs, #OsinfoHypervisor
+ * SECTION:osinfo_platform
+ * @short_description: An virtualization platform
+ * @see_also: #OsinfoOs, #OsinfoPlatform
*
- * #OsinfoHypervisor is an entity representing an virtualization
- * hypervisor. Hypervisors have a list of supported devices
+ * #OsinfoPlatform is an entity representing an virtualization
+ * platform. Platforms have a list of supported devices
*/
-struct _OsinfoHypervisorPrivate
+struct _OsinfoPlatformPrivate
{
// Value: List of device_link structs
GList *deviceLinks;
};
-struct _OsinfoHypervisorDeviceLink {
+struct _OsinfoPlatformDeviceLink {
OsinfoDevice *dev;
gchar *driver;
};
@@ -54,56 +54,56 @@ static void osinfo_device_link_free(gpointer data, gpointer opaque G_GNUC_UNUSED
}
static void
-osinfo_hypervisor_finalize (GObject *object)
+osinfo_platform_finalize (GObject *object)
{
- OsinfoHypervisor *hv = OSINFO_HYPERVISOR (object);
+ OsinfoPlatform *platform = OSINFO_PLATFORM (object);
- g_list_foreach(hv->priv->deviceLinks, osinfo_device_link_free, NULL);
- g_list_free(hv->priv->deviceLinks);
+ g_list_foreach(platform->priv->deviceLinks, osinfo_device_link_free, NULL);
+ g_list_free(platform->priv->deviceLinks);
/* Chain up to the parent class */
- G_OBJECT_CLASS (osinfo_hypervisor_parent_class)->finalize (object);
+ G_OBJECT_CLASS (osinfo_platform_parent_class)->finalize (object);
}
/* Init functions */
static void
-osinfo_hypervisor_class_init (OsinfoHypervisorClass *klass)
+osinfo_platform_class_init (OsinfoPlatformClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS (klass);
- g_klass->finalize = osinfo_hypervisor_finalize;
- g_type_class_add_private (klass, sizeof (OsinfoHypervisorPrivate));
+ g_klass->finalize = osinfo_platform_finalize;
+ g_type_class_add_private (klass, sizeof (OsinfoPlatformPrivate));
}
static void
-osinfo_hypervisor_init (OsinfoHypervisor *hv)
+osinfo_platform_init (OsinfoPlatform *platform)
{
- OsinfoHypervisorPrivate *priv;
- hv->priv = priv = OSINFO_HYPERVISOR_GET_PRIVATE(hv);
+ OsinfoPlatformPrivate *priv;
+ platform->priv = priv = OSINFO_PLATFORM_GET_PRIVATE(platform);
- hv->priv->deviceLinks = NULL;
+ platform->priv->deviceLinks = NULL;
}
/**
- * osinfo_hypervisor_new:
+ * osinfo_platform_new:
* @id: a unique identifier
*
- * Create a new hypervisor entity
+ * Create a new platform entity
*
- * Returns: (transfer full): A hypervisor entity
+ * Returns: (transfer full): A platform entity
*/
-OsinfoHypervisor *osinfo_hypervisor_new(const gchar *id)
+OsinfoPlatform *osinfo_platform_new(const gchar *id)
{
- return g_object_new(OSINFO_TYPE_HYPERVISOR,
+ return g_object_new(OSINFO_TYPE_PLATFORM,
"id", id,
NULL);
}
/**
- * osinfo_hypervisor_get_devices:
- * @hv: a hypervisor entity
+ * osinfo_platform_get_devices:
+ * @platform: a platform entity
* @filter: (transfer none)(allow-none): an optional filter
*
* Retrieve all the associated devices matching the filter.
@@ -111,13 +111,13 @@ OsinfoHypervisor *osinfo_hypervisor_new(const gchar *id)
*
* Returns: (transfer full): a list of #OsinfoDevice entities
*/
-OsinfoDeviceList *osinfo_hypervisor_get_devices(OsinfoHypervisor *hv, OsinfoFilter *filter)
+OsinfoDeviceList *osinfo_platform_get_devices(OsinfoPlatform *platform, OsinfoFilter *filter)
{
- g_return_val_if_fail(OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(!filter || OSINFO_IS_FILTER(filter), NULL);
OsinfoDeviceList *newList = osinfo_devicelist_new();
- GList *tmp = hv->priv->deviceLinks;
+ GList *tmp = platform->priv->deviceLinks;
while (tmp) {
OsinfoDeviceLink *link = OSINFO_DEVICELINK(tmp->data);
@@ -133,8 +133,8 @@ OsinfoDeviceList *osinfo_hypervisor_get_devices(OsinfoHypervisor *hv, OsinfoFilt
/**
- * osinfo_hypervisor_get_devices:
- * @hv: a hypervisor entity
+ * osinfo_platform_get_devices:
+ * @platform: a platform entity
* @filter: (transfer none)(allow-none): an optional filter
*
* Retrieve all the associated devices matching the filter.
@@ -142,13 +142,13 @@ OsinfoDeviceList *osinfo_hypervisor_get_devices(OsinfoHypervisor *hv, OsinfoFilt
*
* Returns: (transfer full): a list of #OsinfoDevice entities
*/
-OsinfoDeviceLinkList *osinfo_hypervisor_get_device_links(OsinfoHypervisor *hv, OsinfoFilter *filter)
+OsinfoDeviceLinkList *osinfo_platform_get_device_links(OsinfoPlatform *platform, OsinfoFilter *filter)
{
- g_return_val_if_fail(OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(!filter || OSINFO_IS_FILTER(filter), NULL);
OsinfoDeviceLinkList *newList = osinfo_devicelinklist_new();
- GList *tmp = hv->priv->deviceLinks;
+ GList *tmp = platform->priv->deviceLinks;
while (tmp) {
OsinfoDeviceLink *link = OSINFO_DEVICELINK(tmp->data);
@@ -164,23 +164,23 @@ OsinfoDeviceLinkList *osinfo_hypervisor_get_device_links(OsinfoHypervisor *hv, O
/**
- * osinfo_hypervisor_add_device:
- * @hv: a hypervisor entity
+ * osinfo_platform_add_device:
+ * @platform: a platform entity
* @dev: (transfer none): the device to associate
*
- * Associate a device with a hypervisor. The returned #OsinfoDeviceLink
+ * Associate a device with a platform. The returned #OsinfoDeviceLink
* can be used to record extra metadata against the link
*
* Returns: (transfer none): the device association
*/
-OsinfoDeviceLink *osinfo_hypervisor_add_device(OsinfoHypervisor *hv, OsinfoDevice *dev)
+OsinfoDeviceLink *osinfo_platform_add_device(OsinfoPlatform *platform, OsinfoDevice *dev)
{
- g_return_val_if_fail(OSINFO_IS_HYPERVISOR(hv), NULL);
+ g_return_val_if_fail(OSINFO_IS_PLATFORM(platform), NULL);
g_return_val_if_fail(OSINFO_IS_DEVICE(dev), NULL);
OsinfoDeviceLink *link = osinfo_devicelink_new(dev);
- hv->priv->deviceLinks = g_list_prepend(hv->priv->deviceLinks, link);
+ platform->priv->deviceLinks = g_list_prepend(platform->priv->deviceLinks, link);
return link;
}
diff --git a/osinfo/osinfo_platform.h b/osinfo/osinfo_platform.h
new file mode 100644
index 0000000..e6bc84e
--- /dev/null
+++ b/osinfo/osinfo_platform.h
@@ -0,0 +1,83 @@
+/*
+ * libosinfo: a virtualization platform
+ *
+ * Copyright (C) 2009-2010 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Arjun Roy <arroy@redhat.com>
+ * Daniel P. Berrange <berrange@redhat.com>
+ */
+
+#include <glib-object.h>
+#include <osinfo/osinfo_device.h>
+#include <osinfo/osinfo_devicelist.h>
+
+#ifndef __OSINFO_PLATFORM_H__
+#define __OSINFO_PLATFORM_H__
+
+/*
+ * Type macros.
+ */
+#define OSINFO_TYPE_PLATFORM (osinfo_platform_get_type ())
+#define OSINFO_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_PLATFORM, OsinfoPlatform))
+#define OSINFO_IS_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_PLATFORM))
+#define OSINFO_PLATFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_PLATFORM, OsinfoPlatformClass))
+#define OSINFO_IS_PLATFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_PLATFORM))
+#define OSINFO_PLATFORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_PLATFORM, OsinfoPlatformClass))
+
+typedef struct _OsinfoPlatform OsinfoPlatform;
+
+typedef struct _OsinfoPlatformClass OsinfoPlatformClass;
+
+typedef struct _OsinfoPlatformPrivate OsinfoPlatformPrivate;
+
+/* object */
+struct _OsinfoPlatform
+{
+ OsinfoEntity parent_instance;
+
+ /* public */
+
+ /* private */
+ OsinfoPlatformPrivate *priv;
+};
+
+/* class */
+struct _OsinfoPlatformClass
+{
+ OsinfoEntityClass parent_class;
+
+ /* class members */
+};
+
+GType osinfo_platform_get_type(void);
+
+OsinfoPlatform *osinfo_platform_new(const gchar *id);
+
+OsinfoDeviceList *osinfo_platform_get_devices(OsinfoPlatform *platform, OsinfoFilter *filter);
+OsinfoDeviceLinkList *osinfo_platform_get_device_links(OsinfoPlatform *platform, OsinfoFilter *filter);
+
+OsinfoDeviceLink *osinfo_platform_add_device(OsinfoPlatform *platform, OsinfoDevice *dev);
+
+#endif /* __OSINFO_PLATFORM_H__ */
+/*
+ * Local variables:
+ * indent-tabs-mode: nil
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/osinfo/osinfo_platformlist.c b/osinfo/osinfo_platformlist.c
new file mode 100644
index 0000000..84fd9b3
--- /dev/null
+++ b/osinfo/osinfo_platformlist.c
@@ -0,0 +1,165 @@
+/*
+ * libosinfo:
+ *
+ * Copyright (C) 2009-2010 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Arjun Roy <arroy@redhat.com>
+ * Daniel P. Berrange <berrange@redhat.com>
+ */
+
+#include <osinfo/osinfo.h>
+
+G_DEFINE_TYPE (OsinfoPlatformList, osinfo_platformlist, OSINFO_TYPE_LIST);
+
+#define OSINFO_PLATFORMLIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_PLATFORMLIST, OsinfoPlatformListPrivate))
+
+/**
+ * SECTION:osinfo_platformlist
+ * @short_description: A list of virtualization platforms
+ * @see_also: #OsinfoList, #OsinfoPlatform
+ *
+ * #OsinfoPlatformList is a list specialization that stores
+ * only #OsinfoPlatform objects.
+ */
+
+struct _OsinfoPlatformListPrivate
+{
+ gboolean unused;
+};
+
+static void
+osinfo_platformlist_finalize (GObject *object)
+{
+ /* Chain up to the parent class */
+ G_OBJECT_CLASS (osinfo_platformlist_parent_class)->finalize (object);
+}
+
+/* Init functions */
+static void
+osinfo_platformlist_class_init (OsinfoPlatformListClass *klass)
+{
+ GObjectClass *g_klass = G_OBJECT_CLASS (klass);
+
+ g_klass->finalize = osinfo_platformlist_finalize;
+ g_type_class_add_private (klass, sizeof (OsinfoPlatformListPrivate));
+}
+
+static void
+osinfo_platformlist_init (OsinfoPlatformList *list)
+{
+ OsinfoPlatformListPrivate *priv;
+ list->priv = priv = OSINFO_PLATFORMLIST_GET_PRIVATE(list);
+
+}
+
+
+/**
+ * osinfo_platformlist_new:
+ *
+ * Construct a new platform list that is initially empty.
+ *
+ * Returns: (transfer full): an empty platform list
+ */
+OsinfoPlatformList *osinfo_platformlist_new(void)
+{
+ return g_object_new(OSINFO_TYPE_PLATFORMLIST,
+ "element-type", OSINFO_TYPE_PLATFORM,
+ NULL);
+}
+
+/**
+ * osinfo_platformlist_new_copy:
+ * @source: the platform list to copy
+ *
+ * Construct a new platform list that is filled with platforms
+ * from @source
+ *
+ * Returns: (transfer full): a copy of the platform list
+ */
+OsinfoPlatformList *osinfo_platformlist_new_copy(OsinfoPlatformList *source)
+{
+ OsinfoPlatformList *newList = osinfo_platformlist_new();
+ osinfo_list_add_all(OSINFO_LIST(newList),
+ OSINFO_LIST(source));
+ return newList;
+}
+
+/**
+ * osinfo_platformlist_new_filtered:
+ * @source: the platform list to copy
+ * @filter: the filter to apply
+ *
+ * Construct a new platform list that is filled with platforms
+ * from @source that match @filter
+ *
+ * Returns: (transfer full): a filtered copy of the platform list
+ */
+OsinfoPlatformList *osinfo_platformlist_new_filtered(OsinfoPlatformList *source, OsinfoFilter *filter)
+{
+ OsinfoPlatformList *newList = osinfo_platformlist_new();
+ osinfo_list_add_filtered(OSINFO_LIST(newList),
+ OSINFO_LIST(source),
+ filter);
+ return newList;
+}
+
+/**
+ * osinfo_platformlist_new_intersection:
+ * @sourceOne: the first platform list to copy
+ * @sourceTwo: the second platform list to copy
+ *
+ * Construct a new platform list that is filled with only the
+ * platforms that are present in both @sourceOne and @sourceTwo.
+ *
+ * Returns: (transfer full): an intersection of the two platform lists
+ */
+OsinfoPlatformList *osinfo_platformlist_new_intersection(OsinfoPlatformList *sourceOne, OsinfoPlatformList *sourceTwo)
+{
+ OsinfoPlatformList *newList = osinfo_platformlist_new();
+ osinfo_list_add_intersection(OSINFO_LIST(newList),
+ OSINFO_LIST(sourceOne),
+ OSINFO_LIST(sourceTwo));
+ return newList;
+}
+
+/**
+ * osinfo_platformlist_new_union:
+ * @sourceOne: the first platform list to copy
+ * @sourceTwo: the second platform list to copy
+ *
+ * Construct a new platform list that is filled with all the
+ * platforms that are present in either @sourceOne and @sourceTwo.
+ *
+ * Returns: (transfer full): a union of the two platform lists
+ */
+OsinfoPlatformList *osinfo_platformlist_new_union(OsinfoPlatformList *sourceOne, OsinfoPlatformList *sourceTwo)
+{
+ OsinfoPlatformList *newList = osinfo_platformlist_new();
+ osinfo_list_add_union(OSINFO_LIST(newList),
+ OSINFO_LIST(sourceOne),
+ OSINFO_LIST(sourceTwo));
+ return newList;
+}
+
+/*
+ * Local variables:
+ * indent-tabs-mode: nil
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/osinfo/osinfo_platformlist.h b/osinfo/osinfo_platformlist.h
new file mode 100644
index 0000000..99a52b3
--- /dev/null
+++ b/osinfo/osinfo_platformlist.h
@@ -0,0 +1,82 @@
+/*
+ * libosinfo: a list of platforms
+ *
+ * Copyright (C) 2009-2010 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Arjun Roy <arroy@redhat.com>
+ * Daniel P. Berrange <berrange@redhat.com>
+ */
+
+#include <glib-object.h>
+#include <osinfo/osinfo_filter.h>
+#include <osinfo/osinfo_list.h>
+
+#ifndef __OSINFO_PLATFORMLIST_H__
+#define __OSINFO_PLATFORMLIST_H__
+
+/*
+ * Type macros.
+ */
+#define OSINFO_TYPE_PLATFORMLIST (osinfo_platformlist_get_type ())
+#define OSINFO_PLATFORMLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_PLATFORMLIST, OsinfoPlatformList))
+#define OSINFO_IS_PLATFORMLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_PLATFORMLIST))
+#define OSINFO_PLATFORMLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_PLATFORMLIST, OsinfoPlatformListClass))
+#define OSINFO_IS_PLATFORMLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_PLATFORMLIST))
+#define OSINFO_PLATFORMLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_PLATFORMLIST, OsinfoPlatformListClass))
+
+typedef struct _OsinfoPlatformList OsinfoPlatformList;
+
+typedef struct _OsinfoPlatformListClass OsinfoPlatformListClass;
+
+typedef struct _OsinfoPlatformListPrivate OsinfoPlatformListPrivate;
+
+/* object */
+struct _OsinfoPlatformList
+{
+ OsinfoList parent_instance;
+
+ /* public */
+
+ /* private */
+ OsinfoPlatformListPrivate *priv;
+};
+
+/* class */
+struct _OsinfoPlatformListClass
+{
+ OsinfoListClass parent_class;
+
+ /* class members */
+};
+
+GType osinfo_platformlist_get_type(void);
+
+OsinfoPlatformList *osinfo_platformlist_new(void);
+OsinfoPlatformList *osinfo_platformlist_new_copy(OsinfoPlatformList *source);
+OsinfoPlatformList *osinfo_platformlist_new_filtered(OsinfoPlatformList *source, OsinfoFilter *filter);
+OsinfoPlatformList *osinfo_platformlist_new_intersection(OsinfoPlatformList *sourceOne, OsinfoPlatformList *sourceTwo);
+OsinfoPlatformList *osinfo_platformlist_new_union(OsinfoPlatformList *sourceOne, OsinfoPlatformList *sourceTwo);
+
+#endif /* __OSINFO_PLATFORMLIST_H__ */
+/*
+ * Local variables:
+ * indent-tabs-mode: nil
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/test/Makefile.am b/test/Makefile.am
index bca5949..747784c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -8,8 +8,8 @@ check_PROGRAMS = \
test-os \
test-oslist \
test-osfilter \
- test-hypervisor \
- test-hypervisorlist \
+ test-platform \
+ test-platformlist \
test-db \
test-loader
@@ -46,9 +46,9 @@ test_osfilter_LDADD = $(COMMON_LDADD)
test_osfilter_CFLAGS = $(COMMON_CFLAGS)
test_osfilter_SOURCES = test-osfilter.c
-test_hypervisor_LDADD = $(COMMON_LDADD)
-test_hypervisor_CFLAGS = $(COMMON_CFLAGS)
-test_hypervisor_SOURCES = test-hypervisor.c
+test_platform_LDADD = $(COMMON_LDADD)
+test_platform_CFLAGS = $(COMMON_CFLAGS)
+test_platform_SOURCES = test-platform.c
test_list_LDADD = $(COMMON_LDADD)
test_list_CFLAGS = $(COMMON_CFLAGS)
@@ -58,9 +58,9 @@ test_devicelist_LDADD = $(COMMON_LDADD)
test_devicelist_CFLAGS = $(COMMON_CFLAGS)
test_devicelist_SOURCES = test-devicelist.c
-test_hypervisorlist_LDADD = $(COMMON_LDADD)
-test_hypervisorlist_CFLAGS = $(COMMON_CFLAGS)
-test_hypervisorlist_SOURCES = test-hypervisorlist.c
+test_platformlist_LDADD = $(COMMON_LDADD)
+test_platformlist_CFLAGS = $(COMMON_CFLAGS)
+test_platformlist_SOURCES = test-platformlist.c
test_oslist_LDADD = $(COMMON_LDADD)
test_oslist_CFLAGS = $(COMMON_CFLAGS)
diff --git a/test/osinfo.suppression b/test/osinfo.suppression
index 9d1be18..7ade05e 100644
--- a/test/osinfo.suppression
+++ b/test/osinfo.suppression
@@ -367,7 +367,7 @@
fun:g_type_register_static
fun:g_type_register_static_simple
fun:osinfo_entity_get_type
- fun:osinfo_hypervisor_get_type
+ fun:osinfo_platform_get_type
fun:main
}
{
@@ -393,7 +393,7 @@
fun:g_type_register_static
fun:g_type_register_static_simple
fun:osinfo_list_get_type
- fun:osinfo_hypervisorlist_get_type
+ fun:osinfo_platformlist_get_type
fun:main
}
{
diff --git a/test/test-db.c b/test/test-db.c
index 556ffad..2b11544 100644
--- a/test/test-db.c
+++ b/test/test-db.c
@@ -42,26 +42,26 @@ START_TEST(test_device)
END_TEST
-START_TEST(test_hypervisor)
+START_TEST(test_platform)
{
OsinfoDb *db = osinfo_db_new();
- OsinfoHypervisor *hv1 = osinfo_hypervisor_new("hv1");
- OsinfoHypervisor *hv2 = osinfo_hypervisor_new("hv2");
- OsinfoHypervisor *hv3 = osinfo_hypervisor_new("hv3");
+ OsinfoPlatform *hv1 = osinfo_platform_new("hv1");
+ OsinfoPlatform *hv2 = osinfo_platform_new("hv2");
+ OsinfoPlatform *hv3 = osinfo_platform_new("hv3");
- osinfo_db_add_hypervisor(db, hv1);
- osinfo_db_add_hypervisor(db, hv2);
- osinfo_db_add_hypervisor(db, hv3);
+ osinfo_db_add_platform(db, hv1);
+ osinfo_db_add_platform(db, hv2);
+ osinfo_db_add_platform(db, hv3);
- OsinfoHypervisorList *list = osinfo_db_get_hypervisor_list(db);
+ OsinfoPlatformList *list = osinfo_db_get_platform_list(db);
fail_unless(OSINFO_ENTITY(hv1) == osinfo_list_get_nth(OSINFO_LIST(list), 0), "Hv 1 is missing");
fail_unless(OSINFO_ENTITY(hv2) == osinfo_list_get_nth(OSINFO_LIST(list), 1), "Hv 2 is missing");
fail_unless(OSINFO_ENTITY(hv3) == osinfo_list_get_nth(OSINFO_LIST(list), 2), "Hv 3 is missing");
g_object_unref(list);
- OsinfoHypervisor *hv = osinfo_db_get_hypervisor(db, "hv2");
- fail_unless(hv != NULL, "Hypervisor is NULL");
- fail_unless(hv == hv2, "Hypervisor was not hv2");
+ OsinfoPlatform *hv = osinfo_db_get_platform(db, "hv2");
+ fail_unless(hv != NULL, "Platform is NULL");
+ fail_unless(hv == hv2, "Platform was not hv2");
g_object_unref(hv1);
g_object_unref(hv2);
@@ -154,12 +154,12 @@ START_TEST(test_prop_device)
END_TEST
-START_TEST(test_prop_hypervisor)
+START_TEST(test_prop_platform)
{
OsinfoDb *db = osinfo_db_new();
- OsinfoHypervisor *hv1 = osinfo_hypervisor_new("hv1");
- OsinfoHypervisor *hv2 = osinfo_hypervisor_new("hv2");
- OsinfoHypervisor *hv3 = osinfo_hypervisor_new("hv3");
+ OsinfoPlatform *hv1 = osinfo_platform_new("hv1");
+ OsinfoPlatform *hv2 = osinfo_platform_new("hv2");
+ OsinfoPlatform *hv3 = osinfo_platform_new("hv3");
osinfo_entity_add_param(OSINFO_ENTITY(hv1), "vendor", "acme");
osinfo_entity_add_param(OSINFO_ENTITY(hv1), "vendor", "frog");
@@ -167,9 +167,9 @@ START_TEST(test_prop_hypervisor)
osinfo_entity_add_param(OSINFO_ENTITY(hv3), "vendor", "dog");
osinfo_entity_add_param(OSINFO_ENTITY(hv3), "arch", "x86");
- osinfo_db_add_hypervisor(db, hv1);
- osinfo_db_add_hypervisor(db, hv2);
- osinfo_db_add_hypervisor(db, hv3);
+ osinfo_db_add_platform(db, hv1);
+ osinfo_db_add_platform(db, hv2);
+ osinfo_db_add_platform(db, hv3);
GList *uniq = osinfo_db_unique_values_for_property_in_hv(db, "vendor");
GList *tmp = uniq;
@@ -383,10 +383,10 @@ list_suite(void)
TCase *tc = tcase_create("Core");
tcase_add_test(tc, test_basic);
tcase_add_test(tc, test_device);
- tcase_add_test(tc, test_hypervisor);
+ tcase_add_test(tc, test_platform);
tcase_add_test(tc, test_os);
tcase_add_test(tc, test_prop_device);
- tcase_add_test(tc, test_prop_hypervisor);
+ tcase_add_test(tc, test_prop_platform);
tcase_add_test(tc, test_prop_os);
tcase_add_test(tc, test_rel_os);
suite_add_tcase(s, tc);
@@ -405,11 +405,11 @@ int main(void)
osinfo_entity_get_type();
osinfo_db_get_type();
osinfo_device_get_type();
- osinfo_hypervisor_get_type();
+ osinfo_platform_get_type();
osinfo_os_get_type();
osinfo_list_get_type();
osinfo_devicelist_get_type();
- osinfo_hypervisorlist_get_type();
+ osinfo_platformlist_get_type();
osinfo_oslist_get_type();
osinfo_filter_get_type();
diff --git a/test/test-loader.c b/test/test-loader.c
index c82fc13..e9598dc 100644
--- a/test/test-loader.c
+++ b/test/test-loader.c
@@ -38,11 +38,11 @@ int main(void)
osinfo_entity_get_type();
osinfo_db_get_type();
osinfo_device_get_type();
- osinfo_hypervisor_get_type();
+ osinfo_platform_get_type();
osinfo_os_get_type();
osinfo_list_get_type();
osinfo_devicelist_get_type();
- osinfo_hypervisorlist_get_type();
+ osinfo_platformlist_get_type();
osinfo_oslist_get_type();
osinfo_filter_get_type();
osinfo_loader_get_type();
diff --git a/test/test-os.c b/test/test-os.c
index 8f6d22d..b08f779 100644
--- a/test/test-os.c
+++ b/test/test-os.c
@@ -76,7 +76,7 @@ END_TEST
START_TEST(test_hv_devices)
{
OsinfoOs *os = osinfo_os_new("awesome");
- OsinfoHypervisor *hv = osinfo_hypervisor_new("magical");
+ OsinfoPlatform *hv = osinfo_platform_new("magical");
OsinfoDevice *dev1 = osinfo_device_new("e1000");
OsinfoDevice *dev2 = osinfo_device_new("rtl8139");
OsinfoDevice *dev3 = osinfo_device_new("virtio");
@@ -115,7 +115,7 @@ END_TEST
START_TEST(test_hv_devices_filter)
{
OsinfoOs *os = osinfo_os_new("awesome");
- OsinfoHypervisor *hv = osinfo_hypervisor_new("magical");
+ OsinfoPlatform *hv = osinfo_platform_new("magical");
OsinfoDevice *dev1 = osinfo_device_new("e1000");
OsinfoDevice *dev2 = osinfo_device_new("sb16");
OsinfoDevice *dev3 = osinfo_device_new("virtio");
@@ -259,7 +259,7 @@ END_TEST
START_TEST(test_hv_device_driver)
{
OsinfoOs *os = osinfo_os_new("awesome");
- OsinfoHypervisor *hv = osinfo_hypervisor_new("special");
+ OsinfoPlatform *hv = osinfo_platform_new("special");
OsinfoDevice *dev1 = osinfo_device_new("e1000");
OsinfoDevice *dev2 = osinfo_device_new("rtl8139");
OsinfoDevice *dev3 = osinfo_device_new("sb16");
@@ -337,7 +337,7 @@ int main(void)
g_type_init();
/* Upfront so we don't confuse valgrind */
- osinfo_hypervisor_get_type();
+ osinfo_platform_get_type();
osinfo_device_get_type();
osinfo_os_get_type();
osinfo_oslist_get_type();
diff --git a/test/test-hypervisor.c b/test/test-platform.c
index a06d033..6ac813e 100644
--- a/test/test-hypervisor.c
+++ b/test/test-platform.c
@@ -6,29 +6,29 @@
START_TEST(test_basic)
{
- OsinfoHypervisor *hypervisor = osinfo_hypervisor_new("awesome");
+ OsinfoPlatform *platform = osinfo_platform_new("awesome");
- fail_unless(OSINFO_IS_HYPERVISOR(hypervisor), "Hypervisor is a hypervisor object");
- fail_unless(g_strcmp0(osinfo_entity_get_id(OSINFO_ENTITY(hypervisor)), "awesome") == 0, "Hypervisor ID was awesome");
+ fail_unless(OSINFO_IS_PLATFORM(platform), "Platform is a platform object");
+ fail_unless(g_strcmp0(osinfo_entity_get_id(OSINFO_ENTITY(platform)), "awesome") == 0, "Platform ID was awesome");
- g_object_unref(hypervisor);
+ g_object_unref(platform);
}
END_TEST
START_TEST(test_devices)
{
- OsinfoHypervisor *hv = osinfo_hypervisor_new("awesome");
+ OsinfoPlatform *hv = osinfo_platform_new("awesome");
OsinfoDevice *dev1 = osinfo_device_new("e1000");
OsinfoDevice *dev2 = osinfo_device_new("rtl8139");
- OsinfoDeviceLink *link1 = osinfo_hypervisor_add_device(hv, dev1);
+ OsinfoDeviceLink *link1 = osinfo_platform_add_device(hv, dev1);
osinfo_entity_add_param(OSINFO_ENTITY(link1), "device", "pci-e1000");
- OsinfoDeviceLink *link2 = osinfo_hypervisor_add_device(hv, dev2);
+ OsinfoDeviceLink *link2 = osinfo_platform_add_device(hv, dev2);
osinfo_entity_add_param(OSINFO_ENTITY(link2), "device", "pci-8139");
- OsinfoDeviceList *devices = osinfo_hypervisor_get_devices(hv, NULL);
+ OsinfoDeviceList *devices = osinfo_platform_get_devices(hv, NULL);
- fail_unless(osinfo_list_get_length(OSINFO_LIST(devices)) == 2, "Hypervisor has two devices");
+ fail_unless(osinfo_list_get_length(OSINFO_LIST(devices)) == 2, "Platform has two devices");
gboolean hasDev1 = FALSE;
gboolean hasDev2 = FALSE;
@@ -58,7 +58,7 @@ END_TEST
START_TEST(test_devices_filter)
{
- OsinfoHypervisor *hv = osinfo_hypervisor_new("awesome");
+ OsinfoPlatform *hv = osinfo_platform_new("awesome");
OsinfoDevice *dev1 = osinfo_device_new("e1000");
OsinfoDevice *dev2 = osinfo_device_new("sb16");
OsinfoFilter *filter = osinfo_filter_new();
@@ -66,16 +66,16 @@ START_TEST(test_devices_filter)
osinfo_entity_add_param(OSINFO_ENTITY(dev1), "class", "network");
osinfo_entity_add_param(OSINFO_ENTITY(dev2), "class", "audio");
- OsinfoDeviceLink *link1 = osinfo_hypervisor_add_device(hv, dev1);
+ OsinfoDeviceLink *link1 = osinfo_platform_add_device(hv, dev1);
osinfo_entity_add_param(OSINFO_ENTITY(link1), "device", "pci-e1000");
- OsinfoDeviceLink *link2 = osinfo_hypervisor_add_device(hv, dev2);
+ OsinfoDeviceLink *link2 = osinfo_platform_add_device(hv, dev2);
osinfo_entity_add_param(OSINFO_ENTITY(link2), "device", "isa-sb16");
osinfo_filter_add_constraint(filter, "class", "network");
- OsinfoDeviceList *devices = osinfo_hypervisor_get_devices(hv, filter);
+ OsinfoDeviceList *devices = osinfo_platform_get_devices(hv, filter);
- fail_unless(osinfo_list_get_length(OSINFO_LIST(devices)) == 1, "Hypervisor has one devices");
+ fail_unless(osinfo_list_get_length(OSINFO_LIST(devices)) == 1, "Platform has one devices");
OsinfoEntity *ent = osinfo_list_get_nth(OSINFO_LIST(devices), 0);
fail_unless(OSINFO_IS_DEVICE(ent), "entity is a device");
fail_unless(OSINFO_DEVICE(ent) == dev1, "device is e1000");
@@ -91,9 +91,9 @@ END_TEST
static Suite *
-hypervisor_suite(void)
+platform_suite(void)
{
- Suite *s = suite_create("Hypervisor");
+ Suite *s = suite_create("Platform");
TCase *tc = tcase_create("Core");
tcase_add_test(tc, test_basic);
tcase_add_test(tc, test_devices);
@@ -105,13 +105,13 @@ hypervisor_suite(void)
int main(void)
{
int number_failed;
- Suite *s = hypervisor_suite ();
+ Suite *s = platform_suite ();
SRunner *sr = srunner_create (s);
g_type_init();
/* Upfront so we don't confuse valgrind */
- osinfo_hypervisor_get_type();
+ osinfo_platform_get_type();
osinfo_device_get_type();
osinfo_devicelist_get_type();
osinfo_filter_get_type();
diff --git a/test/test-hypervisorlist.c b/test/test-platformlist.c
index edc5cbf..7e7930a 100644
--- a/test/test-hypervisorlist.c
+++ b/test/test-platformlist.c
@@ -5,13 +5,13 @@
START_TEST(test_union)
{
- OsinfoHypervisorList *list1 = osinfo_hypervisorlist_new();
- OsinfoHypervisorList *list2 = osinfo_hypervisorlist_new();
- OsinfoHypervisorList *list3;
- OsinfoHypervisor *ent1 = osinfo_hypervisor_new("wibble1");
- OsinfoHypervisor *ent2 = osinfo_hypervisor_new("wibble2");
- OsinfoHypervisor *ent3 = osinfo_hypervisor_new("wibble3");
- OsinfoHypervisor *ent4 = osinfo_hypervisor_new("wibble4");
+ OsinfoPlatformList *list1 = osinfo_platformlist_new();
+ OsinfoPlatformList *list2 = osinfo_platformlist_new();
+ OsinfoPlatformList *list3;
+ OsinfoPlatform *ent1 = osinfo_platform_new("wibble1");
+ OsinfoPlatform *ent2 = osinfo_platform_new("wibble2");
+ OsinfoPlatform *ent3 = osinfo_platform_new("wibble3");
+ OsinfoPlatform *ent4 = osinfo_platform_new("wibble4");
osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1));
osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2));
@@ -20,7 +20,7 @@ START_TEST(test_union)
osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1));
osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4));
- list3 = osinfo_hypervisorlist_new_union(list1, list2);
+ list3 = osinfo_platformlist_new_union(list1, list2);
fail_unless(osinfo_list_get_length(OSINFO_LIST(list3)) == 4, "List did not have 4 elements");
@@ -31,7 +31,7 @@ START_TEST(test_union)
gboolean hasBad = FALSE;
int i;
for (i = 0 ; i < osinfo_list_get_length(OSINFO_LIST(list3)) ; i++) {
- OsinfoHypervisor *ent = OSINFO_HYPERVISOR(osinfo_list_get_nth(OSINFO_LIST(list3), i));
+ OsinfoPlatform *ent = OSINFO_PLATFORM(osinfo_list_get_nth(OSINFO_LIST(list3), i));
if (ent == ent1)
has1 = TRUE;
else if (ent == ent2)
@@ -62,13 +62,13 @@ END_TEST
START_TEST(test_intersect)
{
- OsinfoHypervisorList *list1 = osinfo_hypervisorlist_new();
- OsinfoHypervisorList *list2 = osinfo_hypervisorlist_new();
- OsinfoHypervisorList *list3;
- OsinfoHypervisor *ent1 = osinfo_hypervisor_new("wibble1");
- OsinfoHypervisor *ent2 = osinfo_hypervisor_new("wibble2");
- OsinfoHypervisor *ent3 = osinfo_hypervisor_new("wibble3");
- OsinfoHypervisor *ent4 = osinfo_hypervisor_new("wibble4");
+ OsinfoPlatformList *list1 = osinfo_platformlist_new();
+ OsinfoPlatformList *list2 = osinfo_platformlist_new();
+ OsinfoPlatformList *list3;
+ OsinfoPlatform *ent1 = osinfo_platform_new("wibble1");
+ OsinfoPlatform *ent2 = osinfo_platform_new("wibble2");
+ OsinfoPlatform *ent3 = osinfo_platform_new("wibble3");
+ OsinfoPlatform *ent4 = osinfo_platform_new("wibble4");
osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1));
@@ -79,7 +79,7 @@ START_TEST(test_intersect)
osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent3));
osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4));
- list3 = osinfo_hypervisorlist_new_intersection(list1, list2);
+ list3 = osinfo_platformlist_new_intersection(list1, list2);
fail_unless(osinfo_list_get_length(OSINFO_LIST(list3)) == 2, "List did not have 2 elements");
@@ -90,7 +90,7 @@ START_TEST(test_intersect)
gboolean hasBad = FALSE;
int i;
for (i = 0 ; i < osinfo_list_get_length(OSINFO_LIST(list3)) ; i++) {
- OsinfoHypervisor *ent = OSINFO_HYPERVISOR(osinfo_list_get_nth(OSINFO_LIST(list3), i));
+ OsinfoPlatform *ent = OSINFO_PLATFORM(osinfo_list_get_nth(OSINFO_LIST(list3), i));
if (ent == ent1)
has1 = TRUE;
else if (ent == ent2)
@@ -121,13 +121,13 @@ END_TEST
START_TEST(test_filter)
{
- OsinfoHypervisorList *list1 = osinfo_hypervisorlist_new();
- OsinfoHypervisorList *list2;
+ OsinfoPlatformList *list1 = osinfo_platformlist_new();
+ OsinfoPlatformList *list2;
OsinfoFilter *filter = osinfo_filter_new();
- OsinfoHypervisor *ent1 = osinfo_hypervisor_new("wibble1");
- OsinfoHypervisor *ent2 = osinfo_hypervisor_new("wibble2");
- OsinfoHypervisor *ent3 = osinfo_hypervisor_new("wibble3");
- OsinfoHypervisor *ent4 = osinfo_hypervisor_new("wibble4");
+ OsinfoPlatform *ent1 = osinfo_platform_new("wibble1");
+ OsinfoPlatform *ent2 = osinfo_platform_new("wibble2");
+ OsinfoPlatform *ent3 = osinfo_platform_new("wibble3");
+ OsinfoPlatform *ent4 = osinfo_platform_new("wibble4");
osinfo_entity_add_param(OSINFO_ENTITY(ent1), "class", "network");
osinfo_entity_add_param(OSINFO_ENTITY(ent1), "class", "wilma");
@@ -143,7 +143,7 @@ START_TEST(test_filter)
osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3));
osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent4));
- list2 = osinfo_hypervisorlist_new_filtered(list1, filter);
+ list2 = osinfo_platformlist_new_filtered(list1, filter);
fail_unless(osinfo_list_get_length(OSINFO_LIST(list2)) == 3, "List did not have 3 elements");
@@ -154,7 +154,7 @@ START_TEST(test_filter)
gboolean hasBad = FALSE;
int i;
for (i = 0 ; i < osinfo_list_get_length(OSINFO_LIST(list2)) ; i++) {
- OsinfoHypervisor *ent = OSINFO_HYPERVISOR(osinfo_list_get_nth(OSINFO_LIST(list2), i));
+ OsinfoPlatform *ent = OSINFO_PLATFORM(osinfo_list_get_nth(OSINFO_LIST(list2), i));
if (ent == ent1)
has1 = TRUE;
else if (ent == ent2)
@@ -204,8 +204,8 @@ int main(void)
g_type_init();
/* Upfront so we don't confuse valgrind */
- osinfo_hypervisor_get_type();
- osinfo_hypervisorlist_get_type();
+ osinfo_platform_get_type();
+ osinfo_platformlist_get_type();
osinfo_filter_get_type();
srunner_run_all (sr, CK_ENV);