[virt-tools-list] [PATCH 39/47] Pull OS relationship filtering into a subclass

Daniel P. Berrange berrange at redhat.com
Wed Aug 25 19:37:34 UTC 2010


The base filter object should only be concerned with
filtering OsinfoEntity objects. Filtering OsinfoOs
objects should be done by a sub-class.

* osinfo/osinfo_filter.c, osinfo/osinfo_filter.h: Remove
  OS relationship filtering
* osinfo/osinfo_osfilter.c, osinfo/osinfo_osfilter.h:
  New object to handle OS relationship filtering
* osinfo/osinfo_entity.h, osinfo/osinfo_hypervisor.h,
  osinfo/osinfo_os.h: Tweak some typedefs to santize
  build ordering constraints
* osinfo/osinfo.h: Re-arrange include ordering to
  match declaration usage
---
 osinfo/Makefile.am         |   18 +++--
 osinfo/osinfo.h            |    7 +-
 osinfo/osinfo_entity.h     |    2 -
 osinfo/osinfo_filter.c     |  139 +++------------------------------
 osinfo/osinfo_filter.h     |   11 +--
 osinfo/osinfo_hypervisor.h |    2 -
 osinfo/osinfo_os.h         |    4 -
 osinfo/osinfo_osfilter.c   |  182 ++++++++++++++++++++++++++++++++++++++++++++
 osinfo/osinfo_osfilter.h   |   56 ++++++++++++++
 9 files changed, 268 insertions(+), 153 deletions(-)
 create mode 100644 osinfo/osinfo_osfilter.c
 create mode 100644 osinfo/osinfo_osfilter.h

diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 5d61779..cbe56d7 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -22,18 +22,20 @@ libosinfo_include_HEADERS = 		\
   osinfo_hypervisorlist.h		\
   osinfo_list.h		\
   osinfo_os.h		\
+  osinfo_osfilter.h     \
   osinfo_oslist.h
 
 libosinfo_la_SOURCES =		\
-  osinfo_dataread.c		\
-  osinfo_device.c		\
-  osinfo_devicelist.c		\
   osinfo_entity.c		\
   osinfo_filter.c		\
-  osinfo_hypervisor.c	\
+  osinfo_list.c			\
+  osinfo_device.c		\
+  osinfo_devicelist.c		\
+  osinfo_hypervisor.c		\
   osinfo_hypervisorlist.c	\
-  osinfo_list.c	\
-  osinfo_oslist.c	\
-  osinfo_db.c			\
-  osinfo_os.c
+  osinfo_osfilter.c		\
+  osinfo_oslist.c		\
+  osinfo_os.c			\
+  osinfo_dataread.c		\
+  osinfo_db.c
 
diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h
index e652a32..9e8ec3e 100644
--- a/osinfo/osinfo.h
+++ b/osinfo/osinfo.h
@@ -3,14 +3,15 @@
 
 #include <glib-object.h>
 #include <osinfo/osinfo_entity.h>
+#include <osinfo/osinfo_filter.h>
 #include <osinfo/osinfo_list.h>
+#include <osinfo/osinfo_device.h>
 #include <osinfo/osinfo_devicelist.h>
-#include <osinfo/osinfo_oslist.h>
 #include <osinfo/osinfo_hypervisorlist.h>
-#include <osinfo/osinfo_device.h>
 #include <osinfo/osinfo_hypervisor.h>
+#include <osinfo/osinfo_oslist.h>
 #include <osinfo/osinfo_os.h>
-#include <osinfo/osinfo_filter.h>
+#include <osinfo/osinfo_osfilter.h>
 #include <osinfo/osinfo_db.h>
 
 #endif
diff --git a/osinfo/osinfo_entity.h b/osinfo/osinfo_entity.h
index ad78324..30719b6 100644
--- a/osinfo/osinfo_entity.h
+++ b/osinfo/osinfo_entity.h
@@ -19,8 +19,6 @@
 #define OSINFO_ENTITY_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_ENTITY, OsinfoEntityClass))
 
 typedef struct _OsinfoEntity        OsinfoEntity;
-/* Temp hack */
-typedef struct _OsinfoFilter        OsinfoFilter;
 
 typedef struct _OsinfoEntityClass   OsinfoEntityClass;
 
