qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 07/17] monitor: Introduce monitor.h and readline.h


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH 07/17] monitor: Introduce monitor.h and readline.h
Date: Sat, 07 Feb 2009 19:16:28 +0100
User-agent: StGIT/0.14.2

Push monitor-related prototypes from console.h to a new monitor.h and
update users. Do the same for readline types and function prototypes. To
clarify that term_printf & friends work against the monitor terminal,
change the prefix of those functions to 'monitor_'. This patch comes
without functional changes.

Signed-off-by: Jan Kiszka <address@hidden>
---

 audio/audio.c      |    6 +
 audio/wavcapture.c |   20 ++-
 block.c            |   62 +++++------
 console.h          |   27 -----
 disas.c            |   14 +-
 hw/i8259.c         |   16 +--
 hw/pc.c            |    8 +
 hw/pci.c           |   22 ++--
 hw/slavio_intctl.c |   14 +-
 hw/sun4c_intctl.c  |   12 +-
 migration-exec.c   |    2 
 migration-tcp.c    |    2 
 migration.c        |   18 ++-
 monitor.c          |  300 +++++++++++++++++++++++++++-------------------------
 monitor.h          |   21 ++++
 net.c              |   12 +-
 qemu-char.c        |    3 -
 qemu-tool.c        |    6 +
 readline.c         |   29 +++--
 readline.h         |   14 ++
 savevm.c           |   70 ++++++------
 slirp/misc.c       |    4 -
 usb-linux.c        |   28 +++--
 vl.c               |   33 +++---
 vnc.c              |   17 ++-
 25 files changed, 392 insertions(+), 368 deletions(-)
 create mode 100644 monitor.h
 create mode 100644 readline.h

diff --git a/audio/audio.c b/audio/audio.c
index b0a5f3b..9bd0025 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -23,7 +23,7 @@
  */
 #include "hw/hw.h"
 #include "audio.h"
-#include "console.h"
+#include "monitor.h"
 #include "qemu-timer.h"
 #include "sysemu.h"
 
