[virt-tools-list] [PATCH] Add a 'class' attribute to OS

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Wed Jun 29 14:55:11 UTC 2011


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

This is the generic family this OS belongs to, for example Linux, Windows,
Solaris, UNIX etc.
---
 data/oses/bsd.xml                     |    4 ++
 data/oses/centos.xml                  |    2 +
 data/oses/debian.xml                  |    3 +
 data/oses/fedora.xml                  |   11 +++++
 data/oses/generic-linux.xml           |    5 ++
 data/oses/mandriva.xml                |    4 ++
 data/oses/others.xml                  |    4 ++
 data/oses/rhel.xml                    |    9 ++++
 data/oses/solaris.xml                 |    3 +
 data/oses/suse.xml                    |    2 +
 data/oses/ubuntu.xml                  |    8 ++++
 data/oses/windows.xml                 |    8 ++++
 docs/reference/Libosinfo-sections.txt |    1 +
 osinfo/libosinfo.syms                 |    1 +
 osinfo/osinfo_loader.c                |    1 +
 osinfo/osinfo_os.c                    |   66 ++++++++++++++++++++++++++++++++-
 osinfo/osinfo_os.h                    |    3 +
 17 files changed, 133 insertions(+), 2 deletions(-)

diff --git a/data/oses/bsd.xml b/data/oses/bsd.xml
index e6ba331..355f6b5 100644
--- a/data/oses/bsd.xml
+++ b/data/oses/bsd.xml
@@ -5,6 +5,7 @@
     <name>FreeBSD 6</name>
     <version>6.4</version>
     <vendor>FreeBSD Project</vendor>
+    <family>UNIX</family>
 
     <devices>
       <device id="http://pciids.sourceforge.net/v2.2/pci.ids/10ec/8029"/>
@@ -16,6 +17,7 @@
     <name>FreeBSD 7</name>
     <version>7.4</version>
     <vendor>FreeBSD Project</vendor>
+    <family>UNIX</family>
     <upgrades id="http://freebsd.org/freebsd6"/>
   </os>
 
@@ -24,6 +26,7 @@
     <name>FreeBSD 8</name>
     <version>8.2</version>
     <vendor>FreeBSD Project</vendor>
+    <family>UNIX</family>
     <upgrades id="http://freebsd.org/freebsd7"/>
 
     <devices>
@@ -35,6 +38,7 @@
     <short-id>openbsd4</short-id>
     <name>OpenBSD 4</name>
     <version>4.9</version>
+    <family>UNIX</family>
     <vendor>OpenBSD Project</vendor>
 
     <devices>
diff --git a/data/oses/centos.xml b/data/oses/centos.xml
index 72c2f1e..96c7442 100644
--- a/data/oses/centos.xml
+++ b/data/oses/centos.xml
@@ -5,6 +5,7 @@
     <name>CentOS 6.0</name>
     <version>6.0</version>
     <vendor>CentOS</vendor>
+    <family>Linux</family>
     <clones id="http://redhat.com/rhel/6.0"/>
   </os>
 
@@ -13,6 +14,7 @@
     <name>CentOS 6.1</name>
     <version>6.1</version>
     <vendor>CentOS</vendor>
+    <family>Linux</family>
     <upgrades id="http://centos.org/centos/6.0"/>
     <clones id="http://redhat.com/rhel/6.0"/>
   </os>
diff --git a/data/oses/debian.xml b/data/oses/debian.xml
index 17981e7..06360b7 100644
--- a/data/oses/debian.xml
+++ b/data/oses/debian.xml
@@ -5,6 +5,7 @@
     <name>Debian Etch</name>
     <version>4</version>
     <vendor>Debian Project</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://debian.org/lenny">
@@ -12,6 +13,7 @@
     <name>Debian Lenny</name>
     <version>5</version>
     <vendor>Debian Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://debian.org/etch"/>
 
     <devices>
@@ -25,6 +27,7 @@
     <name>Debian Squeeze</name>
     <version>6</version>
     <vendor>Debian Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://debian.org/lenny"/>
 
     <devices>
diff --git a/data/oses/fedora.xml b/data/oses/fedora.xml
index 73f1dc1..c71d9d6 100644
--- a/data/oses/fedora.xml
+++ b/data/oses/fedora.xml
@@ -5,6 +5,7 @@
     <name>Fedora 5</name>
     <version>5</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://fedoraproject.org/fedora/6">
