From patchwork Wed Jun 11 14:50:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 358721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 87A56140085 for ; Thu, 12 Jun 2014 00:53:37 +1000 (EST) Received: from localhost ([::1]:46975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WujuB-0000hZ-Hp for incoming@patchwork.ozlabs.org; Wed, 11 Jun 2014 10:53:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wujs2-0005i3-7r for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:51:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wujrw-00088H-U4 for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:51:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wujrw-00087v-KT for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:51:16 -0400 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 s5BEpC1J014597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Jun 2014 10:51:12 -0400 Received: from localhost (ovpn-113-65.phx2.redhat.com [10.3.113.65]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5BEpC3B027561; Wed, 11 Jun 2014 10:51:12 -0400 From: Luiz Capitulino To: peter.maydell@linaro.org Date: Wed, 11 Jun 2014 10:50:54 -0400 Message-Id: <1402498262-20521-10-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1402498262-20521-1-git-send-email-lcapitulino@redhat.com> References: <1402498262-20521-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 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PULL 09/17] monitor: Add watchdog_action argument completion 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: Hani Benhabiles Signed-off-by: Hani Benhabiles Signed-off-by: Luiz Capitulino --- hmp-commands.hx | 1 + hmp.h | 2 ++ monitor.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index dcec5ef..45e1763 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1359,6 +1359,7 @@ ETEXI .params = "[reset|shutdown|poweroff|pause|debug|none]", .help = "change watchdog action", .mhandler.cmd = do_watchdog_action, + .command_completion = watchdog_action_completion, }, STEXI diff --git a/hmp.h b/hmp.h index 212e5d2..a70804d 100644 --- a/hmp.h +++ b/hmp.h @@ -105,5 +105,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str); void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str); void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str); void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str); +void watchdog_action_completion(ReadLineState *rs, int nb_args, + const char *str); #endif diff --git a/monitor.c b/monitor.c index e539e40..68d74cd 100644 --- a/monitor.c +++ b/monitor.c @@ -4559,6 +4559,20 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) } } +void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str) +{ + if (nb_args != 2) { + return; + } + readline_set_completion_index(rs, strlen(str)); + add_completion_option(rs, str, "reset"); + add_completion_option(rs, str, "shutdown"); + add_completion_option(rs, str, "poweroff"); + add_completion_option(rs, str, "pause"); + add_completion_option(rs, str, "debug"); + add_completion_option(rs, str, "none"); +} + static void monitor_find_completion_by_table(Monitor *mon, const mon_cmd_t *cmd_table, char **args,