@@ -328,10 +328,10 @@ void AUD_vlog (const char *cap, const char *fmt, va_list 
ap)
 {
     if (conf.log_to_monitor) {
         if (cap) {
-            term_printf ("%s: ", cap);
+            monitor_printf ("%s: ", cap);
         }
 
-        term_vprintf (fmt, ap);
+        monitor_vprintf (fmt, ap);
     }
     else {
         if (cap) {
diff --git a/audio/wavcapture.c b/audio/wavcapture.c
index 6d1c441..a0481c5 100644
--- a/audio/wavcapture.c
+++ b/audio/wavcapture.c
@@ -1,5 +1,5 @@
 #include "hw/hw.h"
-#include "console.h"
+#include "monitor.h"
 #include "audio.h"
 
 typedef struct {
@@ -71,9 +71,9 @@ static void wav_capture_info (void *opaque)
     WAVState *wav = opaque;
     char *path = wav->path;
 
-    term_printf ("Capturing audio(%d,%d,%d) to %s: %d bytes\n",
-                 wav->freq, wav->bits, wav->nchannels,
-                 path ? path : "<not available>", wav->bytes);
+    monitor_printf("Capturing audio(%d,%d,%d) to %s: %d bytes\n",
+                   wav->freq, wav->bits, wav->nchannels,
+                   path ? path : "<not available>", wav->bytes);
 }
 
 static struct capture_ops wav_capture_ops = {
@@ -97,13 +97,13 @@ int wav_start_capture (CaptureState *s, const char *path, 
int freq,
     CaptureVoiceOut *cap;
 
     if (bits != 8 && bits != 16) {
-        term_printf ("incorrect bit count %d, must be 8 or 16\n", bits);
+        monitor_printf("incorrect bit count %d, must be 8 or 16\n", bits);
         return -1;
     }
 
     if (nchannels != 1 && nchannels != 2) {
-        term_printf ("incorrect channel count %d, must be 1 or 2\n",
-                     nchannels);
+        monitor_printf("incorrect channel count %d, must be 1 or 2\n",
+                       nchannels);
         return -1;
     }
 
@@ -131,8 +131,8 @@ int wav_start_capture (CaptureState *s, const char *path, 
int freq,
 
     wav->f = qemu_fopen (path, "wb");
     if (!wav->f) {
-        term_printf ("Failed to open wave file `%s'\nReason: %s\n",
-                     path, strerror (errno));
+        monitor_printf("Failed to open wave file `%s'\nReason: %s\n",
+                       path, strerror (errno));
         qemu_free (wav);
         return -1;
     }
@@ -146,7 +146,7 @@ int wav_start_capture (CaptureState *s, const char *path, 
int freq,
 
     cap = AUD_add_capture (NULL, &as, &ops, wav);
     if (!cap) {
-        term_printf ("Failed to add audio capture\n");
+        monitor_printf("Failed to add audio capture\n");
         qemu_free (wav->path);
         qemu_fclose (wav->f);
         qemu_free (wav);
diff --git a/block.c b/block.c
index 82c2016..5d93de1 100644
--- a/block.c
+++ b/block.c
@@ -28,7 +28,7 @@
 #endif
 
 #include "qemu-common.h"
-#include "console.h"
+#include "monitor.h"
 #include "block_int.h"
 
 #ifdef _BSD
@@ -1030,38 +1030,38 @@ void bdrv_info(void)
     BlockDriverState *bs;
 
     for (bs = bdrv_first; bs != NULL; bs = bs->next) {
-        term_printf("%s:", bs->device_name);
-        term_printf(" type=");
+        monitor_printf("%s:", bs->device_name);
+        monitor_printf(" type=");
         switch(bs->type) {
         case BDRV_TYPE_HD:
-            term_printf("hd");
+            monitor_printf("hd");
             break;
         case BDRV_TYPE_CDROM:
-            term_printf("cdrom");
+            monitor_printf("cdrom");
             break;
         case BDRV_TYPE_FLOPPY:
-            term_printf("floppy");
+            monitor_printf("floppy");
             break;
         }
-        term_printf(" removable=%d", bs->removable);
+        monitor_printf(" removable=%d", bs->removable);
         if (bs->removable) {
-            term_printf(" locked=%d", bs->locked);
+            monitor_printf(" locked=%d", bs->locked);
         }
         if (bs->drv) {
-            term_printf(" file=");
-           term_print_filename(bs->filename);
+            monitor_printf(" file=");
+            monitor_print_filename(bs->filename);
             if (bs->backing_file[0] != '\0') {
-                term_printf(" backing_file=");
-               term_print_filename(bs->backing_file);
-           }
-            term_printf(" ro=%d", bs->read_only);
-            term_printf(" drv=%s", bs->drv->format_name);
+                monitor_printf(" backing_file=");
+                monitor_print_filename(bs->backing_file);
+            }
+            monitor_printf(" ro=%d", bs->read_only);
+            monitor_printf(" drv=%s", bs->drv->format_name);
             if (bdrv_is_encrypted(bs))
-                term_printf(" encrypted");
+                monitor_printf(" encrypted");
         } else {
-            term_printf(" [not inserted]");
+            monitor_printf(" [not inserted]");
         }
-        term_printf("\n");
+        monitor_printf("\n");
     }
 }
 
@@ -1072,20 +1072,20 @@ void bdrv_info_stats (void)
     BlockDriverInfo bdi;
 
     for (bs = bdrv_first; bs != NULL; bs = bs->next) {
-       term_printf ("%s:"
-                    " rd_bytes=%" PRIu64
-                    " wr_bytes=%" PRIu64
-                    " rd_operations=%" PRIu64
-                    " wr_operations=%" PRIu64
-                     ,
-                    bs->device_name,
-                    bs->rd_bytes, bs->wr_bytes,
-                    bs->rd_ops, bs->wr_ops);
+        monitor_printf("%s:"
+                       " rd_bytes=%" PRIu64
+                       " wr_bytes=%" PRIu64
+                       " rd_operations=%" PRIu64
+                       " wr_operations=%" PRIu64
+                       ,
+                       bs->device_name,
+                       bs->rd_bytes, bs->wr_bytes,
+                       bs->rd_ops, bs->wr_ops);
         if (bdrv_get_info(bs, &bdi) == 0)
-            term_printf(" high=%" PRId64
-                        " bytes_free=%" PRId64,
-                        bdi.highest_alloc, bdi.num_free_bytes);
-        term_printf("\n");
+            monitor_printf(" high=%" PRId64
+                           " bytes_free=%" PRId64,
+                           bdi.highest_alloc, bdi.num_free_bytes);
+        monitor_printf("\n");
     }
 }
 
diff --git a/console.h b/console.h
index 4a2f06f..3721547 100644
--- a/console.h
+++ b/console.h
@@ -294,31 +294,4 @@ void curses_display_init(DisplayState *ds, int 
full_screen);
 
 /* x_keymap.c */
 extern uint8_t _translate_keycode(const int key);
-
-/* FIXME: term_printf et al should probably go elsewhere so everything
-   does not need to include console.h  */
-/* monitor.c */
-void monitor_init(CharDriverState *hd, int show_banner);
-void term_puts(const char *str);
-void term_vprintf(const char *fmt, va_list ap);
-void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 
1, 2)));
-void term_print_filename(const char *filename);
-void term_flush(void);
-void term_print_help(void);
-void monitor_readline(const char *prompt, int is_password,
-                      char *buf, int buf_size);
-void monitor_suspend(void);
-void monitor_resume(void);
-
-/* readline.c */
-typedef void ReadLineFunc(void *opaque, const char *str);
-
-extern int completion_index;
-void add_completion(const char *str);
-void readline_handle_byte(int ch);
-void readline_find_completion(const char *cmdline);
-const char *readline_get_history(unsigned int index);
-void readline_start(const char *prompt, int is_password,
-                    ReadLineFunc *readline_func, void *opaque);
-
 #endif
diff --git a/disas.c b/disas.c
index 83c8826..a296edb 100644
--- a/disas.c
+++ b/disas.c
@@ -308,8 +308,8 @@ const char *lookup_symbol(target_ulong orig_addr)
 
 #if !defined(CONFIG_USER_ONLY)
 
-void term_vprintf(const char *fmt, va_list ap);
-void term_printf(const char *fmt, ...);
+void monitor_vprintf(const char *fmt, va_list ap);
+void monitor_printf(const char *fmt, ...);
 
 static int monitor_disas_is_physical;
 static CPUState *monitor_disas_env;
@@ -330,7 +330,7 @@ static int monitor_fprintf(FILE *stream, const char *fmt, 
...)
 {
     va_list ap;
     va_start(ap, fmt);
-    term_vprintf(fmt, ap);
+    monitor_vprintf(fmt, ap);
     va_end(ap);
     return 0;
 }
@@ -388,15 +388,15 @@ void monitor_disas(CPUState *env,
     print_insn = print_insn_little_mips;
 #endif
 #else
-    term_printf("0x" TARGET_FMT_lx
-               ": Asm output not supported on this arch\n", pc);
+    monitor_printf("0x" TARGET_FMT_lx
+                   ": Asm output not supported on this arch\n", pc);
     return;
 #endif
 
     for(i = 0; i < nb_insn; i++) {
-       term_printf("0x" TARGET_FMT_lx ":  ", pc);
+       monitor_printf("0x" TARGET_FMT_lx ":  ", pc);
        count = print_insn(pc, &disasm_info);
-       term_printf("\n");
+       monitor_printf("\n");
        if (count < 0)
            break;
         pc += count;
diff --git a/hw/i8259.c b/hw/i8259.c
index 933289b..0a1cc73 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -24,7 +24,7 @@
 #include "hw.h"
 #include "pc.h"
 #include "isa.h"
-#include "console.h"
+#include "monitor.h"
 
 /* debug PIC */
 //#define DEBUG_PIC
@@ -521,26 +521,26 @@ void pic_info(void)
 
     for(i=0;i<2;i++) {
         s = &isa_pic->pics[i];
-        term_printf("pic%d: irr=%02x imr=%02x isr=%02x hprio=%d irq_base=%02x 
rr_sel=%d elcr=%02x fnm=%d\n",
-                    i, s->irr, s->imr, s->isr, s->priority_add,
-                    s->irq_base, s->read_reg_select, s->elcr,
-                    s->special_fully_nested_mode);
+        monitor_printf("pic%d: irr=%02x imr=%02x isr=%02x hprio=%d 
irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n",
+                       i, s->irr, s->imr, s->isr, s->priority_add,
+                       s->irq_base, s->read_reg_select, s->elcr,
+                       s->special_fully_nested_mode);
     }
 }
 
 void irq_info(void)
 {
 #ifndef DEBUG_IRQ_COUNT
-    term_printf("irq statistic code not compiled.\n");
+    monitor_printf("irq statistic code not compiled.\n");
 #else
     int i;
     int64_t count;
 
-    term_printf("IRQ statistics:\n");
+    monitor_printf("IRQ statistics:\n");
     for (i = 0; i < 16; i++) {
         count = irq_count[i];
         if (count > 0)
-            term_printf("%2d: %" PRId64 "\n", i, count);
+            monitor_printf("%2d: %" PRId64 "\n", i, count);
     }
 #endif
 }
diff --git a/hw/pc.c b/hw/pc.c
index 176730e..0a81594 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -31,7 +31,7 @@
 #include "net.h"
 #include "smbus.h"
 #include "boards.h"
-#include "console.h"
+#include "monitor.h"
 #include "fw_cfg.h"
 #include "virtio-blk.h"
 #include "virtio-balloon.h"
@@ -211,14 +211,14 @@ static int pc_boot_set(void *opaque, const char 
*boot_device)
 
     nbds = strlen(boot_device);
     if (nbds > PC_MAX_BOOT_DEVICES) {
-        term_printf("Too many boot devices for PC\n");
+        monitor_printf("Too many boot devices for PC\n");
         return(1);
     }
     for (i = 0; i < nbds; i++) {
         bds[i] = boot_device2nibble(boot_device[i]);
         if (bds[i] == 0) {
-            term_printf("Invalid boot device for PC: '%c'\n",
-                    boot_device[i]);
+            monitor_printf("Invalid boot device for PC: '%c'\n",
+                           boot_device[i]);
             return(1);
         }
     }
diff --git a/hw/pci.c b/hw/pci.c
index 0e57d21..061433d 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -23,7 +23,7 @@
  */
 #include "hw.h"
 #include "pci.h"
-#include "console.h"
+#include "monitor.h"
 #include "net.h"
 #include "virtio-net.h"
 
@@ -588,37 +588,37 @@ static void pci_info_device(PCIDevice *d)
     PCIIORegion *r;
     const pci_class_desc *desc;
 
-    term_printf("  Bus %2d, device %3d, function %d:\n",
+    monitor_printf("  Bus %2d, device %3d, function %d:\n",
            d->bus->bus_num, d->devfn >> 3, d->devfn & 7);
     class = le16_to_cpu(*((uint16_t *)(d->config + PCI_CLASS_DEVICE)));
-    term_printf("    ");
+    monitor_printf("    ");
     desc = pci_class_descriptions;
     while (desc->desc && class != desc->class)
         desc++;
     if (desc->desc) {
-        term_printf("%s", desc->desc);
+        monitor_printf("%s", desc->desc);
     } else {
-        term_printf("Class %04x", class);
+        monitor_printf("Class %04x", class);
     }
-    term_printf(": PCI device %04x:%04x\n",
+    monitor_printf(": PCI device %04x:%04x\n",
            le16_to_cpu(*((uint16_t *)(d->config + PCI_VENDOR_ID))),
            le16_to_cpu(*((uint16_t *)(d->config + PCI_DEVICE_ID))));
 
     if (d->config[PCI_INTERRUPT_PIN] != 0) {
-        term_printf("      IRQ %d.\n", d->config[PCI_INTERRUPT_LINE]);
+        monitor_printf("      IRQ %d.\n", d->config[PCI_INTERRUPT_LINE]);
     }
     if (class == 0x0604) {
-        term_printf("      BUS %d.\n", d->config[0x19]);
+        monitor_printf("      BUS %d.\n", d->config[0x19]);
     }
     for(i = 0;i < PCI_NUM_REGIONS; i++) {
         r = &d->io_regions[i];
         if (r->size != 0) {
-            term_printf("      BAR%d: ", i);
+            monitor_printf("      BAR%d: ", i);
             if (r->type & PCI_ADDRESS_SPACE_IO) {
-                term_printf("I/O at 0x%04x [0x%04x].\n",
+                monitor_printf("I/O at 0x%04x [0x%04x].\n",
                        r->addr, r->addr + r->size - 1);
             } else {
-                term_printf("32 bit memory at 0x%08x [0x%08x].\n",
+                monitor_printf("32 bit memory at 0x%08x [0x%08x].\n",
                        r->addr, r->addr + r->size - 1);
             }
         }
diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c
index ff8f0c7..9895d13 100644
--- a/hw/slavio_intctl.c
+++ b/hw/slavio_intctl.c
@@ -23,7 +23,7 @@
  */
 #include "hw.h"
 #include "sun4m.h"
-#include "console.h"
+#include "monitor.h"
 
 //#define DEBUG_IRQ_COUNT
 //#define DEBUG_IRQ
@@ -225,27 +225,27 @@ void slavio_pic_info(void *opaque)
     int i;
 
     for (i = 0; i < MAX_CPUS; i++) {
-        term_printf("per-cpu %d: pending 0x%08x\n", i,
+        monitor_printf("per-cpu %d: pending 0x%08x\n", i,
                     s->slaves[i]->intreg_pending);
     }
-    term_printf("master: pending 0x%08x, disabled 0x%08x\n",
-                s->intregm_pending, s->intregm_disabled);
+    monitor_printf("master: pending 0x%08x, disabled 0x%08x\n",
+                   s->intregm_pending, s->intregm_disabled);
 }
 
 void slavio_irq_info(void *opaque)
 {
 #ifndef DEBUG_IRQ_COUNT
-    term_printf("irq statistic code not compiled.\n");
+    monitor_printf("irq statistic code not compiled.\n");
 #else
     SLAVIO_INTCTLState *s = opaque;
     int i;
     int64_t count;
 
-    term_printf("IRQ statistics:\n");
+    monitor_printf("IRQ statistics:\n");
     for (i = 0; i < 32; i++) {
         count = s->irq_count[i];
         if (count > 0)
-            term_printf("%2d: %" PRId64 "\n", i, count);
+            monitor_printf("%2d: %" PRId64 "\n", i, count);
     }
 #endif
 }
diff --git a/hw/sun4c_intctl.c b/hw/sun4c_intctl.c
index 1759157..6d1f18c 100644
--- a/hw/sun4c_intctl.c
+++ b/hw/sun4c_intctl.c
@@ -23,7 +23,7 @@
  */
 #include "hw.h"
 #include "sun4m.h"
-#include "console.h"
+#include "monitor.h"
 //#define DEBUG_IRQ_COUNT
 //#define DEBUG_IRQ
 
@@ -94,22 +94,22 @@ void sun4c_pic_info(void *opaque)
 {
     Sun4c_INTCTLState *s = opaque;
 
-    term_printf("master: pending 0x%2.2x, enabled 0x%2.2x\n", s->pending,
-                s->reg);
+    monitor_printf("master: pending 0x%2.2x, enabled 0x%2.2x\n", s->pending,
+                   s->reg);
 }
 
 void sun4c_irq_info(void *opaque)
 {
 #ifndef DEBUG_IRQ_COUNT
-    term_printf("irq statistic code not compiled.\n");
+    monitor_printf("irq statistic code not compiled.\n");
 #else
     Sun4c_INTCTLState *s = opaque;
     int64_t count;
 
-    term_printf("IRQ statistics:\n");
+    monitor_printf("IRQ statistics:\n");
     count = s->irq_count[i];
     if (count > 0)
-        term_printf("%2d: %" PRId64 "\n", i, count);
+        monitor_printf("%2d: %" PRId64 "\n", i, count);
 #endif
 }
 
diff --git a/migration-exec.c b/migration-exec.c
index 6ed322a..2c92340 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -18,7 +18,7 @@
 #include "migration.h"
 #include "qemu-char.h"
 #include "sysemu.h"
-#include "console.h"
+#include "monitor.h"
 #include "buffered_file.h"
 #include "block.h"
 
diff --git a/migration-tcp.c b/migration-tcp.c
index 3f5b104..c5e102c 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -16,7 +16,7 @@
 #include "migration.h"
 #include "qemu-char.h"
 #include "sysemu.h"
-#include "console.h"
+#include "monitor.h"
 #include "buffered_file.h"
 #include "block.h"
 
diff --git a/migration.c b/migration.c
index 0ef777a..a7f9355 100644
--- a/migration.c
+++ b/migration.c
@@ -13,7 +13,7 @@
 
 #include "qemu-common.h"
 #include "migration.h"
-#include "console.h"
+#include "monitor.h"
 #include "buffered_file.h"
 #include "sysemu.h"
 #include "block.h"
@@ -60,10 +60,10 @@ void do_migrate(int detach, const char *uri)
         s = exec_start_outgoing_migration(p, max_throttle, detach);
 #endif
     else
-        term_printf("unknown migration protocol: %s\n", uri);
+        monitor_printf("unknown migration protocol: %s\n", uri);
 
     if (s == NULL)
-        term_printf("migration failed\n");
+        monitor_printf("migration failed\n");
     else {
         if (current_migration)
             current_migration->release(current_migration);
@@ -103,21 +103,21 @@ void do_migrate_set_speed(const char *value)
 void do_info_migrate(void)
 {
     MigrationState *s = current_migration;
-    
+
     if (s) {
-        term_printf("Migration status: ");
+        monitor_printf("Migration status: ");
         switch (s->get_status(s)) {
         case MIG_STATE_ACTIVE:
-            term_printf("active\n");
+            monitor_printf("active\n");
             break;
         case MIG_STATE_COMPLETED:
-            term_printf("completed\n");
+            monitor_printf("completed\n");
             break;
         case MIG_STATE_ERROR:
-            term_printf("failed\n");
+            monitor_printf("failed\n");
             break;
         case MIG_STATE_CANCELLED:
-            term_printf("cancelled\n");
+            monitor_printf("cancelled\n");
             break;
         }
     }
diff --git a/monitor.c b/monitor.c
index 9643e44..61cea11 100644
--- a/monitor.c
+++ b/monitor.c
@@ -30,6 +30,8 @@
 #include "net.h"
 #include "qemu-char.h"
 #include "sysemu.h"
+#include "monitor.h"
+#include "readline.h"
 #include "console.h"
 #include "block.h"
 #include "audio/audio.h"
@@ -79,7 +81,7 @@ static void monitor_start_input(void);
 
 static CPUState *mon_cpu = NULL;
 
-void term_flush(void)
+void monitor_flush(void)
 {
     int i;
     if (term_outbuf_index > 0) {
@@ -91,7 +93,7 @@ void term_flush(void)
 }
 
 /* flush at every end of line or if the buffer is full */
-void term_puts(const char *str)
+static void monitor_puts(const char *str)
 {
     char c;
     for(;;) {
@@ -103,26 +105,26 @@ void term_puts(const char *str)
         term_outbuf[term_outbuf_index++] = c;
         if (term_outbuf_index >= (sizeof(term_outbuf) - 1) ||
             c == '\n')
-            term_flush();
+            monitor_flush();
     }
 }
 
-void term_vprintf(const char *fmt, va_list ap)
+void monitor_vprintf(const char *fmt, va_list ap)
 {
     char buf[4096];
     vsnprintf(buf, sizeof(buf), fmt, ap);
-    term_puts(buf);
+    monitor_puts(buf);
 }
 
-void term_printf(const char *fmt, ...)
+void monitor_printf(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    term_vprintf(fmt, ap);
+    monitor_vprintf(fmt, ap);
     va_end(ap);
 }
 
-void term_print_filename(const char *filename)
+void monitor_print_filename(const char *filename)
 {
     int i;
 
@@ -131,19 +133,19 @@ void term_print_filename(const char *filename)
        case ' ':
        case '"':
        case '\\':
-           term_printf("\\%c", filename[i]);
+           monitor_printf("\\%c", filename[i]);
            break;
        case '\t':
-           term_printf("\\t");
+           monitor_printf("\\t");
            break;
        case '\r':
-           term_printf("\\r");
+           monitor_printf("\\r");
            break;
        case '\n':
-           term_printf("\\n");
+           monitor_printf("\\n");
            break;
        default:
-           term_printf("%c", filename[i]);
+           monitor_printf("%c", filename[i]);
            break;
        }
     }
@@ -153,7 +155,7 @@ static int monitor_fprintf(FILE *stream, const char *fmt, 
...)
 {
     va_list ap;
     va_start(ap, fmt);
-    term_vprintf(fmt, ap);
+    monitor_vprintf(fmt, ap);
     va_end(ap);
     return 0;
 }
@@ -184,7 +186,8 @@ static void help_cmd1(const term_cmd_t *cmds, const char 
*prefix, const char *na
 
     for(cmd = cmds; cmd->name != NULL; cmd++) {
         if (!name || !strcmp(name, cmd->name))
-            term_printf("%s%s %s -- %s\n", prefix, cmd->name, cmd->params, 
cmd->help);
+            monitor_printf("%s%s %s -- %s\n", prefix, cmd->name, cmd->params,
+                           cmd->help);
     }
 }
 
@@ -196,10 +199,10 @@ static void help_cmd(const char *name)
         help_cmd1(term_cmds, "", name);
         if (name && !strcmp(name, "log")) {
             const CPULogItem *item;
-            term_printf("Log items (comma separated):\n");
-            term_printf("%-10s %s\n", "none", "remove all logs");
+            monitor_printf("Log items (comma separated):\n");
+            monitor_printf("%-10s %s\n", "none", "remove all logs");
             for(item = cpu_log_items; item->mask != 0; item++) {
-                term_printf("%-10s %s\n", item->name, item->help);
+                monitor_printf("%-10s %s\n", item->name, item->help);
             }
         }
     }
@@ -243,25 +246,25 @@ static void do_info(const char *item)
 
 static void do_info_version(void)
 {
-  term_printf("%s\n", QEMU_VERSION);
+    monitor_printf("%s\n", QEMU_VERSION);
 }
 
 static void do_info_name(void)
 {
     if (qemu_name)
-        term_printf("%s\n", qemu_name);
+        monitor_printf("%s\n", qemu_name);
 }
 
 #if defined(TARGET_I386)
 static void do_info_hpet(void)
 {
-    term_printf("HPET is %s by QEMU\n", (no_hpet) ? "disabled" : "enabled");
+    monitor_printf("HPET is %s by QEMU\n", (no_hpet) ? "disabled" : "enabled");
 }
 #endif
 
 static void do_info_uuid(void)
 {
-    term_printf(UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1], qemu_uuid[2],
+    monitor_printf(UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1], qemu_uuid[2],
             qemu_uuid[3], qemu_uuid[4], qemu_uuid[5], qemu_uuid[6],
             qemu_uuid[7], qemu_uuid[8], qemu_uuid[9], qemu_uuid[10],
             qemu_uuid[11], qemu_uuid[12], qemu_uuid[13], qemu_uuid[14],
@@ -323,28 +326,30 @@ static void do_info_cpus(void)
     mon_get_cpu();
 
     for(env = first_cpu; env != NULL; env = env->next_cpu) {
-        term_printf("%c CPU #%d:",
-                    (env == mon_cpu) ? '*' : ' ',
-                    env->cpu_index);
+        monitor_printf("%c CPU #%d:",
+                       (env == mon_cpu) ? '*' : ' ',
+                       env->cpu_index);
 #if defined(TARGET_I386)
-        term_printf(" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS].base);
+        monitor_printf(" pc=0x" TARGET_FMT_lx,
+                       env->eip + env->segs[R_CS].base);
 #elif defined(TARGET_PPC)
-        term_printf(" nip=0x" TARGET_FMT_lx, env->nip);
+        monitor_printf(" nip=0x" TARGET_FMT_lx, env->nip);
 #elif defined(TARGET_SPARC)
-        term_printf(" pc=0x" TARGET_FMT_lx " npc=0x" TARGET_FMT_lx, env->pc, 
env->npc);
+        monitor_printf(" pc=0x" TARGET_FMT_lx " npc=0x" TARGET_FMT_lx,
+                       env->pc, env->npc);
 #elif defined(TARGET_MIPS)
-        term_printf(" PC=0x" TARGET_FMT_lx, env->active_tc.PC);
+        monitor_printf(" PC=0x" TARGET_FMT_lx, env->active_tc.PC);
 #endif
         if (env->halted)
-            term_printf(" (halted)");
-        term_printf("\n");
+            monitor_printf(" (halted)");
+        monitor_printf("\n");
     }
 }
 
 static void do_cpu_set(int index)
 {
     if (mon_set_cpu(index) < 0)
-        term_printf("Invalid CPU index\n");
+        monitor_printf("Invalid CPU index\n");
 }
 
 static void do_info_jit(void)
@@ -362,7 +367,7 @@ static void do_info_history (void)
         str = readline_get_history(i);
         if (!str)
             break;
-       term_printf("%d: '%s'\n", i, str);
+       monitor_printf("%d: '%s'\n", i, str);
         i++;
     }
 }
@@ -388,11 +393,11 @@ static int eject_device(BlockDriverState *bs, int force)
     if (bdrv_is_inserted(bs)) {
         if (!force) {
             if (!bdrv_is_removable(bs)) {
-                term_printf("device is not removable\n");
+                monitor_printf("device is not removable\n");
                 return -1;
             }
             if (bdrv_is_locked(bs)) {
-                term_printf("device is locked\n");
+                monitor_printf("device is locked\n");
                 return -1;
             }
         }
@@ -407,7 +412,7 @@ static void do_eject(int force, const char *filename)
 
     bs = bdrv_find(filename);
     if (!bs) {
-        term_printf("device not found\n");
+        monitor_printf("device not found\n");
         return;
     }
     eject_device(bs, force);
@@ -420,13 +425,13 @@ static void do_change_block(const char *device, const 
char *filename, const char
 
     bs = bdrv_find(device);
     if (!bs) {
-        term_printf("device not found\n");
+        monitor_printf("device not found\n");
         return;
     }
     if (fmt) {
         drv = bdrv_find_format(fmt);
         if (!drv) {
-            term_printf("invalid format %s\n", fmt);
+            monitor_printf("invalid format %s\n", fmt);
             return;
         }
     }
@@ -447,10 +452,10 @@ static void do_change_vnc(const char *target, const char 
*arg)
        } else
            monitor_readline("Password: ", 1, password, sizeof(password));
        if (vnc_display_password(NULL, password) < 0)
-           term_printf("could not set VNC server password\n");
+           monitor_printf("could not set VNC server password\n");
     } else {
        if (vnc_display_open(NULL, target) < 0)
-           term_printf("could not start VNC server on %s\n", target);
+           monitor_printf("could not start VNC server on %s\n", target);
     }
 }
 
@@ -512,31 +517,31 @@ static void do_gdbserver(const char *port)
 }
 #endif
 
-static void term_printc(int c)
+static void monitor_printc(int c)
 {
-    term_printf("'");
+    monitor_printf("'");
     switch(c) {
     case '\'':
-        term_printf("\\'");
+        monitor_printf("\\'");
         break;
     case '\\':
-        term_printf("\\\\");
+        monitor_printf("\\\\");
         break;
     case '\n':
-        term_printf("\\n");
+        monitor_printf("\\n");
         break;
     case '\r':
-        term_printf("\\r");
+        monitor_printf("\\r");
         break;
     default:
         if (c >= 32 && c <= 126) {
-            term_printf("%c", c);
+            monitor_printf("%c", c);
         } else {
-            term_printf("\\x%02x", c);
+            monitor_printf("\\x%02x", c);
         }
         break;
     }
-    term_printf("'");
+    monitor_printf("'");
 }
 
 static void memory_dump(int count, int format, int wsize,
@@ -604,9 +609,9 @@ static void memory_dump(int count, int format, int wsize,
 
     while (len > 0) {
         if (is_physical)
-            term_printf(TARGET_FMT_plx ":", addr);
+            monitor_printf(TARGET_FMT_plx ":", addr);
         else
-            term_printf(TARGET_FMT_lx ":", (target_ulong)addr);
+            monitor_printf(TARGET_FMT_lx ":", (target_ulong)addr);
         l = len;
         if (l > line_size)
             l = line_size;
@@ -617,7 +622,7 @@ static void memory_dump(int count, int format, int wsize,
             if (!env)
                 break;
             if (cpu_memory_rw_debug(env, addr, buf, l, 0) < 0) {
-                term_printf(" Cannot access memory\n");
+                monitor_printf(" Cannot access memory\n");
                 break;
             }
         }
@@ -638,27 +643,27 @@ static void memory_dump(int count, int format, int wsize,
                 v = ldq_raw(buf + i);
                 break;
             }
-            term_printf(" ");
+            monitor_printf(" ");
             switch(format) {
             case 'o':
-                term_printf("%#*" PRIo64, max_digits, v);
+                monitor_printf("%#*" PRIo64, max_digits, v);
                 break;
             case 'x':
-                term_printf("0x%0*" PRIx64, max_digits, v);
+                monitor_printf("0x%0*" PRIx64, max_digits, v);
                 break;
             case 'u':
-                term_printf("%*" PRIu64, max_digits, v);
+                monitor_printf("%*" PRIu64, max_digits, v);
                 break;
             case 'd':
-                term_printf("%*" PRId64, max_digits, v);
+                monitor_printf("%*" PRId64, max_digits, v);
                 break;
             case 'c':
-                term_printc(v);
+                monitor_printc(v);
                 break;
             }
             i += wsize;
         }
-        term_printf("\n");
+        monitor_printf("\n");
         addr += l;
         len -= l;
     }
@@ -697,43 +702,43 @@ static void do_print(int count, int format, int size, 
unsigned int valh, unsigne
 #if TARGET_PHYS_ADDR_BITS == 32
     switch(format) {
     case 'o':
-        term_printf("%#o", val);
+        monitor_printf("%#o", val);
         break;
     case 'x':
-        term_printf("%#x", val);
+        monitor_printf("%#x", val);
         break;
     case 'u':
-        term_printf("%u", val);
+        monitor_printf("%u", val);
         break;
     default:
     case 'd':
-        term_printf("%d", val);
+        monitor_printf("%d", val);
         break;
     case 'c':
-        term_printc(val);
+        monitor_printc(val);
         break;
     }
 #else
     switch(format) {
     case 'o':
-        term_printf("%#" PRIo64, val);
+        monitor_printf("%#" PRIo64, val);
         break;
     case 'x':
-        term_printf("%#" PRIx64, val);
+        monitor_printf("%#" PRIx64, val);
         break;
     case 'u':
-        term_printf("%" PRIu64, val);
+        monitor_printf("%" PRIu64, val);
         break;
     default:
     case 'd':
-        term_printf("%" PRId64, val);
+        monitor_printf("%" PRId64, val);
         break;
     case 'c':
-        term_printc(val);
+        monitor_printc(val);
         break;
     }
 #endif
-    term_printf("\n");
+    monitor_printf("\n");
 }
 
 static void do_memory_save(unsigned int valh, unsigned int vall,
@@ -751,7 +756,7 @@ static void do_memory_save(unsigned int valh, unsigned int 
vall,
 
     f = fopen(filename, "wb");
     if (!f) {
-        term_printf("could not open '%s'\n", filename);
+        monitor_printf("could not open '%s'\n", filename);
         return;
     }
     while (size != 0) {
@@ -776,7 +781,7 @@ static void do_physical_memory_save(unsigned int valh, 
unsigned int vall,
 
     f = fopen(filename, "wb");
     if (!f) {
-        term_printf("could not open '%s'\n", filename);
+        monitor_printf("could not open '%s'\n", filename);
         return;
     }
     while (size != 0) {
@@ -805,7 +810,7 @@ static void do_sum(uint32_t start, uint32_t size)
         sum = (sum >> 1) | (sum << 15);
         sum += buf[0];
     }
-    term_printf("%05d\n", sum);
+    monitor_printf("%05d\n", sum);
 }
 
 typedef struct {
@@ -1007,17 +1012,17 @@ static void do_sendkey(const char *string, int 
has_hold_time, int hold_time)
         if (keyname_len > 0) {
             pstrcpy(keyname_buf, sizeof(keyname_buf), string);
             if (keyname_len > sizeof(keyname_buf) - 1) {
-                term_printf("invalid key: '%s...'\n", keyname_buf);
+                monitor_printf("invalid key: '%s...'\n", keyname_buf);
                 return;
             }
             if (i == MAX_KEYCODES) {
-                term_printf("too many keys\n");
+                monitor_printf("too many keys\n");
                 return;
             }
             keyname_buf[keyname_len] = 0;
             keycode = get_keycode(keyname_buf);
             if (keycode < 0) {
-                term_printf("unknown key: '%s'\n", keyname_buf);
+                monitor_printf("unknown key: '%s'\n", keyname_buf);
                 return;
             }
             keycodes[i++] = keycode;
@@ -1085,8 +1090,8 @@ static void do_ioport_read(int count, int format, int 
size, int addr, int has_in
         suffix = 'l';
         break;
     }
-    term_printf("port%c[0x%04x] = %#0*x\n",
-                suffix, addr, size * 2, val);
+    monitor_printf("port%c[0x%04x] = %#0*x\n",
+                   suffix, addr, size * 2, val);
 }
 
 /* boot_set handler */
@@ -1106,11 +1111,13 @@ static void do_boot_set(const char *bootdevice)
     if (qemu_boot_set_handler)  {
         res = qemu_boot_set_handler(boot_opaque, bootdevice);
         if (res == 0)
-            term_printf("boot device list now set to %s\n", bootdevice);
+            monitor_printf("boot device list now set to %s\n", bootdevice);
         else
-            term_printf("setting boot device list failed with error %i\n", 
res);
+            monitor_printf("setting boot device list failed with error %i\n",
+                           res);
     } else {
-        term_printf("no function defined to set boot device list for this 
architecture\n");
+        monitor_printf("no function defined to set boot device list for this "
+                       "architecture\n");
     }
 }
 
@@ -1127,17 +1134,17 @@ static void do_system_powerdown(void)
 #if defined(TARGET_I386)
 static void print_pte(uint32_t addr, uint32_t pte, uint32_t mask)
 {
-    term_printf("%08x: %08x %c%c%c%c%c%c%c%c\n",
-                addr,
-                pte & mask,
-                pte & PG_GLOBAL_MASK ? 'G' : '-',
-                pte & PG_PSE_MASK ? 'P' : '-',
-                pte & PG_DIRTY_MASK ? 'D' : '-',
-                pte & PG_ACCESSED_MASK ? 'A' : '-',
-                pte & PG_PCD_MASK ? 'C' : '-',
-                pte & PG_PWT_MASK ? 'T' : '-',
-                pte & PG_USER_MASK ? 'U' : '-',
-                pte & PG_RW_MASK ? 'W' : '-');
+    monitor_printf("%08x: %08x %c%c%c%c%c%c%c%c\n",
+                   addr,
+                   pte & mask,
+                   pte & PG_GLOBAL_MASK ? 'G' : '-',
+                   pte & PG_PSE_MASK ? 'P' : '-',
+                   pte & PG_DIRTY_MASK ? 'D' : '-',
+                   pte & PG_ACCESSED_MASK ? 'A' : '-',
+                   pte & PG_PCD_MASK ? 'C' : '-',
+                   pte & PG_PWT_MASK ? 'T' : '-',
+                   pte & PG_USER_MASK ? 'U' : '-',
+                   pte & PG_RW_MASK ? 'W' : '-');
 }
 
 static void tlb_info(void)
@@ -1151,7 +1158,7 @@ static void tlb_info(void)
         return;
 
     if (!(env->cr[0] & CR0_PG_MASK)) {
-        term_printf("PG disabled\n");
+        monitor_printf("PG disabled\n");
         return;
     }
     pgd = env->cr[3] & ~0xfff;
@@ -1184,11 +1191,11 @@ static void mem_print(uint32_t *pstart, int *plast_prot,
     prot1 = *plast_prot;
     if (prot != prot1) {
         if (*pstart != -1) {
-            term_printf("%08x-%08x %08x %c%c%c\n",
-                        *pstart, end, end - *pstart,
-                        prot1 & PG_USER_MASK ? 'u' : '-',
-                        'r',
-                        prot1 & PG_RW_MASK ? 'w' : '-');
+            monitor_printf("%08x-%08x %08x %c%c%c\n",
+                           *pstart, end, end - *pstart,
+                           prot1 & PG_USER_MASK ? 'u' : '-',
+                           'r',
+                           prot1 & PG_RW_MASK ? 'w' : '-');
         }
         if (prot != 0)
             *pstart = end;
@@ -1209,7 +1216,7 @@ static void mem_info(void)
         return;
 
     if (!(env->cr[0] & CR0_PG_MASK)) {
-        term_printf("PG disabled\n");
+        monitor_printf("PG disabled\n");
         return;
     }
     pgd = env->cr[3] & ~0xfff;
@@ -1253,38 +1260,38 @@ static void do_info_kqemu(void)
     val = 0;
     env = mon_get_cpu();
     if (!env) {
-        term_printf("No cpu initialized yet");
+        monitor_printf("No cpu initialized yet");
         return;
     }
     val = env->kqemu_enabled;
-    term_printf("kqemu support: ");
+    monitor_printf("kqemu support: ");
     switch(val) {
     default:
     case 0:
-        term_printf("disabled\n");
+        monitor_printf("disabled\n");
         break;
     case 1:
-        term_printf("enabled for user code\n");
+        monitor_printf("enabled for user code\n");
         break;
     case 2:
-        term_printf("enabled for user and kernel code\n");
+        monitor_printf("enabled for user and kernel code\n");
         break;
     }
 #else
-    term_printf("kqemu support: not compiled\n");
+    monitor_printf("kqemu support: not compiled\n");
 #endif
 }
 
 static void do_info_kvm(void)
 {
 #ifdef CONFIG_KVM
-    term_printf("kvm support: ");
+    monitor_printf("kvm support: ");
     if (kvm_enabled())
-       term_printf("enabled\n");
+       monitor_printf("enabled\n");
     else
-       term_printf("disabled\n");
+       monitor_printf("disabled\n");
 #else
-    term_printf("kvm support: not compiled\n");
+    monitor_printf("kvm support: not compiled\n");
 #endif
 }
 
@@ -1304,17 +1311,17 @@ static void do_info_profile(void)
     total = qemu_time;
     if (total == 0)
         total = 1;
-    term_printf("async time  %" PRId64 " (%0.3f)\n",
-                dev_time, dev_time / (double)ticks_per_sec);
-    term_printf("qemu time   %" PRId64 " (%0.3f)\n",
-                qemu_time, qemu_time / (double)ticks_per_sec);
-    term_printf("kqemu time  %" PRId64 " (%0.3f %0.1f%%) count=%" PRId64 " 
int=%" PRId64 " excp=%" PRId64 " intr=%" PRId64 "\n",
-                kqemu_time, kqemu_time / (double)ticks_per_sec,
-                kqemu_time / (double)total * 100.0,
-                kqemu_exec_count,
-                kqemu_ret_int_count,
-                kqemu_ret_excp_count,
-                kqemu_ret_intr_count);
+    monitor_printf("async time  %" PRId64 " (%0.3f)\n",
+                   dev_time, dev_time / (double)ticks_per_sec);
+    monitor_printf("qemu time   %" PRId64 " (%0.3f)\n",
+                   qemu_time, qemu_time / (double)ticks_per_sec);
+    monitor_printf("kqemu time  %" PRId64 " (%0.3f %0.1f%%) count=%" PRId64 " 
int=%" PRId64 " excp=%" PRId64 " intr=%" PRId64 "\n",
+                   kqemu_time, kqemu_time / (double)ticks_per_sec,
+                   kqemu_time / (double)total * 100.0,
+                   kqemu_exec_count,
+                   kqemu_ret_int_count,
+                   kqemu_ret_excp_count,
+                   kqemu_ret_intr_count);
     qemu_time = 0;
     kqemu_time = 0;
     kqemu_exec_count = 0;
@@ -1329,7 +1336,7 @@ static void do_info_profile(void)
 #else
 static void do_info_profile(void)
 {
-    term_printf("Internal profiler not compiled\n");
+    monitor_printf("Internal profiler not compiled\n");
 }
 #endif
 
@@ -1342,7 +1349,7 @@ static void do_info_capture (void)
     CaptureState *s;
 
     for (s = capture_head.lh_first, i = 0; s; s = s->entries.le_next, ++i) {
-        term_printf ("[%d]: ", i);
+        monitor_printf("[%d]: ", i);
         s->ops.info (s->opaque);
     }
 }
@@ -1377,7 +1384,7 @@ static void do_wav_capture (const char *path,
     nchannels = has_channels ? nchannels : 2;
 
     if (wav_start_capture (s, path, freq, bits, nchannels)) {
-        term_printf ("Faied to add wave capture\n");
+        monitor_printf("Faied to add wave capture\n");
         qemu_free (s);
     }
     LIST_INSERT_HEAD (&capture_head, s, entries);
@@ -1400,9 +1407,9 @@ static void do_inject_nmi(int cpu_index)
 static void do_info_status(void)
 {
     if (vm_running)
-       term_printf("VM status: running\n");
+       monitor_printf("VM status: running\n");
     else
-       term_printf("VM status: paused\n");
+       monitor_printf("VM status: paused\n");
 }
 
 
@@ -1418,11 +1425,12 @@ static void do_info_balloon(void)
 
     actual = qemu_balloon_status();
     if (kvm_enabled() && !kvm_has_sync_mmu())
-        term_printf("Using KVM without synchronous MMU, ballooning 
disabled\n");
+        monitor_printf("Using KVM without synchronous MMU, "
+                       "ballooning disabled\n");
     else if (actual == 0)
-        term_printf("Ballooning not activated in VM\n");
+        monitor_printf("Ballooning not activated in VM\n");
     else
-        term_printf("balloon: actual=%d\n", (int)(actual >> 20));
+        monitor_printf("balloon: actual=%d\n", (int)(actual >> 20));
 }
 
 /* Please update qemu-doc.texi when adding or changing commands */
@@ -1937,7 +1945,7 @@ static const MonitorDef monitor_defs[] = {
 
 static void expr_error(const char *msg)
 {
-    term_printf("%s\n", msg);
+    monitor_printf("%s\n", msg);
     longjmp(expr_env, 1);
 }
 
@@ -2256,7 +2264,7 @@ static void monitor_handle_command(const char *cmdline)
                       void *arg4, void *arg5, void *arg6);
 
 #ifdef DEBUG
-    term_printf("command='%s'\n", cmdline);
+    monitor_printf("command='%s'\n", cmdline);
 #endif
 
     /* extract the command name */
@@ -2280,7 +2288,7 @@ static void monitor_handle_command(const char *cmdline)
         if (compare_cmd(cmdname, cmd->name))
             goto found;
     }
-    term_printf("unknown command: '%s'\n", cmdname);
+    monitor_printf("unknown command: '%s'\n", cmdname);
     return;
  found:
 
@@ -2317,13 +2325,14 @@ static void monitor_handle_command(const char *cmdline)
                 if (ret < 0) {
                     switch(c) {
                     case 'F':
-                        term_printf("%s: filename expected\n", cmdname);
+                        monitor_printf("%s: filename expected\n", cmdname);
                         break;
                     case 'B':
-                        term_printf("%s: block device name expected\n", 
cmdname);
+                        monitor_printf("%s: block device name expected\n",
+                                       cmdname);
                         break;
                     default:
-                        term_printf("%s: string expected\n", cmdname);
+                        monitor_printf("%s: string expected\n", cmdname);
                         break;
                     }
                     goto fail;
@@ -2334,7 +2343,7 @@ static void monitor_handle_command(const char *cmdline)
             add_str:
                 if (nb_args >= MAX_ARGS) {
                 error_args:
-                    term_printf("%s: too many arguments\n", cmdname);
+                    monitor_printf("%s: too many arguments\n", cmdname);
                     goto fail;
                 }
                 args[nb_args++] = str;
@@ -2392,7 +2401,7 @@ static void monitor_handle_command(const char *cmdline)
                     }
                 next:
                     if (*p != '\0' && !qemu_isspace(*p)) {
-                        term_printf("invalid char in format: '%c'\n", *p);
+                        monitor_printf("invalid char in format: '%c'\n", *p);
                         goto fail;
                     }
                     if (format < 0)
@@ -2487,7 +2496,7 @@ static void monitor_handle_command(const char *cmdline)
                 if (*p == '-') {
                     p++;
                     if (*p != c) {
-                        term_printf("%s: unsupported option -%c\n",
+                        monitor_printf("%s: unsupported option -%c\n",
                                     cmdname, *p);
                         goto fail;
                     }
@@ -2501,7 +2510,7 @@ static void monitor_handle_command(const char *cmdline)
             break;
         default:
         bad_type:
-            term_printf("%s: unknown type '%c'\n", cmdname, c);
+            monitor_printf("%s: unknown type '%c'\n", cmdname, c);
             goto fail;
         }
     }
@@ -2509,8 +2518,8 @@ static void monitor_handle_command(const char *cmdline)
     while (qemu_isspace(*p))
         p++;
     if (*p != '\0') {
-        term_printf("%s: extraneous characters at the end of line\n",
-                    cmdname);
+        monitor_printf("%s: extraneous characters at the end of line\n",
+                       cmdname);
         goto fail;
     }
 
@@ -2548,7 +2557,7 @@ static void monitor_handle_command(const char *cmdline)
         handler_7(args[0], args[1], args[2], args[3], args[4], args[5], 
args[6]);
         break;
     default:
-        term_printf("unsupported number of arguments: %d\n", nb_args);
+        monitor_printf("unsupported number of arguments: %d\n", nb_args);
         goto fail;
     }
  fail:
@@ -2606,7 +2615,8 @@ static void file_completion(const char *input)
         pstrcpy(file_prefix, sizeof(file_prefix), p + 1);
     }
 #ifdef DEBUG_COMPLETION
-    term_printf("input='%s' path='%s' prefix='%s'\n", input, path, 
file_prefix);
+    monitor_printf("input='%s' path='%s' prefix='%s'\n",
+                   input, path, file_prefix);
 #endif
     ffs = opendir(path);
     if (!ffs)
@@ -2682,7 +2692,7 @@ void readline_find_completion(const char *cmdline)
     parse_cmdline(cmdline, &nb_args, args);
 #ifdef DEBUG_COMPLETION
     for(i = 0; i < nb_args; i++) {
-        term_printf("arg%d = '%s'\n", i, (char *)args[i]);
+        monitor_printf("arg%d = '%s'\n", i, (char *)args[i]);
     }
 #endif
 
@@ -2800,8 +2810,8 @@ static void term_event(void *opaque, int event)
        return;
 
     if (!hide_banner)
-           term_printf("QEMU %s monitor - type 'help' for more information\n",
-                       QEMU_VERSION);
+        monitor_printf("QEMU %s monitor - type 'help' for more information\n",
+                       QEMU_VERSION);
     monitor_start_input();
 }
 
diff --git a/monitor.h b/monitor.h
new file mode 100644
index 0000000..973c336
--- /dev/null
+++ b/monitor.h
@@ -0,0 +1,21 @@
+#ifndef MONITOR_H
+#define MONITOR_H
+
+#include "qemu-char.h"
+#include "block.h"
+
+void monitor_init(CharDriverState *hd, int show_banner);
+void monitor_readline(const char *prompt, int is_password,
+                      char *buf, int buf_size);
+void monitor_suspend(void);
+void monitor_resume(void);
+
+int monitor_read_bdrv_key(BlockDriverState *bs, const char *name);
+
+void monitor_vprintf(const char *fmt, va_list ap);
+void monitor_printf(const char *fmt, ...)
+    __attribute__ ((__format__ (__printf__, 1, 2)));
+void monitor_print_filename(const char *filename);
+void monitor_flush(void);
+
+#endif /* !MONITOR_H */
diff --git a/net.c b/net.c
index e7c097e..1d1332a 100644
--- a/net.c
+++ b/net.c
@@ -23,7 +23,7 @@
  */
 #include "qemu-common.h"
 #include "net.h"
-#include "console.h"
+#include "monitor.h"
 #include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-char.h"
@@ -1727,9 +1727,9 @@ void do_info_network(void)
     VLANClientState *vc;
 
     for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
-        term_printf("VLAN %d devices:\n", vlan->id);
+        monitor_printf("VLAN %d devices:\n", vlan->id);
         for(vc = vlan->first_client; vc != NULL; vc = vc->next)
-            term_printf("  %s: %s\n", vc->name, vc->info_str);
+            monitor_printf("  %s: %s\n", vc->name, vc->info_str);
     }
 }
 
@@ -1745,7 +1745,7 @@ int do_set_link(const char *name, const char *up_or_down)
 done:
 
     if (!vc) {
-        term_printf("could not find network device '%s'", name);
+        monitor_printf("could not find network device '%s'", name);
         return 0;
     }
 
@@ -1754,8 +1754,8 @@ done:
     else if (strcmp(up_or_down, "down") == 0)
         vc->link_down = 1;
     else
-        term_printf("invalid link status '%s'; only 'up' or 'down' valid\n",
-                    up_or_down);
+        monitor_printf("invalid link status '%s'; only 'up' or 'down' valid\n",
+                       up_or_down);
 
     if (vc->link_status_changed)
         vc->link_status_changed(vc);
diff --git a/qemu-char.c b/qemu-char.c
index 38bfab8..15cb931 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -23,6 +23,7 @@
  */
 #include "qemu-common.h"
 #include "net.h"
+#include "monitor.h"
 #include "console.h"
 #include "sysemu.h"
 #include "qemu-timer.h"
@@ -2174,6 +2175,6 @@ void qemu_chr_info(void)
     CharDriverState *chr;
 
     TAILQ_FOREACH(chr, &chardevs, next) {
-        term_printf("%s: filename=%s\n", chr->label, chr->filename);
+        monitor_printf("%s: filename=%s\n", chr->label, chr->filename);
     }
 }
diff --git a/qemu-tool.c b/qemu-tool.c
index 4dda5af..d29ee66 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -12,7 +12,7 @@
  */
 
 #include "qemu-common.h"
-#include "console.h"
+#include "monitor.h"
 #include "sysemu.h"
 #include "qemu-timer.h"
 
@@ -30,11 +30,11 @@ void qemu_service_io(void)
 {
 }
 
-void term_printf(const char *fmt, ...)
+void monitor_printf(const char *fmt, ...)
 {
 }
 
-void term_print_filename(const char *filename)
+void monitor_print_filename(const char *filename)
 {
 }
 
diff --git a/readline.c b/readline.c
index 8572841..4d8a40d 100644
--- a/readline.c
+++ b/readline.c
@@ -22,7 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu-common.h"
-#include "console.h"
+#include "monitor.h"
+#include "readline.h"
 
 #define TERM_CMD_BUF_SIZE 4095
 #define TERM_MAX_CMDS 64
@@ -59,8 +60,8 @@ static void *term_readline_opaque;
 
 static void term_show_prompt2(void)
 {
-    term_printf("%s", term_prompt);
-    term_flush();
+    monitor_printf("%s", term_prompt);
+    monitor_flush();
     term_last_cmd_buf_index = 0;
     term_last_cmd_buf_size = 0;
     term_esc_state = IS_NORM;
@@ -81,17 +82,17 @@ static void term_update(void)
     if (term_cmd_buf_size != term_last_cmd_buf_size ||
         memcmp(term_cmd_buf, term_last_cmd_buf, term_cmd_buf_size) != 0) {
         for(i = 0; i < term_last_cmd_buf_index; i++) {
-            term_printf("\033[D");
+            monitor_printf("\033[D");
         }
         term_cmd_buf[term_cmd_buf_size] = '\0';
         if (term_is_password) {
             len = strlen(term_cmd_buf);
             for(i = 0; i < len; i++)
-                term_printf("*");
+                monitor_printf("*");
         } else {
-            term_printf("%s", term_cmd_buf);
+            monitor_printf("%s", term_cmd_buf);
         }
-        term_printf("\033[K");
+        monitor_printf("\033[K");
         memcpy(term_last_cmd_buf, term_cmd_buf, term_cmd_buf_size);
         term_last_cmd_buf_size = term_cmd_buf_size;
         term_last_cmd_buf_index = term_cmd_buf_size;
@@ -100,17 +101,17 @@ static void term_update(void)
         delta = term_cmd_buf_index - term_last_cmd_buf_index;
         if (delta > 0) {
             for(i = 0;i < delta; i++) {
-                term_printf("\033[C");
+                monitor_printf("\033[C");
             }
         } else {
             delta = -delta;
             for(i = 0;i < delta; i++) {
-                term_printf("\033[D");
+                monitor_printf("\033[D");
             }
         }
         term_last_cmd_buf_index = term_cmd_buf_index;
     }
-    term_flush();
+    monitor_flush();
 }
 
 static void term_insert_char(int ch)
@@ -324,7 +325,7 @@ static void term_completion(void)
         if (len > 0 && completions[0][len - 1] != '/')
             term_insert_char(' ');
     } else {
-        term_printf("\n");
+        monitor_printf("\n");
         max_width = 0;
         max_prefix = 0;        
         for(i = 0; i < nb_completions; i++) {
@@ -354,9 +355,9 @@ static void term_completion(void)
         nb_cols = 80 / max_width;
         j = 0;
         for(i = 0; i < nb_completions; i++) {
-            term_printf("%-*s", max_width, completions[i]);
+            monitor_printf("%-*s", max_width, completions[i]);
             if (++j == nb_cols || i == (nb_completions - 1)) {
-                term_printf("\n");
+                monitor_printf("\n");
                 j = 0;
             }
         }
@@ -387,7 +388,7 @@ void readline_handle_byte(int ch)
             term_cmd_buf[term_cmd_buf_size] = '\0';
             if (!term_is_password)
                 term_hist_add(term_cmd_buf);
-            term_printf("\n");
+            monitor_printf("\n");
             term_cmd_buf_index = 0;
             term_cmd_buf_size = 0;
             term_last_cmd_buf_index = 0;
diff --git a/readline.h b/readline.h
new file mode 100644
index 0000000..9538550
--- /dev/null
+++ b/readline.h
@@ -0,0 +1,14 @@
+#ifndef READLINE_H
+#define READLINE_H
+
+typedef void ReadLineFunc(void *opaque, const char *str);
+
+extern int completion_index;
+void add_completion(const char *str);
+void readline_handle_byte(int ch);
+void readline_find_completion(const char *cmdline);
+const char *readline_get_history(unsigned int index);
+void readline_start(const char *prompt, int is_password,
+                    ReadLineFunc *readline_func, void *opaque);
+
+#endif /* !READLINE_H */
diff --git a/savevm.c b/savevm.c
index 3eb2000..33b4bd0 100644
--- a/savevm.c
+++ b/savevm.c
@@ -24,7 +24,7 @@
 #include "qemu-common.h"
 #include "hw/hw.h"
 #include "net.h"
-#include "console.h"
+#include "monitor.h"
 #include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-char.h"
@@ -1010,7 +1010,7 @@ void do_savevm(const char *name)
 
     bs = get_bs_snapshots();
     if (!bs) {
-        term_printf("No block device can accept snapshots\n");
+        monitor_printf("No block device can accept snapshots\n");
         return;
     }
 
@@ -1049,22 +1049,22 @@ void do_savevm(const char *name)
     sn->vm_clock_nsec = qemu_get_clock(vm_clock);
 
     if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) {
-        term_printf("Device %s does not support VM state snapshots\n",
-                    bdrv_get_device_name(bs));
+        monitor_printf("Device %s does not support VM state snapshots\n",
+                       bdrv_get_device_name(bs));
         goto the_end;
     }
 
     /* save the VM state */
     f = qemu_fopen_bdrv(bs, bdi->vm_state_offset, 1);
     if (!f) {
-        term_printf("Could not open VM state file\n");
+        monitor_printf("Could not open VM state file\n");
         goto the_end;
     }
     ret = qemu_savevm_state(f);
     vm_state_size = qemu_ftell(f);
     qemu_fclose(f);
     if (ret < 0) {
-        term_printf("Error %d while writing VM\n", ret);
+        monitor_printf("Error %d while writing VM\n", ret);
         goto the_end;
     }
 
@@ -1076,16 +1076,16 @@ void do_savevm(const char *name)
             if (must_delete) {
                 ret = bdrv_snapshot_delete(bs1, old_sn->id_str);
                 if (ret < 0) {
-                    term_printf("Error while deleting snapshot on '%s'\n",
-                                bdrv_get_device_name(bs1));
+                    monitor_printf("Error while deleting snapshot on '%s'\n",
+                                   bdrv_get_device_name(bs1));
                 }
             }
             /* Write VM state size only to the image that contains the state */
             sn->vm_state_size = (bs == bs1 ? vm_state_size : 0);
             ret = bdrv_snapshot_create(bs1, sn);
             if (ret < 0) {
-                term_printf("Error while creating snapshot on '%s'\n",
-                            bdrv_get_device_name(bs1));
+                monitor_printf("Error while creating snapshot on '%s'\n",
+                               bdrv_get_device_name(bs1));
             }
         }
     }
@@ -1106,7 +1106,7 @@ void do_loadvm(const char *name)
 
     bs = get_bs_snapshots();
     if (!bs) {
-        term_printf("No block device supports snapshots\n");
+        monitor_printf("No block device supports snapshots\n");
         return;
     }
 
@@ -1122,19 +1122,19 @@ void do_loadvm(const char *name)
             ret = bdrv_snapshot_goto(bs1, name);
             if (ret < 0) {
                 if (bs != bs1)
-                    term_printf("Warning: ");
+                    monitor_printf("Warning: ");
                 switch(ret) {
                 case -ENOTSUP:
-                    term_printf("Snapshots not supported on device '%s'\n",
-                                bdrv_get_device_name(bs1));
+                    monitor_printf("Snapshots not supported on device '%s'\n",
+                                   bdrv_get_device_name(bs1));
                     break;
                 case -ENOENT:
-                    term_printf("Could not find snapshot '%s' on device 
'%s'\n",
-                                name, bdrv_get_device_name(bs1));
+                    monitor_printf("Could not find snapshot '%s' on device 
'%s'\n",
+                                   name, bdrv_get_device_name(bs1));
                     break;
                 default:
-                    term_printf("Error %d while activating snapshot on '%s'\n",
-                                ret, bdrv_get_device_name(bs1));
+                    monitor_printf("Error %d while activating snapshot on 
'%s'\n",
+                                   ret, bdrv_get_device_name(bs1));
                     break;
                 }
                 /* fatal on snapshot block device */
@@ -1145,8 +1145,8 @@ void do_loadvm(const char *name)
     }
 
     if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) {
-        term_printf("Device %s does not support VM state snapshots\n",
-                    bdrv_get_device_name(bs));
+        monitor_printf("Device %s does not support VM state snapshots\n",
+                       bdrv_get_device_name(bs));
         return;
     }
 
@@ -1158,13 +1158,13 @@ void do_loadvm(const char *name)
     /* restore the VM state */
     f = qemu_fopen_bdrv(bs, bdi->vm_state_offset, 0);
     if (!f) {
-        term_printf("Could not open VM state file\n");
+        monitor_printf("Could not open VM state file\n");
         goto the_end;
     }
     ret = qemu_loadvm_state(f);
     qemu_fclose(f);
     if (ret < 0) {
-        term_printf("Error %d while loading VM state\n", ret);
+        monitor_printf("Error %d while loading VM state\n", ret);
     }
  the_end:
     if (saved_vm_running)
@@ -1178,7 +1178,7 @@ void do_delvm(const char *name)
 
     bs = get_bs_snapshots();
     if (!bs) {
-        term_printf("No block device supports snapshots\n");
+        monitor_printf("No block device supports snapshots\n");
         return;
     }
 
@@ -1188,11 +1188,11 @@ void do_delvm(const char *name)
             ret = bdrv_snapshot_delete(bs1, name);
             if (ret < 0) {
                 if (ret == -ENOTSUP)
-                    term_printf("Snapshots not supported on device '%s'\n",
-                                bdrv_get_device_name(bs1));
+                    monitor_printf("Snapshots not supported on device '%s'\n",
+                                   bdrv_get_device_name(bs1));
                 else
-                    term_printf("Error %d while deleting snapshot on '%s'\n",
-                                ret, bdrv_get_device_name(bs1));
+                    monitor_printf("Error %d while deleting snapshot on 
'%s'\n",
+                                   ret, bdrv_get_device_name(bs1));
             }
         }
     }
