1 /*
2  * libvirt-gconfig-domain-cpu-feature.h: libvirt domain CPU feature
3  *
4  * Copyright (C) 2010-2012 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  * Authors: Zeeshan Ali <zeenix@redhat.com>
21  *          Daniel P. Berrange <berrange@redhat.com>
22  */
23 
24 #if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
25 #error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
26 #endif
27 
28 #ifndef __LIBVIRT_GCONFIG_DOMAIN_CPU_FEATURE_H__
29 #define __LIBVIRT_GCONFIG_DOMAIN_CPU_FEATURE_H__
30 
31 G_BEGIN_DECLS
32 
33 #define GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE            (gvir_config_domain_cpu_feature_get_type ())
34 #define GVIR_CONFIG_DOMAIN_CPU_FEATURE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE, GVirConfigDomainCpuFeature))
35 #define GVIR_CONFIG_DOMAIN_CPU_FEATURE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE, GVirConfigDomainCpuFeatureClass))
36 #define GVIR_CONFIG_IS_DOMAIN_CPU_FEATURE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE))
37 #define GVIR_CONFIG_IS_DOMAIN_CPU_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE))
38 #define GVIR_CONFIG_DOMAIN_CPU_FEATURE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE, GVirConfigDomainCpuFeatureClass))
39 
40 typedef struct _GVirConfigDomainCpuFeature GVirConfigDomainCpuFeature;
41 typedef struct _GVirConfigDomainCpuFeaturePrivate GVirConfigDomainCpuFeaturePrivate;
42 typedef struct _GVirConfigDomainCpuFeatureClass GVirConfigDomainCpuFeatureClass;
43 
44 struct _GVirConfigDomainCpuFeature
45 {
46     GVirConfigCapabilitiesCpu parent;
47 
48     GVirConfigDomainCpuFeaturePrivate *priv;
49 
50     /* Do not add fields to this struct */
51 };
52 
53 struct _GVirConfigDomainCpuFeatureClass
54 {
55     GVirConfigCapabilitiesCpuClass parent_class;
56 
57     gpointer padding[20];
58 };
59 
60 typedef enum {
61     GVIR_CONFIG_DOMAIN_CPU_FEATURE_POLICY_FORCE,
62     GVIR_CONFIG_DOMAIN_CPU_FEATURE_POLICY_REQUIRE,
63     GVIR_CONFIG_DOMAIN_CPU_FEATURE_POLICY_OPTIONAL,
64     GVIR_CONFIG_DOMAIN_CPU_FEATURE_POLICY_DISABLE,
65     GVIR_CONFIG_DOMAIN_CPU_FEATURE_POLICY_FORBID
66 } GVirConfigDomainCpuFeaturePolicy;
67 
68 GType gvir_config_domain_cpu_feature_get_type(void);
69 GVirConfigDomainCpuFeature *gvir_config_domain_cpu_feature_new(void);
70 GVirConfigDomainCpuFeature *
71 gvir_config_domain_cpu_feature_new_from_xml(const gchar *xml, GError **error);
72 
73 void
74 gvir_config_domain_cpu_feature_set_policy(GVirConfigDomainCpuFeature *feature,
75                                           GVirConfigDomainCpuFeaturePolicy policy);
76 GVirConfigDomainCpuFeaturePolicy
77 gvir_config_domain_cpu_feature_get_policy(GVirConfigDomainCpuFeature *feature);
78 
79 G_END_DECLS
80 
81 #endif /* __LIBVIRT_GCONFIG_DOMAIN_CPU_FEATURE_H__ */
82