From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IG3FG-0003Zv-0l for qemu-devel@nongnu.org; Tue, 31 Jul 2007 21:43:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IG3FD-0003Zj-M0 for qemu-devel@nongnu.org; Tue, 31 Jul 2007 21:43:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IG3FD-0003Zg-Fi for qemu-devel@nongnu.org; Tue, 31 Jul 2007 21:43:23 -0400 Received: from wx-out-0506.google.com ([66.249.82.239]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IG3FD-0001lK-42 for qemu-devel@nongnu.org; Tue, 31 Jul 2007 21:43:23 -0400 Received: by wx-out-0506.google.com with SMTP id h31so54494wxd for ; Tue, 31 Jul 2007 18:43:22 -0700 (PDT) Message-ID: <46AFE538.3030206@codemonkey.ws> Date: Tue, 31 Jul 2007 20:43:20 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] PATCH 2/8: Extend monitor 'change' command for VNC References: <20070731192316.GI18730@redhat.com> <20070731192558.GK18730@redhat.com> In-Reply-To: <20070731192558.GK18730@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Daniel P. Berrange wrote: > This patch extends the QEMU monitor 'change' command so that it can > be used to change the configuration of the VNC server. On the command > line the user can use -vnc none, and then issue the 'change vnc :1' > command later from the monitor. This is utilized in the next patch > to let the monitor fetch a password for the server. The concept could > also be extended to serial & parallel devices allowing changing of > their configuration on the fly. > I've had a very similar patch to this in my queue for a while now. I definitely think this is the right thing to do. Regards, Anthony Liguori > diff -r e85f07144b6c monitor.c > --- a/monitor.c Tue Jul 31 10:53:15 2007 -0400 > +++ b/monitor.c Tue Jul 31 10:55:31 2007 -0400 > @@ -386,7 +386,7 @@ static void do_eject(int force, const ch > eject_device(bs, force); > } > > -static void do_change(const char *device, const char *filename) > +static void do_change_block(const char *device, const char *filename) > { > BlockDriverState *bs; > > @@ -399,6 +399,21 @@ static void do_change(const char *device > return; > bdrv_open(bs, filename, 0); > qemu_key_check(bs, filename); > +} > + > +static void do_change_vnc(const char *target) > +{ > + if (vnc_display_open(NULL, target) < 0) > + term_printf("could not start VNC server on %s\n", target); > +} > + > +static void do_change(const char *device, const char *target) > +{ > + if (strcmp(device, "vnc") == 0) { > + do_change_vnc(target); > + } else { > + do_change_block(device, target); > + } > } > > static void do_screen_dump(const char *filename) > diff -r e85f07144b6c vnc.c > --- a/vnc.c Tue Jul 31 10:53:15 2007 -0400 > +++ b/vnc.c Tue Jul 31 10:55:06 2007 -0400 > @@ -1208,7 +1208,7 @@ void vnc_display_init(DisplayState *ds) > > void vnc_display_close(DisplayState *ds) > { > - VncState *vs = (VncState *)ds->opaque; > + VncState *vs = ds ? (VncState *)ds->opaque : vnc_state; > > if (vs->display) { > qemu_free(vs->display); > @@ -1230,7 +1230,7 @@ int vnc_display_open(DisplayState *ds, c > int reuse_addr, ret; > socklen_t addrlen; > const char *p; > - VncState *vs = (VncState *)ds->opaque; > + VncState *vs = ds ? (VncState *)ds->opaque : vnc_state; > > vnc_display_close(ds); > if (strcmp(arg, "none") == 0) > >