@@ -1207,29 +1207,29 @@ void do_info_snapshots(void)
 
     bs = get_bs_snapshots();
     if (!bs) {
-        term_printf("No available block device supports snapshots\n");
+        monitor_printf("No available block device supports snapshots\n");
         return;
     }
-    term_printf("Snapshot devices:");
+    monitor_printf("Snapshot devices:");
     for(i = 0; i <= nb_drives; i++) {
         bs1 = drives_table[i].bdrv;
         if (bdrv_has_snapshot(bs1)) {
             if (bs == bs1)
-                term_printf(" %s", bdrv_get_device_name(bs1));
+                monitor_printf(" %s", bdrv_get_device_name(bs1));
         }
     }
-    term_printf("\n");
+    monitor_printf("\n");
 
     nb_sns = bdrv_snapshot_list(bs, &sn_tab);
     if (nb_sns < 0) {
-        term_printf("bdrv_snapshot_list: error %d\n", nb_sns);
+        monitor_printf("bdrv_snapshot_list: error %d\n", nb_sns);
         return;
     }
-    term_printf("Snapshot list (from %s):\n", bdrv_get_device_name(bs));
-    term_printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));
+    monitor_printf("Snapshot list (from %s):\n", bdrv_get_device_name(bs));
+    monitor_printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));
     for(i = 0; i < nb_sns; i++) {
         sn = &sn_tab[i];
-        term_printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn));
+        monitor_printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn));
     }
     qemu_free(sn_tab);
 }