diff --git a/osinfo/osinfo_filter.c b/osinfo/osinfo_filter.c
index 05cc39c..856ad74 100644
--- a/osinfo/osinfo_filter.c
+++ b/osinfo/osinfo_filter.c
@@ -9,15 +9,11 @@ struct _OsinfoFilterPrivate
     // Key: Constraint name
     // Value: GList of constraint values
     GHashTable *propertyConstraints;
-
-    // Key: relationship type
-    // Value: GList of OsinfoOs *
-    // Note: Only used when filtering OsinfoOs objects
-    GHashTable *relationshipConstraints;
 };
 
 
 static void osinfo_filter_finalize (GObject *object);
+static gboolean osinfo_filter_matches_default(OsinfoFilter *self, OsinfoEntity *entity);
 
 static void
 osinfo_filter_finalize (GObject *object)
@@ -25,7 +21,6 @@ osinfo_filter_finalize (GObject *object)
     OsinfoFilter *self = OSINFO_FILTER (object);
 
     g_hash_table_unref(self->priv->propertyConstraints);
-    g_hash_table_unref(self->priv->relationshipConstraints);
 
     /* Chain up to the parent class */
     G_OBJECT_CLASS (osinfo_filter_parent_class)->finalize (object);
@@ -39,6 +34,8 @@ osinfo_filter_class_init (OsinfoFilterClass *klass)
 
     g_klass->finalize = osinfo_filter_finalize;
     g_type_class_add_private (klass, sizeof (OsinfoFilterPrivate));
+
+    klass->matches = osinfo_filter_matches_default;
 }
 
 
@@ -62,18 +59,6 @@ osinfo_filter_prop_constraints_free(gpointer props)
 
 
 static void
-osinfo_filter_relshp_constraint_free(gpointer value, gpointer opaque G_GNUC_UNUSED)
-{
-    g_object_unref(value);
-}
-
-static void
-osinfo_filter_relshp_constraints_free(gpointer relshps)
-{
-    g_list_foreach(relshps, osinfo_filter_relshp_constraint_free, NULL);
-}
-
-static void
 osinfo_filter_init (OsinfoFilter *self)
 {
     OsinfoFilterPrivate *priv;
@@ -85,13 +70,6 @@ osinfo_filter_init (OsinfoFilter *self)
 			      g_str_equal,
 			      g_free,
 			      osinfo_filter_prop_constraints_free);
-
-
-    self->priv->relationshipConstraints =
-        g_hash_table_new_full(g_int_hash,
-			      g_int_equal,
-			      NULL,
-			      osinfo_filter_relshp_constraints_free);
 }
 
 
@@ -118,44 +96,14 @@ gint osinfo_filter_add_constraint(OsinfoFilter *self, gchar *propName, gchar *pr
     return 0;
 }
 
-// Only applicable to OSes, ignored by other types of objects
-gint osinfo_filter_add_relation_constraint(OsinfoFilter *self, OsinfoOsRelationship relshp, OsinfoOs *os)
-{
-    g_return_val_if_fail(OSINFO_IS_FILTER(self), -1);
-    g_return_val_if_fail(OSINFO_IS_OS(os), -1);
-
-    // First check if there exists an array of entries for this key
-    // If not, create a ptrarray of strings for this key and insert into map
-    gboolean found;
-    gpointer origKey, foundValue;
-    GList *values = NULL;
-
-    found = g_hash_table_lookup_extended(self->priv->relationshipConstraints, GINT_TO_POINTER(relshp), &origKey, &foundValue);
-    if (found) {
-        values = foundValue;
-        g_hash_table_steal(self->priv->propertyConstraints, GINT_TO_POINTER(relshp));
-    }
-    g_object_ref(os);
-    values = g_list_prepend(values, os);
-    g_hash_table_insert(self->priv->propertyConstraints, GINT_TO_POINTER(relshp), values);
-
-    return 0;
-}
-
 void osinfo_filter_clear_constraint(OsinfoFilter *self, gchar *propName)
 {
     g_hash_table_remove(self->priv->propertyConstraints, propName);
 }
 
