Re: [PATCH] qemu: Move some functions to qemu_capspriv.h

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

 



On Wed, Apr 05, 2017 at 04:41:57PM +0200, Andrea Bolognani wrote:
This header file has been created so that we can expose
internal functions to the test suite without making them
public: those in qemu_capabilities.h bearing the comment

 /* Only for use by test suite */

are obvious candidates for being moved over.
---
src/qemu/qemu_capabilities.h | 19 -------------------
src/qemu/qemu_capspriv.h     | 22 ++++++++++++++++++++++
tests/qemuhelptest.c         |  4 ++++
3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 24e2f38..cca9a12 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -473,11 +473,6 @@ bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps,
void virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
                                    const char *machineType);

-/* Only for use by test suite */
-void virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps,
-                                   virGICCapability *capabilities,
-                                   size_t ncapabilities);
-
virQEMUCapsCachePtr virQEMUCapsCacheNew(const char *libDir,
                                        const char *cacheDir,
                                        uid_t uid, gid_t gid);
@@ -499,20 +494,6 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps,
                                 virQEMUCapsCachePtr capsCache,
                                 unsigned int *version);

-/* Only for use by test suite */
-int virQEMUCapsParseHelpStr(const char *qemu,
-                            const char *str,
-                            virQEMUCapsPtr qemuCaps,
-                            unsigned int *version,
-                            bool *is_kvm,
-                            unsigned int *kvm_version,
-                            bool check_yajl,
-                            const char *qmperr);
-/* Only for use by test suite */
-int virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str);
-/* Only for use by test suite */
-void virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps);
-
VIR_ENUM_DECL(virQEMUCaps);

bool virQEMUCapsSupportsChardev(const virDomainDef *def,
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 61ccd45..9818859 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -84,6 +84,9 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
                        virCPUDefPtr cpu);

void
+virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps);
+
+void
virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
                           virDomainVirtType type,
                           qemuMonitorCPUModelInfoPtr modelInfo);
@@ -92,4 +95,23 @@ virCPUDefPtr
virQEMUCapsProbeHostCPUForEmulator(virCapsPtr caps,
                                   virQEMUCapsPtr qemuCaps,
                                   virDomainVirtType type);
+
+void
+virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps,
+                              virGICCapability *capabilities,
+                              size_t ncapabilities);
+
+int
+virQEMUCapsParseHelpStr(const char *qemu,
+                        const char *str,
+                        virQEMUCapsPtr qemuCaps,
+                        unsigned int *version,
+                        bool *is_kvm,
+                        unsigned int *kvm_version,
+                        bool check_yajl,
+                        const char *qmperr);
+
+int
+virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps,
+                          const char *str);
#endif
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index e3751b2..d80225c 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -8,6 +8,10 @@
# include <stdlib.h>

# include "qemu/qemu_capabilities.h"
+# define __QEMU_CAPSPRIV_H_ALLOW__
+# include "qemu/qemu_capspriv.h"
+# undef __QEMU_CAPSPRIV_H_ALLOW__
+

We should, ideally, make some global PRIV_ENABLE macro that would be set
in Makefile for all tests.  And all private headers would check that
macro.  We wouldn't need to add these in the tests, and it might
actually be a bit more future-proof.

# include "viralloc.h"
# include "virstring.h"

--
2.7.4

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

Attachment: signature.asc
Description: Digital signature

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