diff --git a/slirp/misc.c b/slirp/misc.c
index f558b3c..5cd753c 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -557,14 +557,14 @@ relay(s)
 #endif
 
 #ifdef CONFIG_QEMU
-extern void term_vprintf(const char *fmt, va_list ap);
+extern void monitor_vprintf(const char *fmt, va_list ap);
 
 void lprint(const char *format, ...)
 {
     va_list args;
 
     va_start(args, format);
-    term_vprintf(format, args);
+    monitor_vprintf(format, args);
     va_end(args);
 }
 #else
diff --git a/usb-linux.c b/usb-linux.c
index f19f0c4..a1153fc 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -32,7 +32,7 @@
 
 #include "qemu-common.h"
 #include "qemu-timer.h"
-#include "console.h"
+#include "monitor.h"
 
 #include <dirent.h>
 #include <sys/ioctl.h>
@@ -998,7 +998,8 @@ USBDevice *usb_host_device_open(const char *devname)
         return NULL;
 
     if (hostdev_find(bus_num, addr)) {
-       term_printf("husb: host usb device %d.%d is already open\n", bus_num, 
addr);
+       monitor_printf("husb: host usb device %d.%d is already open\n",
+                      bus_num, addr);
        return NULL;
     }
 
@@ -1161,7 +1162,7 @@ static int usb_host_read_file(char *line, size_t 
line_size, const char *device_f
         fclose(f);
         ret = 1;
     } else {
-        term_printf("husb: could not open %s\n", filename);
+        monitor_printf("husb: could not open %s\n", filename);
     }
 
     return ret;
