diff mbox

[06/33] kvm tools: move ioport_debug into struct kvm_config

Message ID 1346833927-15740-7-git-send-email-levinsasha928@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sasha Levin Sept. 5, 2012, 8:31 a.m. UTC
This config option was 'extern'ed between different objects. Clean it up
and move it into struct kvm_config.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/builtin-run.c            | 3 +--
 tools/kvm/include/kvm/kvm-config.h | 1 +
 tools/kvm/ioport.c                 | 5 ++---
 3 files changed, 4 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 8221c22..4a6ff1a 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -57,7 +57,6 @@  struct kvm *kvm;
 struct kvm_cpu **kvm_cpus;
 __thread struct kvm_cpu *current_kvm_cpu;
 
-extern bool ioport_debug;
 extern bool mmio_debug;
 static int  kvm_run_wrapper;
 extern int  active_console;
@@ -471,7 +470,7 @@  static int shmem_parser(const struct option *opt, const char *arg, int unset)
 			"Enable debug messages"),			\
 	OPT_BOOLEAN('\0', "debug-single-step", &(cfg)->single_step,	\
 			"Enable single stepping"),			\
-	OPT_BOOLEAN('\0', "debug-ioport", &ioport_debug,		\
+	OPT_BOOLEAN('\0', "debug-ioport", &(cfg)->ioport_debug,		\
 			"Enable ioport debugging"),			\
 	OPT_BOOLEAN('\0', "debug-mmio", &mmio_debug,			\
 			"Enable MMIO debugging"),			\
diff --git a/tools/kvm/include/kvm/kvm-config.h b/tools/kvm/include/kvm/kvm-config.h
index 3ffc2c2..f45edb0 100644
--- a/tools/kvm/include/kvm/kvm-config.h
+++ b/tools/kvm/include/kvm/kvm-config.h
@@ -48,6 +48,7 @@  struct kvm_config {
 	bool custom_rootfs;
 	bool no_net;
 	bool no_dhcp;
+	bool ioport_debug;
 };
 
 #endif
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
index 662a78b..2208c15 100644
--- a/tools/kvm/ioport.c
+++ b/tools/kvm/ioport.c
@@ -21,7 +21,6 @@  DEFINE_MUTEX(ioport_mutex);
 static u16			free_io_port_idx; /* protected by ioport_mutex */
 
 static struct rb_root		ioport_tree = RB_ROOT;
-bool				ioport_debug;
 
 static u16 ioport__find_free_port(void)
 {
@@ -177,10 +176,10 @@  bool kvm__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int s
 error:
 	br_read_unlock();
 
-	if (ioport_debug)
+	if (kvm->cfg.ioport_debug)
 		ioport_error(port, data, direction, size, count);
 
-	return !ioport_debug;
+	return !kvm->cfg.ioport_debug;
 }
 
 int ioport__init(struct kvm *kvm)