From patchwork Mon Jan 9 11:24:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 135003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6865DB6F70 for ; Mon, 9 Jan 2012 23:00:34 +1100 (EST) Received: from localhost ([::1]:39007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDLz-0002si-IZ for incoming@patchwork.ozlabs.org; Mon, 09 Jan 2012 06:25:27 -0500 Received: from eggs.gnu.org ([140.186.70.92]:52643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDLG-0000st-SY for qemu-devel@nongnu.org; Mon, 09 Jan 2012 06:24:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkDLA-0006gp-Hr for qemu-devel@nongnu.org; Mon, 09 Jan 2012 06:24:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDLA-0006gg-8Q for qemu-devel@nongnu.org; Mon, 09 Jan 2012 06:24:36 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q09BOYNR009278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 9 Jan 2012 06:24:34 -0500 Received: from localhost (ovpn-113-68.phx2.redhat.com [10.3.113.68]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q09BOXCL003243; Mon, 9 Jan 2012 06:24:33 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 9 Jan 2012 09:24:13 -0200 Message-Id: <1326108257-13042-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1326108257-13042-1-git-send-email-lcapitulino@redhat.com> References: <1326108257-13042-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 06/10] monitor: expose readline state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony Liguori HMP is now implemented in terms of QMP. The monitor has a bunch of logic to deal with HMP right now like readline support. Export it from the monitor so we can consume it in hmp.c. In short time, hmp.c will take over all of the readline bits. Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- monitor.c | 11 ++++++++--- monitor.h | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index aa7259c..bd4bc4f 100644 --- a/monitor.c +++ b/monitor.c @@ -227,7 +227,7 @@ int monitor_cur_is_qmp(void) return cur_mon && monitor_ctrl_mode(cur_mon); } -static void monitor_read_command(Monitor *mon, int show_prompt) +void monitor_read_command(Monitor *mon, int show_prompt) { if (!mon->rs) return; @@ -237,8 +237,8 @@ static void monitor_read_command(Monitor *mon, int show_prompt) readline_show_prompt(mon->rs); } -static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, - void *opaque) +int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, + void *opaque) { if (monitor_ctrl_mode(mon)) { qerror_report(QERR_MISSING_PARAMETER, "password"); @@ -4664,6 +4664,11 @@ static void bdrv_password_cb(Monitor *mon, const char *password, void *opaque) monitor_read_command(mon, 1); } +ReadLineState *monitor_get_rs(Monitor *mon) +{ + return mon->rs; +} + int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, BlockDriverCompletionFunc *completion_cb, void *opaque) diff --git a/monitor.h b/monitor.h index cfa2f67..887c472 100644 --- a/monitor.h +++ b/monitor.h @@ -6,6 +6,7 @@ #include "qerror.h" #include "qdict.h" #include "block.h" +#include "readline.h" extern Monitor *cur_mon; extern Monitor *default_mon; @@ -66,6 +67,10 @@ int monitor_get_cpu_index(void); typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); void monitor_set_error(Monitor *mon, QError *qerror); +void monitor_read_command(Monitor *mon, int show_prompt); +ReadLineState *monitor_get_rs(Monitor *mon); +int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, + void *opaque); int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret);