diff mbox

monitor: Remove hardcoded watchdog event names

Message ID 1406672560-21029-1-git-send-email-kroosec@gmail.com
State New
Headers show

Commit Message

Hani Benhabiles July 29, 2014, 10:22 p.m. UTC
Signed-off-by: Hani Benhabiles <hani@linux.com>
---
 monitor.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Luiz Capitulino Aug. 1, 2014, 1:58 p.m. UTC | #1
On Tue, 29 Jul 2014 23:22:40 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:

> Signed-off-by: Hani Benhabiles <hani@linux.com>

Applied to the qmp-next branch, thanks.

> ---
>  monitor.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 5bc70a6..7465775 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4520,16 +4520,15 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str)
>  
>  void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
>  {
> +    int i;
> +
>      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");
> +    for (i = 0; WatchdogExpirationAction_lookup[i]; i++) {
> +        add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
> +    }
>  }
>  
>  void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 5bc70a6..7465775 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4520,16 +4520,15 @@  void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str)
 
 void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
 {
+    int i;
+
     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");
+    for (i = 0; WatchdogExpirationAction_lookup[i]; i++) {
+        add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
+    }
 }
 
 void migrate_set_capability_completion(ReadLineState *rs, int nb_args,