[PATCH 5/6] conf: introduce domain_format.h

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

 



Move functions related to domain XML formatting here.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/conf/Makefile.inc.am |  1 +
 src/conf/domain_conf.h   | 59 +-------------------------
 src/conf/domain_format.h | 89 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 58 deletions(-)
 create mode 100644 src/conf/domain_format.h

diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am
index 3afebb9c7d..4a683dc6a7 100644
--- a/src/conf/Makefile.inc.am
+++ b/src/conf/Makefile.inc.am
@@ -22,6 +22,7 @@ DOMAIN_CONF_SOURCES = \
 	conf/domain_conf.h \
 	conf/domain_audit.c \
 	conf/domain_audit.h \
+	conf/domain_format.h \
 	conf/domain_nwfilter.c \
 	conf/domain_nwfilter.h \
 	conf/domain_parse.h \
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index eb2b84ad03..2811ee9610 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -31,6 +31,7 @@
 #include "virdomaintypes.h"
 #include "virstorageencryption.h"
 #include "cpu_conf.h"
+#include "domain_format.h"
 #include "domain_parse.h"
 #include "virthread.h"
 #include "virsocketaddr.h"
@@ -215,21 +216,6 @@ virDomainDefPtr virDomainObjCopyPersistentDef(virDomainObjPtr dom,
                                               virCapsPtr caps,
                                               virDomainXMLOptionPtr xmlopt);
 
-typedef enum {
-    VIR_DOMAIN_DEF_FORMAT_SECURE          = 1 << 0,
-    VIR_DOMAIN_DEF_FORMAT_INACTIVE        = 1 << 1,
-    VIR_DOMAIN_DEF_FORMAT_MIGRATABLE      = 1 << 2,
-    /* format internal domain status information */
-    VIR_DOMAIN_DEF_FORMAT_STATUS          = 1 << 3,
-    /* format <actual> element */
-    VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET      = 1 << 4,
-    /* format original states of host PCI device */
-    VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES = 1 << 5,
-    VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM       = 1 << 6,
-    VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT      = 1 << 7,
-    VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST    = 1 << 8,
-} virDomainDefFormatFlags;
-
 int virDomainDefAddImplicitDevices(virDomainDefPtr def);
 
 virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(const virDomainDef *def,
@@ -238,49 +224,6 @@ virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def,
                                                  unsigned int iothread_id);
 void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id);
 
-/* When extending this list, remember that libvirt 1.2.12-5.0.0 had a
- * bug that silently ignored unknown flags.  A new flag to add
- * information is okay as long as clients still work when an older
- * server omits the requested output, but a new flag to suppress
- * information could result in a security hole when older libvirt
- * supplies the sensitive information in spite of the flag. */
-#define VIR_DOMAIN_XML_COMMON_FLAGS \
-    (VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_INACTIVE | \
-     VIR_DOMAIN_XML_MIGRATABLE)
-unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
-
-char *virDomainDefFormat(virDomainDefPtr def,
-                         virCapsPtr caps,
-                         unsigned int flags);
-char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
-                         virDomainObjPtr obj,
-                         virCapsPtr caps,
-                         unsigned int flags);
-int virDomainDefFormatInternal(virDomainDefPtr def,
-                               virCapsPtr caps,
-                               unsigned int flags,
-                               virBufferPtr buf,
-                               virDomainXMLOptionPtr xmlopt);
-
-int virDomainDiskSourceFormat(virBufferPtr buf,
-                              virStorageSourcePtr src,
-                              const char *element,
-                              int policy,
-                              bool attrIndex,
-                              unsigned int flags,
-                              virDomainXMLOptionPtr xmlopt);
-
-int
-virDomainDiskBackingStoreFormat(virBufferPtr buf,
-                                virStorageSourcePtr src,
-                                virDomainXMLOptionPtr xmlopt,
-                                unsigned int flags);
-
-int virDomainNetDefFormat(virBufferPtr buf,
-                          virDomainNetDefPtr def,
-                          char *prefix,
-                          unsigned int flags);
-
 int virDomainDefCompatibleDevice(virDomainDefPtr def,
                                  virDomainDeviceDefPtr dev,
                                  virDomainDeviceDefPtr oldDev,
diff --git a/src/conf/domain_format.h b/src/conf/domain_format.h
new file mode 100644
index 0000000000..3a8b49ddaa
--- /dev/null
+++ b/src/conf/domain_format.h
@@ -0,0 +1,89 @@
+/*
+<<<<<<< HEAD
+ * domain_format.h: XML formatter for the domain definition
+=======
+ * virconftypes.h: struct typedefs to avoid circular inclusion
+>>>>>>> 094a03dc8a... format
+ *
+ * Copyright (C) 2006-2019 Red Hat, Inc.
+ * Copyright (C) 2006-2008 Daniel P. Berrange
+ * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ *
+ * 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/>.
+ */
+
+#pragma once
+
+#include "internal.h"
+#include "virconftypes.h"
+#include "virdomaintypes.h"
+
+typedef enum {
+    VIR_DOMAIN_DEF_FORMAT_SECURE          = 1 << 0,
+    VIR_DOMAIN_DEF_FORMAT_INACTIVE        = 1 << 1,
+    VIR_DOMAIN_DEF_FORMAT_MIGRATABLE      = 1 << 2,
+    /* format internal domain status information */
+    VIR_DOMAIN_DEF_FORMAT_STATUS          = 1 << 3,
+    /* format <actual> element */
+    VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET      = 1 << 4,
+    /* format original states of host PCI device */
+    VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES = 1 << 5,
+    VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM       = 1 << 6,
+    VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT      = 1 << 7,
+    VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST    = 1 << 8,
+} virDomainDefFormatFlags;
+
+/* When extending this list, remember that libvirt 1.2.12-5.0.0 had a
+ * bug that silently ignored unknown flags.  A new flag to add
+ * information is okay as long as clients still work when an older
+ * server omits the requested output, but a new flag to suppress
+ * information could result in a security hole when older libvirt
+ * supplies the sensitive information in spite of the flag. */
+#define VIR_DOMAIN_XML_COMMON_FLAGS \
+    (VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_INACTIVE | \
+     VIR_DOMAIN_XML_MIGRATABLE)
+unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
+
+char *virDomainDefFormat(virDomainDefPtr def,
+                         virCapsPtr caps,
+                         unsigned int flags);
+char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
+                         virDomainObjPtr obj,
+                         virCapsPtr caps,
+                         unsigned int flags);
+int virDomainDefFormatInternal(virDomainDefPtr def,
+                               virCapsPtr caps,
+                               unsigned int flags,
+                               virBufferPtr buf,
+                               virDomainXMLOptionPtr xmlopt);
+
+int virDomainDiskSourceFormat(virBufferPtr buf,
+                              virStorageSourcePtr src,
+                              const char *element,
+                              int policy,
+                              bool attrIndex,
+                              unsigned int flags,
+                              virDomainXMLOptionPtr xmlopt);
+
+int
+virDomainDiskBackingStoreFormat(virBufferPtr buf,
+                                virStorageSourcePtr src,
+                                virDomainXMLOptionPtr xmlopt,
+                                unsigned int flags);
+
+int virDomainNetDefFormat(virBufferPtr buf,
+                          virDomainNetDefPtr def,
+                          char *prefix,
+                          unsigned int flags);
-- 
2.19.2

--
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]

  Powered by Linux