Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KmqVz-0006Gz-HI for qemu-devel@nongnu.org; Mon, 06 Oct 2008 09:52:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KmqVz-0006Gn-24 for qemu-devel@nongnu.org; Mon, 06 Oct 2008 09:52:47 -0400 Received: from [199.232.76.173] (port=43058 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KmqVy-0006Gk-Va for qemu-devel@nongnu.org; Mon, 06 Oct 2008 09:52:47 -0400 Received: from savannah.gnu.org ([199.232.41.3]:49385 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KmqVy-0002u3-8a for qemu-devel@nongnu.org; Mon, 06 Oct 2008 09:52:46 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KmqVx-0007KZ-PS for qemu-devel@nongnu.org; Mon, 06 Oct 2008 13:52:45 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KmqVx-0007KU-Ek for qemu-devel@nongnu.org; Mon, 06 Oct 2008 13:52:45 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Mon, 06 Oct 2008 13:52:45 +0000 Subject: [Qemu-devel] [5431] Allow the monitor to be suspended during non-blocking op Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5431 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5431 Author: aliguori Date: 2008-10-06 13:52:44 +0000 (Mon, 06 Oct 2008) Log Message: ----------- Allow the monitor to be suspended during non-blocking op Live migration happens in the background, but it is useful to make the monitor command appear as if it's blocking. This allows a management tool to immediately know when the live migration has completed without having to poll the migration status. This patch allows the monitor to be suspended from a monitor callback which will prevent new monitor commands from being executed. Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/console.h trunk/monitor.c Modified: trunk/console.h =================================================================== --- trunk/console.h 2008-10-05 11:47:55 UTC (rev 5430) +++ trunk/console.h 2008-10-06 13:52:44 UTC (rev 5431) @@ -175,6 +175,8 @@ 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); Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-10-05 11:47:55 UTC (rev 5430) +++ trunk/monitor.c 2008-10-06 13:52:44 UTC (rev 5431) @@ -2694,12 +2694,29 @@ readline_handle_byte(buf[i]); } +static int monitor_suspended; + static void monitor_handle_command1(void *opaque, const char *cmdline) { monitor_handle_command(cmdline); - monitor_start_input(); + if (!monitor_suspended) + monitor_start_input(); + else + monitor_suspended = 2; } +void monitor_suspend(void) +{ + monitor_suspended = 1; +} + +void monitor_resume(void) +{ + if (monitor_suspended == 2) + monitor_start_input(); + monitor_suspended = 0; +} + static void monitor_start_input(void) { readline_start("(qemu) ", 0, monitor_handle_command1, NULL);