-void osinfo_filter_clear_relationship_constraint(OsinfoFilter *self, OsinfoOsRelationship relshp)
-{
-    g_hash_table_remove(self->priv->relationshipConstraints, (gpointer) relshp);
-}
-
-void osinfo_filter_clear_all_constraints(OsinfoFilter *self)
+void osinfo_filter_clear_constraints(OsinfoFilter *self)
 {
     g_hash_table_remove_all(self->priv->propertyConstraints);
-    g_hash_table_remove_all(self->priv->relationshipConstraints);
 }
 
 // get keyset for constraints map
@@ -175,28 +123,6 @@ GList *osinfo_filter_get_constraint_values(OsinfoFilter *self, gchar *propName)
     return g_hash_table_lookup(self->priv->propertyConstraints, propName);
 }
 
-// get oses for given relshp
-OsinfoOsList *osinfo_filter_get_relationship_constraint_value(OsinfoFilter *self, OsinfoOsRelationship relshp)
-{
-    g_return_val_if_fail(OSINFO_IS_FILTER(self), NULL);
-
-    // Create our list
-    OsinfoOsList *newList = g_object_new(OSINFO_TYPE_OSLIST, NULL);
-
-    GPtrArray *relatedOses = NULL;
-    relatedOses = g_hash_table_lookup(self->priv->relationshipConstraints, GINT_TO_POINTER(relshp));
-    if (relatedOses) {
-        int i, len;
-        len = relatedOses->len;
-        for (i = 0; i < len; i++) {
-             OsinfoOs *os = g_ptr_array_index(relatedOses, i);
-	     osinfo_list_add(OSINFO_LIST (newList), OSINFO_ENTITY (os));
-        }
-    }
-
-    return newList;
-}
-
 
 struct osinfo_filter_match_args {
     OsinfoFilter *self;
@@ -241,45 +167,7 @@ static void osinfo_filter_match_iterator(gpointer key, gpointer value, gpointer
 }
 
 
-static void osinfo_filter_match_relation_iterator(gpointer key, gpointer value, gpointer data)
-{
-    struct osinfo_filter_match_args *args = data;
-    OsinfoOs *os = OSINFO_OS(args->entity);
-    OsinfoOsRelationship relshp = GPOINTER_TO_INT(key);
-    GList *relOses = value;
-    OsinfoOsList *oslist = osinfo_os_get_related(os, relshp);
-    gboolean ret = TRUE;
-
-    if (relOses && osinfo_list_get_length(OSINFO_LIST(oslist)) == 0) {
-        ret = FALSE;
-	goto cleanup;
-    }
-
-    while (relOses) {
-        OsinfoOs *currOs = relOses->data;
-        int i;
-	gboolean found = FALSE;
-	for (i = 0 ; i < osinfo_list_get_length(OSINFO_LIST(oslist)) ; i++) {
-	    OsinfoOs *testOs = OSINFO_OS(osinfo_list_get_nth(OSINFO_LIST(oslist), i));
-            if (testOs == currOs) {
-                found = TRUE;
-                break;
-            }
-        }
-        if (!found) {
-	    ret = FALSE;
-	    goto cleanup;
-	}
-
-	relOses = relOses->next;
-    }
-
- cleanup:
-    g_object_unref(oslist);
-    args->matched = ret;
-}
-
-gboolean osinfo_filter_matches(OsinfoFilter *self, OsinfoEntity *entity)
+static gboolean osinfo_filter_matches_default(OsinfoFilter *self, OsinfoEntity *entity)
 {
     g_return_val_if_fail(OSINFO_IS_FILTER(self), FALSE);
     g_return_val_if_fail(OSINFO_IS_ENTITY(entity), FALSE);
@@ -289,16 +177,13 @@ gboolean osinfo_filter_matches(OsinfoFilter *self, OsinfoEntity *entity)
 			 osinfo_filter_match_iterator,
 			 &args);
 
-    if (!args.matched)
-        return FALSE;
+    return args.matched;
+}
 
-    if (OSINFO_IS_OS(self)) {
-        g_hash_table_foreach(self->priv->relationshipConstraints,
-			     osinfo_filter_match_relation_iterator,
-			     &args);
-	if (!args.matched)
-	    return FALSE;
-    }
+gboolean osinfo_filter_matches(OsinfoFilter *self, OsinfoEntity *entity)
+{
+    g_return_val_if_fail(OSINFO_IS_FILTER(self), FALSE);
+    g_return_val_if_fail(OSINFO_IS_ENTITY(entity), FALSE);
 
-    return TRUE;
+    return OSINFO_FILTER_GET_CLASS(self)->matches(self, entity);
 }
