From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzXeC-0000nP-8z for qemu-devel@nongnu.org; Fri, 02 Sep 2011 13:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzXeA-00022P-Uy for qemu-devel@nongnu.org; Fri, 02 Sep 2011 13:35:20 -0400 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:35504 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzXeA-000227-Hh for qemu-devel@nongnu.org; Fri, 02 Sep 2011 13:35:18 -0400 From: Anthony Liguori Date: Fri, 2 Sep 2011 12:34:50 -0500 Message-Id: <1314984898-19141-8-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1314984898-19141-1-git-send-email-aliguori@us.ibm.com> References: <1314984898-19141-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 07/15] monitor: expose readline state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Michael Roth , Luiz Capitulino 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 --- monitor.c | 11 ++++++++--- monitor.h | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index a83d731..fa93239 100644 --- a/monitor.c +++ b/monitor.c @@ -223,7 +223,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; @@ -233,8 +233,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"); @@ -5303,6 +5303,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 4f2d328..6b2ef77 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; @@ -61,5 +62,9 @@ void monitor_flush(Monitor *mon); 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); #endif /* !MONITOR_H */ -- 1.7.4.1