@@ -12,6 +13,7 @@
     <name>Fedora 6</name>
     <version>6</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/5"/>
   </os>
 
@@ -20,6 +22,7 @@
     <name>Fedora 7</name>
     <version>7</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/6"/>
   </os>
 
@@ -28,6 +31,7 @@
     <name>Fedora 8</name>
     <version>8</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/7"/>
   </os>
 
@@ -36,6 +40,7 @@
     <name>Fedora 9</name>
     <version>9</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/8"/>
 
     <devices>
@@ -52,6 +57,7 @@
     <name>Fedora 10</name>
     <version>10</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/9"/>
 
     <devices>
@@ -64,6 +70,7 @@
     <name>Fedora 11</name>
     <version>11</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/10"/>
 
     <devices>
@@ -76,6 +83,7 @@
     <name>Fedora 12</name>
     <version>12</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/11"/>
 
     <media arch="i386">
@@ -91,6 +99,7 @@
     <name>Fedora 13</name>
     <version>13</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/12"/>
 
     <media arch="i386">
@@ -106,6 +115,7 @@
     <name>Fedora 14</name>
     <version>14</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/13"/>
 
     <media arch="i386">
@@ -121,6 +131,7 @@
     <name>Fedora 15</name>
     <version>15</version>
     <vendor>Fedora Project</vendor>
+    <family>Linux</family>
     <upgrades id="http://fedoraproject.org/fedora/14"/>
 
     <media arch="i386">
diff --git a/data/oses/generic-linux.xml b/data/oses/generic-linux.xml
index 909b96d..4d9fcfb 100644
--- a/data/oses/generic-linux.xml
+++ b/data/oses/generic-linux.xml
@@ -5,6 +5,7 @@
     <name>Generic 2.4.x kernel</name>
     <version>2.4</version>
     <vendor>Linux Kernel Developers</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://kernel.org/linux/26">
@@ -19,6 +20,7 @@
     <name>Generic 2.6.25 or later kernel with virtio</name>
     <version>2.6</version>
     <vendor>Linux Kernel Developers</vendor>
+    <family>Linux</family>
 
     <devices>
       <device id="http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1000"/>
@@ -33,6 +35,7 @@
     <name>Generic 2.4.x kernel</name>
     <version>2.4</version>
     <vendor>Linux Kernel Developers</vendor>
+    <family>Linux</family>
     <clones id="http://kernel.org/linux/24"/>
   </os>
 
@@ -41,6 +44,7 @@
     <name>Generic 2.6.x kernel</name>
     <version>2.6</version>
     <vendor>Linux Kernel Developers</vendor>
+    <family>Linux</family>
     <clones id="http://kernel.org/linux/26"/>
   </os>
 
@@ -49,6 +53,7 @@
     <name>Generic 2.6.25 or later kernel with virtio</name>
     <version>2.6</version>
     <vendor>Linux Kernel Developers</vendor>
+    <family>Linux</family>
     <clones id="http://kernel.org/linux/virtio/26"/>
   </os>
 
diff --git a/data/oses/mandriva.xml b/data/oses/mandriva.xml
index 1041def..91becb5 100644
--- a/data/oses/mandriva.xml
+++ b/data/oses/mandriva.xml
@@ -4,12 +4,14 @@
     <short-id>mandriva2009</short-id>
     <name>Mandriva Linux 2009</name>
     <vendor>Mandriva</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://www.mandriva.com/linux/2010">
     <short-id>mandriva2010</short-id>
     <name>Mandriva Linux 2010</name>
     <vendor>Mandriva</vendor>
+    <family>Linux</family>
     <upgrades id="http://www.mandriva.com/linux/2009"/>
 
     <devices>
@@ -23,6 +25,7 @@
     <name>Mandriva Enterprise Server 5.0</name>
     <version>5.0</version>
     <vendor>Mandriva</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://www.mandriva.com/linux/server/5.1">
@@ -30,6 +33,7 @@
     <name>Mandriva Enterprise Server 5.1</name>
     <version>5.1</version>
     <vendor>Mandriva</vendor>
+    <family>Linux</family>
     <upgrades id="http://www.mandriva.com/linux/server/5.0"/>
 
     <devices>