diff --git a/osinfo/osinfo_filter.h b/osinfo/osinfo_filter.h
index 18b0be8..cec406d 100644
--- a/osinfo/osinfo_filter.h
+++ b/osinfo/osinfo_filter.h
@@ -18,7 +18,7 @@
 #define OSINFO_IS_FILTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_FILTER))
 #define OSINFO_FILTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_FILTER, OsinfoFilterClass))
 
-//typedef struct _OsinfoFilter        OsinfoFilter;
+typedef struct _OsinfoFilter        OsinfoFilter;
 
 typedef struct _OsinfoFilterClass  OsinfoFilterClass;
 
@@ -41,6 +41,8 @@ struct _OsinfoFilterClass
     GObjectClass parent_class;
 
     /* class members */
+
+    gboolean (*matches)(OsinfoFilter *self, OsinfoEntity *entity);
 };
 
 GType osinfo_filter_get_type(void);
@@ -49,16 +51,11 @@ OsinfoFilter *osinfo_filter_new(void);
 
 gint osinfo_filter_add_constraint(OsinfoFilter *self, gchar *propName, gchar *propVal);
 
-// Only applicable to OSes, ignored by other types of objects
-gint osinfo_filter_add_relation_constraint(OsinfoFilter *self, OsinfoOsRelationship relshp, OsinfoOs *os);
-
 void osinfo_filter_clear_constraint(OsinfoFilter *self, gchar *propName);
-void osinfo_filter_clear_relationship_constraint(OsinfoFilter *self, OsinfoOsRelationship relshp);
-void osinfo_filter_clear_all_constraints(OsinfoFilter *self);
+void osinfo_filter_clear_constraints(OsinfoFilter *self);
 
 GList *osinfo_filter_get_constraint_keys(OsinfoFilter *self);
 GList *osinfo_filter_get_constraint_values(OsinfoFilter *self, gchar *propName);
-OsinfoOsList *osinfo_filter_get_relationship_constraint_value(OsinfoFilter *self, OsinfoOsRelationship relshp);
 
 gboolean osinfo_filter_matches(OsinfoFilter *self,
 			       OsinfoEntity *entity);
diff --git a/osinfo/osinfo_hypervisor.h b/osinfo/osinfo_hypervisor.h
index bf2996d..cfa59b1 100644
--- a/osinfo/osinfo_hypervisor.h
+++ b/osinfo/osinfo_hypervisor.h
@@ -8,8 +8,6 @@
 #ifndef __OSINFO_HYPERVISOR_H__
 #define __OSINFO_HYPERVISOR_H__
 
-#include "osinfo_devicelist.h"
-
 /*
  * Type macros.
  */
diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h
index 8c0a565..6c1a447 100644
--- a/osinfo/osinfo_os.h
+++ b/osinfo/osinfo_os.h
@@ -8,10 +8,6 @@
 #ifndef __OSINFO_OS_H__
 #define __OSINFO_OS_H__
 
-#include <glib-object.h>
-#include "osinfo_oslist.h"
-#include "osinfo_devicelist.h"
-
 /*
  * Type macros.
  */
