[libvirt-glib 2/3] Add GVirConfigDomainCpuModel class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a class to represent 'model' node under domain/cpu.
---
 libvirt-gconfig/Makefile.am                        |  2 +
 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c | 94 ++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h | 72 +++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym                |  5 ++
 5 files changed, 174 insertions(+)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 8a3ff0d..8ad1cc9 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -37,6 +37,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-domain-controller-usb.h \
 			libvirt-gconfig-domain-cpu.h \
 			libvirt-gconfig-domain-cpu-feature.h \
+			libvirt-gconfig-domain-cpu-model.h \
 			libvirt-gconfig-domain-device.h \
 			libvirt-gconfig-domain-disk.h \
 			libvirt-gconfig-domain-disk-driver.h \
@@ -125,6 +126,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-domain-controller-usb.c \
 			libvirt-gconfig-domain-cpu.c \
 			libvirt-gconfig-domain-cpu-feature.c \
+			libvirt-gconfig-domain-cpu-model.c \
 			libvirt-gconfig-domain-device.c \
 			libvirt-gconfig-domain-disk.c \
 			libvirt-gconfig-domain-disk-driver.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c
new file mode 100644
index 0000000..514a2e3
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c
@@ -0,0 +1,94 @@
+/*
+ * libvirt-gconfig-domain-cpu-model.c: libvirt domain CPU model
+ *
+ * Copyright (C) 2014 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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Zeeshan Ali <zeenix@xxxxxxxxxx>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_CPU_MODEL_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModelPrivate))
+
+struct _GVirConfigDomainCpuModelPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainCpuModel, gvir_config_domain_cpu_model, GVIR_CONFIG_TYPE_OBJECT);
+
+static void gvir_config_domain_cpu_model_class_init(GVirConfigDomainCpuModelClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainCpuModelPrivate));
+}
+
+static void gvir_config_domain_cpu_model_init(GVirConfigDomainCpuModel *model)
+{
+    g_debug("Init GVirConfigDomainCpuModel=%p", model);
+
+    model->priv = GVIR_CONFIG_DOMAIN_CPU_MODEL_GET_PRIVATE(model);
+}
+
+GVirConfigDomainCpuModel *gvir_config_domain_cpu_model_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL,
+                                    "model",
+                                    NULL);
+
+    return GVIR_CONFIG_DOMAIN_CPU_MODEL(object);
+}
+
+GVirConfigDomainCpuModel *
+gvir_config_domain_cpu_model_new_from_xml(const gchar *xml, GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL,
+                                             "model",
+                                             NULL,
+                                             xml,
+                                             error);
+
+    return GVIR_CONFIG_DOMAIN_CPU_MODEL(object);
+}
+
+void
+gvir_config_domain_cpu_model_set_name(GVirConfigDomainCpuModel *model,
+                                      const gchar *name)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_CPU_MODEL(model));
+
+    gvir_config_object_set_node_content
+                (GVIR_CONFIG_OBJECT(model),
+                 NULL,
+                 name);
+}
+
+const gchar *
+gvir_config_domain_cpu_model_get_name(GVirConfigDomainCpuModel *model)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_CPU_MODEL(model), NULL);
+
+    return gvir_config_object_get_node_content (GVIR_CONFIG_OBJECT(model),
+                                                NULL);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h
new file mode 100644
index 0000000..5ae9d14
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h
@@ -0,0 +1,72 @@
+/*
+ * libvirt-gconfig-domain-cpu-model.h: libvirt domain CPU model
+ *
+ * Copyright (C) 2014 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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Zeeshan Ali <zeenix@xxxxxxxxxx>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_CPU_MODEL_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_CPU_MODEL_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL            (gvir_config_domain_cpu_model_get_type ())
+#define GVIR_CONFIG_DOMAIN_CPU_MODEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModel))
+#define GVIR_CONFIG_DOMAIN_CPU_MODEL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModelClass))
+#define GVIR_CONFIG_IS_DOMAIN_CPU_MODEL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL))
+#define GVIR_CONFIG_IS_DOMAIN_CPU_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL))
+#define GVIR_CONFIG_DOMAIN_CPU_MODEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModelClass))
+
+typedef struct _GVirConfigDomainCpuModel GVirConfigDomainCpuModel;
+typedef struct _GVirConfigDomainCpuModelPrivate GVirConfigDomainCpuModelPrivate;
+typedef struct _GVirConfigDomainCpuModelClass GVirConfigDomainCpuModelClass;
+
+struct _GVirConfigDomainCpuModel
+{
+    GVirConfigCapabilitiesCpu parent;
+
+    GVirConfigDomainCpuModelPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainCpuModelClass
+{
+    GVirConfigCapabilitiesCpuClass parent_class;
+
+    gpointer padding[20];
+};
+
+GType gvir_config_domain_cpu_model_get_type(void);
+GVirConfigDomainCpuModel *gvir_config_domain_cpu_model_new(void);
+GVirConfigDomainCpuModel *
+gvir_config_domain_cpu_model_new_from_xml(const gchar *xml, GError **error);
+
+void
+gvir_config_domain_cpu_model_set_name(GVirConfigDomainCpuModel *model,
+                                      const gchar *name);
+const gchar *
+gvir_config_domain_cpu_model_get_name(GVirConfigDomainCpuModel *model);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_CPU_MODEL_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index b494154..b845976 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -54,6 +54,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-cpu.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-cpu-feature.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-disk-driver.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 86dada6..1ad7e18 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -702,6 +702,11 @@ global:
 	gvir_config_domain_chardev_source_spiceport_new;
 	gvir_config_domain_chardev_source_spiceport_new_from_xml;
 	gvir_config_domain_chardev_source_spiceport_set_channel;
+
+	gvir_config_domain_cpu_model_get_type;
+	gvir_config_domain_cpu_model_new;
+	gvir_config_domain_cpu_model_get_name;
+	gvir_config_domain_cpu_model_set_name;
 } LIBVIRT_GCONFIG_0.1.8;
 
 # .... define new API here using predicted next version number ....
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]