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

Re: [libvirt] [PATCH v2 1/2] Xen: move versions to struct



On 10/14/2011 04:58 AM, Philipp Hahn wrote:
Calling virInitialize() → xenRegister() → xenhypervisorInit() directly
opens a connection to the Xen Hypervisor, which breaks some unit tests.

Move all static variables into a struct to make it easier to override
them when testing.

Signed-off-by: Philipp Hahn<hahn univention de>
---
  src/xen/xen_hypervisor.c |  293 +++++++++++++++++++++++-----------------------
  src/xen/xen_hypervisor.h |    8 ++
  2 files changed, 156 insertions(+), 145 deletions(-)

Very mechanical, and makes sense.


diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 77085c9..da70c52 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -113,10 +113,13 @@ typedef privcmd_hypercall_t hypercall_t;
  static int xen_ioctl_hypercall_cmd = 0;
  static int initialized = 0;
  static int in_init = 0;
-static int hv_version = 0;
-static int hypervisor_version = 2;
-static int sys_interface_version = -1;
-static int dom_interface_version = -1;
+static struct xenHypervisorVersions hv_versions = {
+	.hv = 0,
+	.hypervisor = 2,
+	.sys_interface = -1,
+	.dom_interface = -1
+};

Indent with spaces, not tabs ('make syntax-check' caught this).

ACK with that fix, so pushed.

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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