[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/9] default devices: monitor
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 4/9] default devices: monitor |
Date: |
Fri, 20 Nov 2009 17:59:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Gerd Hoffmann <address@hidden> writes:
> Switch over monitor to the new defaults system.
Even terser.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> vl.c | 90 +++++++++++++++++++++++++++++++++--------------------------------
> 1 files changed, 46 insertions(+), 44 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 739c3a7..4edc4a3 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -210,6 +210,7 @@ int no_quit = 0;
> CharDriverState *serial_hds[MAX_SERIAL_PORTS];
> CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
> CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
> +CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
> #ifdef TARGET_I386
> int win2k_install_hack = 0;
> int rtc_td_hack = 0;
> @@ -272,6 +273,7 @@ static void *boot_set_opaque;
>
> static int default_serial = 1;
> static int default_parallel = 1;
> +static int default_monitor = 1;
>
> static struct {
> const char *driver;
> @@ -4571,6 +4573,7 @@ struct device_config {
> DEV_BT, /* -bt */
> DEV_SERIAL, /* -serial */
> DEV_PARALLEL, /* -parallel */
> + DEV_MONITOR, /* -monitor */
> } type;
> const char *cmdline;
> QTAILQ_ENTRY(device_config) next;
> @@ -4602,22 +4605,27 @@ static int foreach_device_config(int type, int
> (*func)(const char *cmdline))
> return 0;
> }
>
> -static void serial_monitor_mux(const char *monitor_devices[])
> +static void serial_monitor_mux(void)
> {
> - struct device_config *serial;
> + struct device_config *mon0, *serial;
> const char *devname;
>
> - if (strcmp(monitor_devices[0],"stdio") != 0)
> - return;
> + QTAILQ_FOREACH(mon0, &device_configs, next) {
> + if (mon0->type != DEV_MONITOR)
> + continue;
> + if (strcmp(mon0->cmdline,"stdio") != 0)
> + return;
> + break;
> + }
> QTAILQ_FOREACH(serial, &device_configs, next) {
> if (serial->type != DEV_SERIAL)
> continue;
> devname = serial->cmdline;
> if (devname && !strcmp(devname,"mon:stdio")) {
> - monitor_devices[0] = NULL;
> + QTAILQ_REMOVE(&device_configs, mon0, next);
> break;
> } else if (devname && !strcmp(devname,"stdio")) {
> - monitor_devices[0] = NULL;
> + QTAILQ_REMOVE(&device_configs, mon0, next);
> serial->cmdline = "mon:stdio";
> break;
> }
> @@ -4668,6 +4676,28 @@ static int parallel_parse(const char *devname)
> return 0;
> }
>
> +static int monitor_parse(const char *devname)
> +{
> + static int index = 0;
> + char label[32];
> +
> + if (strcmp(devname, "none") == 0)
> + return 0;
> + if (index == 0) {
> + snprintf(label, sizeof(label), "monitor");
> + } else {
> + snprintf(label, sizeof(label), "monitor%d", index);
> + }
> + monitor_hds[index] = qemu_chr_open(label, devname, NULL);
Like for serial_parse(): don't you have to catch index >=
MAX_MONITOR_DEVICES here?
> + if (!monitor_hds[index]) {
> + fprintf(stderr, "qemu: could not open monitor device '%s'\n",
> + devname);
> + return -1;
> + }
> + index++;
> + return 0;
> +}
> +
> int main(int argc, char **argv, char **envp)
> {
> const char *gdbstub_dev = NULL;
[...]
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, (continued)
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Markus Armbruster, 2009/11/20
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Paul Brook, 2009/11/20
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Gerd Hoffmann, 2009/11/23
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Paul Brook, 2009/11/23
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Gerd Hoffmann, 2009/11/23
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Paul Brook, 2009/11/23
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Daniel P. Berrange, 2009/11/23
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Anthony Liguori, 2009/11/23
- Re: [Qemu-devel] [PATCH 1/9] chardev: add greeting, Gerd Hoffmann, 2009/11/23
[Qemu-devel] [PATCH 4/9] default devices: monitor, Gerd Hoffmann, 2009/11/17
- Re: [Qemu-devel] [PATCH 4/9] default devices: monitor,
Markus Armbruster <=
[Qemu-devel] [PATCH 3/9] default devices: parallel port, Gerd Hoffmann, 2009/11/17
[Qemu-devel] [PATCH 8/9] default devices: drives, Gerd Hoffmann, 2009/11/17
[Qemu-devel] [PATCH 7/9] default devices: net, Gerd Hoffmann, 2009/11/17
[Qemu-devel] [PATCH 5/9] zap serial_monitor_mux, Gerd Hoffmann, 2009/11/17
[Qemu-devel] [PATCH 9/9] default devices: global switch., Gerd Hoffmann, 2009/11/17
[Qemu-devel] [PATCH 6/9] default devices: vga, Gerd Hoffmann, 2009/11/17