@@ -1292,14 +1293,15 @@ static int usb_host_scan(void *opaque, USBScanFunc 
*func)
         }
     found_devices:
         if (!usb_fs_type) {
-            term_printf("husb: unable to access USB devices\n");
+            monitor_printf("husb: unable to access USB devices\n");
             return -ENOENT;
         }
 
         /* the module setting (used later for opening devices) */
         usb_host_device_path = qemu_mallocz(strlen(devpath)+1);
         strcpy(usb_host_device_path, devpath);
-        term_printf("husb: using %s file-system with %s\n", 
fs_type[usb_fs_type], usb_host_device_path);
+        monitor_printf("husb: using %s file-system with %s\n",
+                       fs_type[usb_fs_type], usb_host_device_path);
     }
 
     switch (usb_fs_type) {
@@ -1623,17 +1625,17 @@ static void usb_info_device(int bus_num, int addr, int 
class_id,
         break;
     }
 
-    term_printf("  Device %d.%d, speed %s Mb/s\n",
+    monitor_printf("  Device %d.%d, speed %s Mb/s\n",
                 bus_num, addr, speed_str);
     class_str = usb_class_str(class_id);
     if (class_str)
-        term_printf("    %s:", class_str);
+        monitor_printf("    %s:", class_str);
     else
-        term_printf("    Class %02x:", class_id);
-    term_printf(" USB device %04x:%04x", vendor_id, product_id);
+        monitor_printf("    Class %02x:", class_id);
+    monitor_printf(" USB device %04x:%04x", vendor_id, product_id);
     if (product_name[0] != '\0')
-        term_printf(", %s", product_name);
-    term_printf("\n");
+        monitor_printf(", %s", product_name);
+    monitor_printf("\n");
 }
 
 static int usb_host_info_device(void *opaque, int bus_num, int addr,
@@ -1670,13 +1672,13 @@ void usb_host_info(void)
     usb_host_scan(NULL, usb_host_info_device);
 
     if (usb_auto_filter)
-        term_printf("  Auto filters:\n");
+        monitor_printf("  Auto filters:\n");
     for (f = usb_auto_filter; f; f = f->next) {
         char bus[10], addr[10], vid[10], pid[10];
         dec2str(f->bus_num, bus, sizeof(bus));
         dec2str(f->addr, addr, sizeof(addr));
         hex2str(f->vendor_id, vid, sizeof(vid));
         hex2str(f->product_id, pid, sizeof(pid));
-       term_printf("    Device %s.%s ID %s:%s\n", bus, addr, vid, pid);
+        monitor_printf("    Device %s.%s ID %s:%s\n", bus, addr, vid, pid);
     }
 }
diff --git a/vl.c b/vl.c
index aff2b2c..b00d009 100644
--- a/vl.c
+++ b/vl.c
@@ -31,6 +31,7 @@
 #include "hw/baum.h"
 #include "hw/bt.h"
 #include "net.h"
+#include "monitor.h"
 #include "console.h"
 #include "sysemu.h"
 #include "gdbstub.h"
@@ -651,16 +652,16 @@ void do_info_mice(void)
     int index = 0;
 
     if (!qemu_put_mouse_event_head) {
-        term_printf("No mouse devices connected\n");
+        monitor_printf("No mouse devices connected\n");
         return;
     }
 
-    term_printf("Mouse devices available:\n");
+    monitor_printf("Mouse devices available:\n");
     cursor = qemu_put_mouse_event_head;
     while (cursor != NULL) {
-        term_printf("%c Mouse #%d: %s\n",
-                    (cursor == qemu_put_mouse_event_current ? '*' : ' '),
-                    index, cursor->qemu_put_mouse_event_name);
+        monitor_printf("%c Mouse #%d: %s\n",
+                       (cursor == qemu_put_mouse_event_current ? '*' : ' '),
+                       index, cursor->qemu_put_mouse_event_name);
         index++;
         cursor = cursor->next;
     }
@@ -672,7 +673,7 @@ void do_mouse_set(int index)
     int i = 0;
 
     if (!qemu_put_mouse_event_head) {
-        term_printf("No mouse devices connected\n");
+        monitor_printf("No mouse devices connected\n");
         return;
     }
 
@@ -685,7 +686,7 @@ void do_mouse_set(int index)
     if (cursor != NULL)
         qemu_put_mouse_event_current = cursor;
     else
-        term_printf("Mouse at given index not found\n");
+        monitor_printf("Mouse at given index not found\n");
 }
 
 /* compute with 96 bit intermediate result: (a*b)/c */
