[virt-tools-list] [libosinfo][PATCH v2 3/7] device: Introduce SUBSYSTEM property

Michal Privoznik mprivozn at redhat.com
Fri Sep 21 14:38:12 UTC 2012


PCI IDs database allows devices to have subsystem so we
should reflect this in our model as well under optional
element <subsystem>.
---
 data/schemas/libosinfo.rng |    5 +++++
 osinfo/libosinfo.syms      |    5 +++++
 osinfo/osinfo_device.c     |    6 ++++++
 osinfo/osinfo_device.h     |    3 +++
 osinfo/osinfo_loader.c     |    1 +
 5 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 3e630af..6671406 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -75,6 +75,11 @@
             <ref name='hexid'/>
           </element>
         </optional>
+        <optional>
+          <element name='subsystem'>
+            <text/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 6060b1d..b8915a3 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -301,6 +301,11 @@ LIBOSINFO_0.2.0 {
 	osinfo_os_find_install_script;
 } LIBOSINFO_0.1.0;
 
+LIBOSINFO_0.2.1 {
+	global:
+	osinfo_device_get_subsystem;
+} LIBOSINFO_0.2.0;
+
 /* Symbols in next release...
 
   LIBOSINFO_0.0.2 {
diff --git a/osinfo/osinfo_device.c b/osinfo/osinfo_device.c
index 47d5e29..57b4529 100644
--- a/osinfo/osinfo_device.c
+++ b/osinfo/osinfo_device.c
@@ -20,6 +20,7 @@
  * Authors:
  *   Arjun Roy <arroy at redhat.com>
  *   Daniel P. Berrange <berrange at redhat.com>
+ *   Michal Privoznik <mprivozn at redhat.com>
  */
 
 #include <config.h>
@@ -115,6 +116,11 @@ const gchar *osinfo_device_get_name(OsinfoDevice *dev)
     return osinfo_entity_get_param_value(OSINFO_ENTITY(dev), OSINFO_DEVICE_PROP_NAME);
 }
 
+const gchar *osinfo_device_get_subsystem(OsinfoDevice *dev)
+{
+    return osinfo_entity_get_param_value(OSINFO_ENTITY(dev), OSINFO_DEVICE_PROP_SUBSYSTEM);
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/osinfo/osinfo_device.h b/osinfo/osinfo_device.h
index c31c530..240d583 100644
--- a/osinfo/osinfo_device.h
+++ b/osinfo/osinfo_device.h
@@ -20,6 +20,7 @@
  * Authors:
  *   Arjun Roy <arroy at redhat.com>
  *   Daniel P. Berrange <berrange at redhat.com>
+ *   Michal Privoznik <mprivozn at redhat.com>
  */
 
 #include <glib-object.h>
@@ -51,6 +52,7 @@ typedef struct _OsinfoDevicePrivate OsinfoDevicePrivate;
 #define OSINFO_DEVICE_PROP_NAME       "name"
 #define OSINFO_DEVICE_PROP_CLASS      "class"
 #define OSINFO_DEVICE_PROP_BUS_TYPE   "bus-type"
+#define OSINFO_DEVICE_PROP_SUBSYSTEM  "subsystem"
 
 /* object */
 struct _OsinfoDevice
@@ -83,6 +85,7 @@ const gchar *osinfo_device_get_product_id(OsinfoDevice *dev);
 const gchar *osinfo_device_get_bus_type(OsinfoDevice *dev);
 const gchar *osinfo_device_get_class(OsinfoDevice *dev);
 const gchar *osinfo_device_get_name(OsinfoDevice *dev);
+const gchar *osinfo_device_get_subsystem(OsinfoDevice *dev);
 
 #endif /* __OSINFO_DEVICE_H__ */
 /*
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 2867bab..ab507da 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -317,6 +317,7 @@ static void osinfo_loader_device(OsinfoLoader *loader,
         OSINFO_DEVICE_PROP_VENDOR_ID,
         OSINFO_DEVICE_PROP_PRODUCT,
         OSINFO_DEVICE_PROP_PRODUCT_ID,
+        OSINFO_DEVICE_PROP_SUBSYSTEM,
         OSINFO_DEVICE_PROP_BUS_TYPE,
         OSINFO_DEVICE_PROP_CLASS,
         OSINFO_DEVICE_PROP_NAME,
-- 
1.7.8.6




More information about the virt-tools-list mailing list