diff --git a/osinfo/osinfo_osfilter.c b/osinfo/osinfo_osfilter.c
new file mode 100644
index 0000000..c0b4386
--- /dev/null
+++ b/osinfo/osinfo_osfilter.c
@@ -0,0 +1,182 @@
+#include <osinfo/osinfo.h>
+
+G_DEFINE_TYPE (OsinfoOsfilter, osinfo_osfilter, OSINFO_TYPE_FILTER);
+
+#define OSINFO_OSFILTER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_OSFILTER, OsinfoOsfilterPrivate))
+
+struct _OsinfoOsfilterPrivate
+{
+    // Key: relationship type
+    // Value: GList of OsinfoOs *
+    // Note: Only used when osfiltering OsinfoOs objects
+    GHashTable *osConstraints;
+};
+
+
+static void osinfo_osfilter_finalize (GObject *object);
+static gboolean osinfo_osfilter_matches_default(OsinfoFilter *self, OsinfoEntity *entity);
+
+static void
+osinfo_osfilter_finalize (GObject *object)
+{
+    OsinfoOsfilter *self = OSINFO_OSFILTER (object);
+
+    g_hash_table_unref(self->priv->osConstraints);
+
+    /* Chain up to the parent class */
+    G_OBJECT_CLASS (osinfo_osfilter_parent_class)->finalize (object);
+}
+
+/* Init functions */
+static void
+osinfo_osfilter_class_init (OsinfoOsfilterClass *klass)
+{
+    GObjectClass *g_klass = G_OBJECT_CLASS(klass);
+    OsinfoFilterClass *filter_klass = OSINFO_FILTER_CLASS(klass);
+
+    g_klass->finalize = osinfo_osfilter_finalize;
+    g_type_class_add_private (klass, sizeof (OsinfoOsfilterPrivate));
+
+    filter_klass->matches = osinfo_osfilter_matches_default;
+}
+
+
+OsinfoOsfilter *osinfo_osfilter_new(void)
+{
+    return g_object_new(OSINFO_TYPE_OSFILTER, NULL);
+}
+
+
+static void
+osinfo_osfilter_os_constraint_free(gpointer value, gpointer opaque G_GNUC_UNUSED)
+{
+    g_object_unref(value);
+}
+
+static void
+osinfo_osfilter_os_constraints_free(gpointer relshps)
+{
+    g_list_foreach(relshps, osinfo_osfilter_os_constraint_free, NULL);
+}
+
+static void
+osinfo_osfilter_init (OsinfoOsfilter *self)
+{
+    OsinfoOsfilterPrivate *priv;
+    priv = OSINFO_OSFILTER_GET_PRIVATE(self);
+    self->priv = priv;
+
+    self->priv->osConstraints =
+        g_hash_table_new_full(g_int_hash,
+			      g_int_equal,
+			      NULL,
+			      osinfo_osfilter_os_constraints_free);
+}
+
+
+// Only applicable to OSes, ignored by other types of objects
+gint osinfo_osfilter_add_os_constraint(OsinfoOsfilter *self, OsinfoOsRelationship relshp, OsinfoOs *os)
+{
+    g_return_val_if_fail(OSINFO_IS_OSFILTER(self), -1);
+    g_return_val_if_fail(OSINFO_IS_OS(os), -1);
+
+    // First check if there exists an array of entries for this key
+    // If not, create a ptrarray of strings for this key and insert into map
+    gboolean found;
+    gpointer origKey, foundValue;
+    GList *values = NULL;
+
+    found = g_hash_table_lookup_extended(self->priv->osConstraints, GINT_TO_POINTER(relshp), &origKey, &foundValue);
+    if (found) {
+        values = foundValue;
+        g_hash_table_steal(self->priv->osConstraints, GINT_TO_POINTER(relshp));
+    }
+    g_object_ref(os);
+    values = g_list_prepend(values, os);
+    g_hash_table_insert(self->priv->osConstraints, GINT_TO_POINTER(relshp), values);
+
+    return 0;
+}
+
+void osinfo_osfilter_clear_os_constraint(OsinfoOsfilter *self, OsinfoOsRelationship relshp)
+{
+    g_hash_table_remove(self->priv->osConstraints, (gpointer) relshp);
+}
+
+void osinfo_osfilter_clear_os_constraints(OsinfoOsfilter *self)
+{
+    g_hash_table_remove_all(self->priv->osConstraints);
+}
+
+
+// get oses for given relshp
+GList *osinfo_osfilter_get_os_constraint_values(OsinfoOsfilter *self, OsinfoOsRelationship relshp)
+{
+    g_return_val_if_fail(OSINFO_IS_OSFILTER(self), NULL);
+
+    return g_hash_table_lookup(self->priv->osConstraints, GINT_TO_POINTER(relshp));
+}
+
+
+struct osinfo_osfilter_match_args {
+    OsinfoOsfilter *self;
+    OsinfoEntity *entity;
+    gboolean matched;
+};
+
+
+static void osinfo_osfilter_match_os_iterator(gpointer key, gpointer value, gpointer data)
+{
+    struct osinfo_osfilter_match_args *args = data;
+    OsinfoOs *os = OSINFO_OS(args->entity);
+    OsinfoOsRelationship relshp = GPOINTER_TO_INT(key);
+    GList *relOses = value;
+    OsinfoOsList *oslist = osinfo_os_get_related(os, relshp);
+    gboolean ret = TRUE;
+
+    if (relOses && osinfo_list_get_length(OSINFO_LIST(oslist)) == 0) {
+        ret = FALSE;
+	goto cleanup;
+    }
+
+    while (relOses) {
+        OsinfoOs *currOs = relOses->data;
+        int i;
+	gboolean found = FALSE;
+	for (i = 0 ; i < osinfo_list_get_length(OSINFO_LIST(oslist)) ; i++) {
+	    OsinfoOs *testOs = OSINFO_OS(osinfo_list_get_nth(OSINFO_LIST(oslist), i));
+            if (testOs == currOs) {
+                found = TRUE;
+                break;
+            }
+        }
+        if (!found) {
+	    ret = FALSE;
+	    goto cleanup;
+	}
+
+	relOses = relOses->next;
+    }
+
+ cleanup:
+    g_object_unref(oslist);
+    args->matched = ret;
+}
+
+static gboolean osinfo_osfilter_matches_default(OsinfoFilter *filter, OsinfoEntity *entity)
+{
+    g_return_val_if_fail(OSINFO_IS_OSFILTER(filter), FALSE);
+    g_return_val_if_fail(OSINFO_IS_OS(entity), FALSE);
+    OsinfoOsfilter *self = OSINFO_OSFILTER(filter);
+    struct osinfo_osfilter_match_args args = { self, entity, TRUE };
+
+    if (!OSINFO_FILTER_CLASS (osinfo_osfilter_parent_class)->matches(filter, entity))
+        return FALSE;
+
+    g_hash_table_foreach(self->priv->osConstraints,
+			 osinfo_osfilter_match_os_iterator,
+			 &args);
+
+    return args.matched;
+}
+
diff --git a/osinfo/osinfo_osfilter.h b/osinfo/osinfo_osfilter.h
new file mode 100644
index 0000000..2b8870a
--- /dev/null
+++ b/osinfo/osinfo_osfilter.h
@@ -0,0 +1,56 @@
+/*
+ * libosinfo
+ *
+ * osinfo_osfilter.h
+ * Represents a osfilter in libosinfo.
+ */
+
+#ifndef __OSINFO_OSFILTER_H__
+#define __OSINFO_OSFILTER_H__
+
+/*
+ * Type macros.
+ */
+#define OSINFO_TYPE_OSFILTER                  (osinfo_osfilter_get_type ())
+#define OSINFO_OSFILTER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_OSFILTER, OsinfoOsfilter))
+#define OSINFO_IS_OSFILTER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_OSFILTER))
+#define OSINFO_OSFILTER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_OSFILTER, OsinfoOsfilterClass))
+#define OSINFO_IS_OSFILTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_OSFILTER))
+#define OSINFO_OSFILTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_OSFILTER, OsinfoOsfilterClass))
+
+typedef struct _OsinfoOsfilter        OsinfoOsfilter;
+
+typedef struct _OsinfoOsfilterClass  OsinfoOsfilterClass;
+
+typedef struct _OsinfoOsfilterPrivate OsinfoOsfilterPrivate;
+
+/* object */
+struct _OsinfoOsfilter
+{
+    OsinfoFilter parent_instance;
+
+    /* public */
+
+    /* private */
+    OsinfoOsfilterPrivate *priv;
+};
+
+/* class */
+struct _OsinfoOsfilterClass
+{
+    OsinfoFilterClass parent_class;
+
+    /* class members */
+};
+
+GType osinfo_osfilter_get_type(void);
+
+OsinfoOsfilter *osinfo_osfilter_new(void);
+
+gint osinfo_osfilter_add_os_constraint(OsinfoOsfilter *self, OsinfoOsRelationship relshp, OsinfoOs *os);
+void osinfo_osfilter_clear_os_constraint(OsinfoOsfilter *self, OsinfoOsRelationship relshp);
+void osinfo_osfilter_clear_os_constraints(OsinfoOsfilter *self);
+
+GList *osinfo_osfilter_get_os_constraint_values(OsinfoOsfilter *self, OsinfoOsRelationship relshp);
+
+#endif /* __OSINFO_OSFILTER_H__ */
-- 
1.7.2.1




More information about the virt-tools-list mailing list