[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/11] QMP: Command-line flag to enable control mode
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 11/11] QMP: Command-line flag to enable control mode |
Date: |
Tue, 23 Jun 2009 01:30:05 -0300 |
This change adds a flag called 'control' to the already existing
'-monitor' command-line option. This flag can be used to enable
control mode.
Its syntax is:
qemu [...] -monitor control,<device>
Where <device> is a chardev (excluding 'vc', for obvious reasons).
For example:
$ qemu [...] -monitor control,tcp:localhost:4444,server
Will run QEMU in control mode, waiting for a client TCP connection
on localhost port 4444.
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 19 +++++++++++++++++++
monitor.h | 1 +
vl.c | 5 +++--
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/monitor.c b/monitor.c
index 7ebf0ea..c1baeac 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3192,6 +3192,25 @@ static void monitor_event(void *opaque, int event)
* End:
*/
+const char *monitor_cmdline_parse(const char *cmdline, int *flags)
+{
+ const char *dev;
+
+ *flags = MONITOR_IS_DEFAULT;
+ if (strstart(cmdline, "control,", &dev)) {
+ if (strstart(dev, "vc", NULL)) {
+ fprintf(stderr, "qemu: control mode is for low-level interaction
");
+ fprintf(stderr, "cannot be used with device 'vc'\n");
+ exit(1);
+ }
+ *flags |= MONITOR_USE_CONTROL;
+ return dev;
+ }
+
+ *flags |= MONITOR_USE_READLINE;
+ return cmdline;
+}
+
void monitor_init(CharDriverState *chr, int flags)
{
static int is_first_init = 1;
diff --git a/monitor.h b/monitor.h
index 579b80b..9ddd264 100644
--- a/monitor.h
+++ b/monitor.h
@@ -20,6 +20,7 @@ typedef enum MonitorEvent {
EVENT_MAX,
} MonitorEvent;
+const char *monitor_cmdline_parse(const char *cmdline, int *flags);
void monitor_init(CharDriverState *chr, int flags);
int monitor_suspend(Monitor *mon);
diff --git a/vl.c b/vl.c
index 7dc5954..bd83dac 100644
--- a/vl.c
+++ b/vl.c
@@ -4977,6 +4977,7 @@ int main(int argc, char **argv, char **envp)
const char *r, *optarg;
CharDriverState *monitor_hd = NULL;
const char *monitor_device;
+ int monitor_flags = MONITOR_IS_DEFAULT | MONITOR_USE_READLINE;
const char *serial_devices[MAX_SERIAL_PORTS];
int serial_device_index;
const char *parallel_devices[MAX_PARALLEL_PORTS];
@@ -5462,7 +5463,7 @@ int main(int argc, char **argv, char **envp)
break;
}
case QEMU_OPTION_monitor:
- monitor_device = optarg;
+ monitor_device = monitor_cmdline_parse(optarg, &monitor_flags);
break;
case QEMU_OPTION_serial:
if (serial_device_index >= MAX_SERIAL_PORTS) {
@@ -6150,7 +6151,7 @@ int main(int argc, char **argv, char **envp)
qemu_chr_initial_reset();
if (monitor_device && monitor_hd)
- monitor_init(monitor_hd, MONITOR_USE_READLINE | MONITOR_IS_DEFAULT);
+ monitor_init(monitor_hd, monitor_flags);
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
const char *devname = serial_devices[i];
--
1.6.3.GIT
- [Qemu-devel] [PATCH 11/11] QMP: Command-line flag to enable control mode,
Luiz Capitulino <=
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Jan Kiszka, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Daniel P. Berrange, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Jan Kiszka, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Avi Kivity, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Jan Kiszka, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Avi Kivity, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Jan Kiszka, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Avi Kivity, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Jan Kiszka, 2009/06/23
- [Qemu-devel] Re: [PATCH 11/11] QMP: Command-line flag to enable control mode, Avi Kivity, 2009/06/23