[libvirt] [PATCH v4 1/4] domain_conf: separate structures from virDomainDef

Pavel Hrdina phrdina at redhat.com
Thu Sep 18 08:39:20 UTC 2014


Cleanup virDomanDef structure from other nested structure and create
separate type definition for them.

Fix a typo in virDomainHugePage.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/conf/domain_conf.h | 102 +++++++++++++++++++++++++++++--------------------
 1 file changed, 61 insertions(+), 41 deletions(-)

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 640a4c5..62faa7d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1890,14 +1890,69 @@ struct _virDomainResourceDef {
     char *partition;
 };
 
-typedef struct _virDomaiHugePage virDomainHugePage;
+typedef struct _virDomainHugePage virDomainHugePage;
 typedef virDomainHugePage *virDomainHugePagePtr;
 
-struct _virDomaiHugePage {
+struct _virDomainHugePage {
     virBitmapPtr nodemask;      /* guest's NUMA node mask */
     unsigned long long size;    /* hugepage size in KiB */
 };
 
+typedef struct _virDomainCputune virDomainCputune;
+typedef virDomainCputune *virDomainCputunePtr;
+
+struct _virDomainCputune {
+    unsigned long shares;
+    bool sharesSpecified;
+    unsigned long long period;
+    long long quota;
+    unsigned long long emulator_period;
+    long long emulator_quota;
+    size_t nvcpupin;
+    virDomainVcpuPinDefPtr *vcpupin;
+    virDomainVcpuPinDefPtr emulatorpin;
+    size_t niothreadspin;
+    virDomainVcpuPinDefPtr *iothreadspin;
+};
+
+typedef struct _virDomainBlkiotune virDomainBlkiotune;
+typedef virDomainBlkiotune *virDomainBlkiotunePtr;
+
+struct _virDomainBlkiotune {
+    unsigned int weight;
+
+    size_t ndevices;
+    virBlkioDevicePtr devices;
+};
+
+typedef struct _virDomainMemtune virDomainMemtune;
+typedef virDomainMemtune *virDomainMemtunePtr;
+
+struct _virDomainMemtune {
+    unsigned long long max_balloon; /* in kibibytes */
+    unsigned long long cur_balloon; /* in kibibytes */
+
+    virDomainHugePagePtr hugepages;
+    size_t nhugepages;
+
+    bool nosharepages;
+    bool locked;
+    int dump_core; /* enum virTristateSwitch */
+    unsigned long long hard_limit; /* in kibibytes */
+    unsigned long long soft_limit; /* in kibibytes */
+    unsigned long long min_guarantee; /* in kibibytes */
+    unsigned long long swap_hard_limit; /* in kibibytes */
+};
+
+typedef struct _virDomainPowerManagement virDomainPowerManagement;
+typedef virDomainPowerManagement *virDomainPowerManagementPtr;
+
+struct _virDomainPowerManagement {
+    /* These options are of type enum virTristateBool */
+    int s3;
+    int s4;
+};
+
 /*
  * Guest VM main configuration
  *
@@ -1914,28 +1969,9 @@ struct _virDomainDef {
     char *title;
     char *description;
 
-    struct {
-        unsigned int weight;
-
-        size_t ndevices;
-        virBlkioDevicePtr devices;
-    } blkio;
+    virDomainBlkiotune blkio;
+    virDomainMemtune mem;
 
-    struct {
-        unsigned long long max_balloon; /* in kibibytes */
-        unsigned long long cur_balloon; /* in kibibytes */
-
-        virDomainHugePagePtr hugepages;
-        size_t nhugepages;
-
-        bool nosharepages;
-        bool locked;
-        int dump_core; /* enum virTristateSwitch */
-        unsigned long long hard_limit; /* in kibibytes */
-        unsigned long long soft_limit; /* in kibibytes */
-        unsigned long long min_guarantee; /* in kibibytes */
-        unsigned long long swap_hard_limit; /* in kibibytes */
-    } mem;
     unsigned short vcpus;
     unsigned short maxvcpus;
     int placement_mode;
@@ -1943,19 +1979,7 @@ struct _virDomainDef {
 
     unsigned int iothreads;
 
-    struct {
-        unsigned long shares;
-        bool sharesSpecified;
-        unsigned long long period;
-        long long quota;
-        unsigned long long emulator_period;
-        long long emulator_quota;
-        size_t nvcpupin;
-        virDomainVcpuPinDefPtr *vcpupin;
-        virDomainVcpuPinDefPtr emulatorpin;
-        size_t niothreadspin;
-        virDomainVcpuPinDefPtr *iothreadspin;
-    } cputune;
+    virDomainCputune cputune;
 
     virDomainNumatunePtr numatune;
     virDomainResourceDefPtr resource;
@@ -1968,11 +1992,7 @@ struct _virDomainDef {
 
     int onLockFailure; /* enum virDomainLockFailureAction */
 
-    struct {
-        /* These options are of type enum virTristateBool */
-        int s3;
-        int s4;
-    } pm;
+    virDomainPowerManagement pm;
 
     virDomainOSDef os;
     char *emulator;
-- 
1.8.5.5




More information about the libvir-list mailing list