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

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

 



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@xxxxxxxxxxxxx>
---
  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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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