From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IFxM2-0000yT-IX for qemu-devel@nongnu.org; Tue, 31 Jul 2007 15:26:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IFxM0-0000xk-SN for qemu-devel@nongnu.org; Tue, 31 Jul 2007 15:26:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IFxM0-0000xe-NP for qemu-devel@nongnu.org; Tue, 31 Jul 2007 15:26:00 -0400 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IFxM0-0008G9-DU for qemu-devel@nongnu.org; Tue, 31 Jul 2007 15:26:00 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l6VJPxOp014645 for ; Tue, 31 Jul 2007 15:25:59 -0400 Received: from file.surrey.redhat.com (file.fab.redhat.com [10.33.63.6]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6VJPwIh015440 for ; Tue, 31 Jul 2007 15:25:58 -0400 Received: (from berrange@localhost) by file.surrey.redhat.com (8.13.1/8.13.1/Submit) id l6VJPwlA030486 for qemu-devel@nongnu.org; Tue, 31 Jul 2007 20:25:58 +0100 Date: Tue, 31 Jul 2007 20:25:58 +0100 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] PATCH 2/8: Extend monitor 'change' command for VNC Message-ID: <20070731192558.GK18730@redhat.com> References: <20070731192316.GI18730@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070731192316.GI18730@redhat.com> Reply-To: "Daniel P. Berrange" , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel 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. 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) -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|