@@ -2712,7 +2713,7 @@ void usb_info(void)
     const char *speed_str;
 
     if (!usb_enabled) {
-        term_printf("USB support not enabled\n");
+        monitor_printf("USB support not enabled\n");
         return;
     }
 
@@ -2734,8 +2735,8 @@ void usb_info(void)
             speed_str = "?";
             break;
         }
-        term_printf("  Device %d.%d, Speed %s Mb/s, Product %s\n",
-                    0, dev->addr, speed_str, dev->devname);
+        monitor_printf("  Device %d.%d, Speed %s Mb/s, Product %s\n",
+                       0, dev->addr, speed_str, dev->devname);
     }
 }
 
@@ -2773,12 +2774,12 @@ void pcmcia_info(void)
 {
     struct pcmcia_socket_entry_s *iter;
     if (!pcmcia_sockets)
-        term_printf("No PCMCIA sockets\n");
+        monitor_printf("No PCMCIA sockets\n");
 
     for (iter = pcmcia_sockets; iter; iter = iter->next)
-        term_printf("%s: %s\n", iter->socket->slot_string,
-                    iter->socket->attached ? iter->socket->card_string :
-                    "Empty");
+        monitor_printf("%s: %s\n", iter->socket->slot_string,
+                       iter->socket->attached ? iter->socket->card_string :
+                       "Empty");
 }
 
 /***********************************************************/