diff --git a/data/oses/others.xml b/data/oses/others.xml
index 5927d47..a9df676 100644
--- a/data/oses/others.xml
+++ b/data/oses/others.xml
@@ -4,24 +4,28 @@
     <short-id>msdos</short-id>
     <name>Microsoft MS-DOS</name>
     <vendor>Microsoft</vendor>
+    <family>Other</family>
   </os>
 
   <os id="http://novell.com/netware4">
     <short-id>netware4</short-id>
     <name>Novell Netware 4</name>
     <vendor>Novell</vendor>
+    <family>Other</family>
   </os>
 
   <os id="http://novell.com/netware5">
     <short-id>netware5</short-id>
     <name>Novell Netware 5</name>
     <vendor>Novell</vendor>
+    <family>Other</family>
   </os>
 
   <os id="http://novell.com/netware6">
     <short-id>netware6</short-id>
     <name>Novell Netware 6</name>
     <vendor>Novell</vendor>
+    <family>Other</family>
   </os>
 
 </libosinfo>
diff --git a/data/oses/rhel.xml b/data/oses/rhel.xml
index a8458f1..2d95dbd 100644
--- a/data/oses/rhel.xml
+++ b/data/oses/rhel.xml
@@ -5,6 +5,7 @@
     <name>Red Hat Enterprise Linux 2.1</name>
     <version>2.1</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://redhat.com/rhel/3">
@@ -12,6 +13,7 @@
     <name>Red Hat Enterprise Linux 3</name>
     <version>3</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://redhat.com/rhel/4.8">
@@ -19,6 +21,7 @@
     <name>Red Hat Enterprise Linux 4.8</name>
     <version>4.8</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://redhat.com/rhel/4.9">
@@ -26,6 +29,7 @@
     <name>Red Hat Enterprise Linux 4.9</name>
     <version>4.9</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
     <upgrades id="http://redhat.com/rhel/4.8"/>
   </os>
 
@@ -34,6 +38,7 @@
     <name>Red Hat Enterprise Linux 5.4</name>
     <version>5.6</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://redhat.com/rhel/5.6">
@@ -41,6 +46,7 @@
     <name>Red Hat Enterprise Linux 5.6</name>
     <version>5.6</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
 
     <devices>
       <device id="http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1000"/>
@@ -53,6 +59,7 @@
     <name>Red Hat Enterprise Linux 5.7</name>
     <version>5.7</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
     <upgrades id="http://redhat.com/rhel/5.6"/>
   </os>
 
@@ -61,6 +68,7 @@
     <name>Red Hat Enterprise Linux 6.0</name>
     <version>6.0</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
 
     <devices>
       <device id="http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1000"/>
@@ -74,6 +82,7 @@
     <name>Red Hat Enterprise Linux 6.1</name>
     <version>6.1</version>
     <vendor>Red Hat, Inc</vendor>
+    <family>Linux</family>
     <upgrades id="http://redhat.com/rhel/6.0"/>
   </os>
 
diff --git a/data/oses/solaris.xml b/data/oses/solaris.xml
index d3c0e46..af6e1c7 100644
--- a/data/oses/solaris.xml
+++ b/data/oses/solaris.xml
@@ -5,6 +5,7 @@
     <name>Sun Solaris 9</name>
     <version>9</version>
     <vendor>Sun</vendor>
+    <family>Solaris</family>
   </os>
 
   <os id="http://sun.com/solaris10">
@@ -12,6 +13,7 @@
     <name>Sun Solaris 10</name>
     <version>10</version>
     <vendor>Sun</vendor>
+    <family>Solaris</family>
     <upgrades id="http://sun.com/solaris9"/>
 
     <devices>
@@ -24,6 +26,7 @@
     <name>Sun OpenSolaris</name>
     <version>2009.06</version>
     <vendor>Sun</vendor>
+    <family>Solaris</family>
 
     <devices>
       <device id="http://www.linux-usb.org/usb.ids/80ee/0021"/>
diff --git a/data/oses/suse.xml b/data/oses/suse.xml
index f6cf5f0..ff9c2a0 100644
--- a/data/oses/suse.xml
+++ b/data/oses/suse.xml
@@ -5,6 +5,7 @@
     <name>Suse Linux Enterprise Server 10</name>
     <version>10</version>
     <vendor>Novell</vendor>
+    <family>Linux</family>
   </os>
 
   <os id="http://www.novell.com/linux/sles11">
@@ -12,6 +13,7 @@
     <name>Suse Linux Enterprise Server 11</name>
     <version>11</version>
     <vendor>Novell</vendor>
+    <family>Linux</family>
     <upgrades id='http://www.novell.com/linux/sles10'/>
 
     <devices>
diff --git a/data/oses/ubuntu.xml b/data/oses/ubuntu.xml
index 22ba801..284c38e 100644
--- a/data/oses/ubuntu.xml
+++ b/data/oses/ubuntu.xml
@@ -5,6 +5,7 @@
     <name>Ubuntu Hardy Heron</name>
     <version>8.04</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
 
     <devices>
       <device id="http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1000"/>
@@ -16,6 +17,7 @@
     <name>Ubuntu Intrepid Ibex</name>
     <version>8.10</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/hardy"/>
   </os>
 
@@ -24,6 +26,7 @@
     <name>Ubuntu Jaunty Jackalope</name>
     <version>9.04</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/intrepid"/>
 
     <devices>
@@ -36,6 +39,7 @@
     <name>Ubuntu Karmic Koala</name>
     <version>9.10</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/jaunty"/>
   </os>
 
@@ -44,6 +48,7 @@
     <name>Ubuntu Lucid Lynx</name>
     <version>10.04</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/karmic"/>
   </os>
 
@@ -52,6 +57,7 @@
     <name>Ubuntu Maverick Meerkat</name>
     <version>10.10</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/lucid"/>
   </os>
 
@@ -60,6 +66,7 @@
     <name>Ubuntu Natty Narwhal</name>
     <version>11.04</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/maverick"/>
   </os>
 
@@ -68,6 +75,7 @@
     <name>Ubuntu Oneiric Ocelot</name>
     <version>11.10</version>
     <vendor>Canonical</vendor>
+    <family>Linux</family>
     <upgrades id="http://ubuntu.com/natty"/>
   </os>
 
diff --git a/data/oses/windows.xml b/data/oses/windows.xml
index 117a29c..8b4568f 100644
--- a/data/oses/windows.xml
+++ b/data/oses/windows.xml
@@ -4,6 +4,7 @@
     <short-id>windows</short-id>
     <name>Microsoft Windows</name>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
 
     <devices>
       <device id="http://pciids.sourceforge.net/v2.2/pci.ids/1234/1111"/>
@@ -16,6 +17,7 @@
     <name>Microsoft Windows XP</name>
     <version>5.1</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
   </os>
 
@@ -24,6 +26,7 @@
     <name>Microsoft Windows XP (x86_64)</name>
     <version>5.2</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
   </os>
 
@@ -32,6 +35,7 @@
     <name>Microsoft Windows 2000</name>
     <version>5.0</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
   </os>
 
@@ -40,6 +44,7 @@
     <name>Microsoft Windows Server 2003</name>
     <version>5.2</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
   </os>
 
@@ -48,6 +53,7 @@
     <name>Microsoft Windows Server 2008</name>
     <version>6.0</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
     <upgrades id="http://microsoft.com/win2k3"/>
   </os>
@@ -57,6 +63,7 @@
     <name>Microsoft Windows Vista</name>
     <version>6.0</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
     <upgrades id="http://microsoft.com/winxp"/>
   </os>
@@ -66,6 +73,7 @@
     <name>Microsoft Windows 7</name>
     <version>6.1</version>
     <vendor>Microsoft</vendor>
+    <family>Windows</family>
     <derives id="http://microsoft.com/windows"/>
     <upgrades id="http://microsoft.com/vista"/>
   </os>
diff --git a/docs/reference/Libosinfo-sections.txt b/docs/reference/Libosinfo-sections.txt
index f5fc2e4..e7e9b8b 100644
--- a/docs/reference/Libosinfo-sections.txt
+++ b/docs/reference/Libosinfo-sections.txt
@@ -110,6 +110,7 @@ osinfo_os_new
 osinfo_os_get_devices
 osinfo_os_get_device_links
 osinfo_os_add_device