@@ -4272,12 +4273,12 @@ int qemu_key_check(BlockDriverState *bs, const char 
*name)
     if (!bdrv_is_encrypted(bs))
         return 0;
 
-    term_printf("%s is encrypted.\n", name);
+    monitor_printf("%s is encrypted.\n", name);
     for(i = 0; i < 3; i++) {
         monitor_readline("Password: ", 1, password, sizeof(password));
         if (bdrv_set_key(bs, password) == 0)
             return 0;
-        term_printf("invalid password\n");
+        monitor_printf("invalid password\n");
     }
     return -EPERM;
 }
diff --git a/vnc.c b/vnc.c
index bdfc79b..63252a8 100644
--- a/vnc.c
+++ b/vnc.c
@@ -24,6 +24,7 @@
  */
 
 #include "qemu-common.h"
+#include "monitor.h"
 #include "console.h"
 #include "sysemu.h"
 #include "qemu_socket.h"
@@ -157,16 +158,16 @@ static DisplayChangeListener *dcl;
 void do_info_vnc(void)
 {
     if (vnc_state == NULL || vnc_state->display == NULL)
-       term_printf("VNC server disabled\n");
+       monitor_printf("VNC server disabled\n");
     else {
-       term_printf("VNC server active on: ");
-       term_print_filename(vnc_state->display);
-       term_printf("\n");
+       monitor_printf("VNC server active on: ");
+       monitor_print_filename(vnc_state->display);
+       monitor_printf("\n");
 
        if (vnc_state->csock == -1)
-           term_printf("No client connected\n");
+           monitor_printf("No client connected\n");
        else
-           term_printf("Client connected\n");
+           monitor_printf("Client connected\n");
     }
 }
 
@@ -776,7 +777,7 @@ static void audio_add(VncState *vs)
     struct audio_capture_ops ops;
 
     if (vs->audio_cap) {
-        term_printf ("audio already running\n");
+        monitor_printf("audio already running\n");
         return;
     }
 
@@ -786,7 +787,7 @@ static void audio_add(VncState *vs)
 
     vs->audio_cap = AUD_add_capture(NULL, &vs->as, &ops, vs);
     if (!vs->audio_cap) {
-        term_printf ("Failed to add audio capture\n");
+        monitor_printf("Failed to add audio capture\n");
     }
 }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]