+osinfo_os_get_family
 <SUBSECTION Standard>
 OSINFO_OS
 OSINFO_IS_OS
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 80579b0..47d0449 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -109,6 +109,7 @@ LIBOSINFO_0.0.1 {
 	osinfo_os_get_devices;
 	osinfo_os_get_device_links;
 	osinfo_os_add_device;
+	osinfo_os_get_family;
 	osinfo_oslist_get_type;
 	osinfo_oslist_new;
 	osinfo_oslist_new_copy;
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index e9a5682..a4ca6ff 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -486,6 +486,7 @@ static void osinfo_loader_os(OsinfoLoader *loader,
 {
     gchar *id = (gchar *)xmlGetProp(root, BAD_CAST "id");
     const gchar *const keys[] = {
+        OSINFO_OS_PROP_FAMILY,
         NULL
     };
     if (!id) {
diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 1ae29fb..1c77fa1 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -51,6 +51,11 @@ struct _OsinfoOsDeviceLink {
     gchar *driver;
 };
 
+enum OSI_OS_PROPERTIES {
+    OSI_OS_PROP_0,
+
+    OSI_OS_FAMILY,
+};
 
 static void osinfo_os_finalize (GObject *object);
 
@@ -59,6 +64,27 @@ static void osinfo_device_link_free(gpointer data, gpointer opaque G_GNUC_UNUSED
     g_object_unref(OSINFO_DEVICELINK(data));
 }
 
+static void
+osinfo_os_get_property (GObject    *object,
+                        guint       property_id,
+                        GValue     *value,
+                        GParamSpec *pspec)
+{
+    OsinfoEntity *entity = OSINFO_ENTITY (object);
+
+    switch (property_id)
+        {
+        case OSI_OS_FAMILY:
+            g_value_set_string (value,
+                                osinfo_entity_get_param_value (entity,
+                                                               "family"));
+            break;
+        default:
+            /* We don't have any other property... */
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+            break;
+        }
+}
 
 static void
 osinfo_os_finalize (GObject *object)
@@ -77,11 +103,31 @@ static void
 osinfo_os_class_init (OsinfoOsClass *klass)
 {
     GObjectClass *g_klass = G_OBJECT_CLASS (klass);
+    GParamSpec *pspec;
 
+    g_klass->get_property = osinfo_os_get_property;
     g_klass->finalize = osinfo_os_finalize;
+
     g_type_class_add_private (klass, sizeof (OsinfoOsPrivate));
-}
 
+    /**
+     * OsinfoOs:family:
+     *
+     * The generic family this OS belongs to, for example Linux, Windows,
+     * Solaris, UNIX etc.
+     */
+    pspec = g_param_spec_string ("family",
+                                 "FAMILY",
+                                 "Generic Family",
+                                 NULL /* default value */,
+                                 G_PARAM_READABLE |
+                                 G_PARAM_STATIC_NAME |
+                                 G_PARAM_STATIC_NICK |
+                                 G_PARAM_STATIC_BLURB);
+    g_object_class_install_property (g_klass,
+                                     OSI_OS_FAMILY,
+                                     pspec);
+}
 
 static void
 osinfo_os_init (OsinfoOs *os)
@@ -92,7 +138,6 @@ osinfo_os_init (OsinfoOs *os)
     os->priv->deviceLinks = NULL;
 }
 
-
 /**
  * osinfo_os_new:
  * @id: a unique identifier
@@ -197,6 +242,23 @@ OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev)
 
     return link;
 }
+
+/**
+ * osinfo_os_get_id:
+ * @os: a OsinfoOs
+ *
+ * Retrieves the generic family the OS @os belongs to, for example Linux,
+ * Windows, Solaris, UNIX etc.
+ *
+ * Returns: (transfer none): the family of this os
+ */
+const gchar *osinfo_os_get_family(OsinfoOs *os)
+{
+    g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
+
+    return osinfo_entity_get_param_value(OSINFO_ENTITY(os), "family");
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h
index 148ea33..f9ffb30 100644
--- a/osinfo/osinfo_os.h
+++ b/osinfo/osinfo_os.h
@@ -46,6 +46,8 @@ typedef struct _OsinfoOsClass   OsinfoOsClass;
 
 typedef struct _OsinfoOsPrivate OsinfoOsPrivate;
 
+#define OSINFO_OS_PROP_FAMILY    "family"
+
 /* object */
 struct _OsinfoOs
 {
@@ -73,6 +75,7 @@ OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter);
 OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoFilter *filter);
 
 OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev);
+const gchar *osinfo_os_get_family(OsinfoOs *os);
 
 #endif /* __OSINFO_OS_H__ */
 /*
-- 
1.7.5.4




More information about the virt-tools-list mailing list