qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] monitor: Add device_del argument completion.
@ 2014-01-27 21:54 Hani Benhabiles
  2014-02-10 20:16 ` Luiz Capitulino
  0 siblings, 1 reply; 2+ messages in thread
From: Hani Benhabiles @ 2014-01-27 21:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: lcapitulino

Signed-off-by: Hani Benhabiles <kroosec@gmail.com>
---
 monitor.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/monitor.c b/monitor.c
index 80456fb..a7a589e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4254,6 +4254,25 @@ static const char *next_arg_type(const char *typestr)
     return (p != NULL ? ++p : typestr);
 }
 
+static void device_del_completion(ReadLineState *rs, BusState *bus,
+                                  const char *str, size_t len)
+{
+    BusChild *kid;
+
+    QTAILQ_FOREACH(kid, &bus->children, sibling) {
+        DeviceState *dev = kid->child;
+        BusState *dev_child;
+
+        if (dev->id && !strncmp(str, dev->id, len)) {
+            readline_add_completion(rs, dev->id);
+        }
+
+        QLIST_FOREACH(dev_child, &dev->child_bus, sibling) {
+            device_del_completion(rs, dev_child, str, len);
+        }
+    }
+}
+
 static void monitor_find_completion_by_table(Monitor *mon,
                                              const mon_cmd_t *cmd_table,
                                              char **args,
@@ -4330,6 +4349,10 @@ static void monitor_find_completion_by_table(Monitor *mon,
             } else if (!strcmp(cmd->name, "help|?")) {
                 monitor_find_completion_by_table(mon, cmd_table,
                                                  &args[1], nb_args - 1);
+            } else if (!strcmp(cmd->name, "device_del") && nb_args == 2) {
+                size_t len = strlen(str);
+                readline_set_completion_index(mon->rs, len);
+                device_del_completion(mon->rs, sysbus_get_default(), str, len);
             }
             break;
         default:
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: Add device_del argument completion.
  2014-01-27 21:54 [Qemu-devel] [PATCH] monitor: Add device_del argument completion Hani Benhabiles
@ 2014-02-10 20:16 ` Luiz Capitulino
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Capitulino @ 2014-02-10 20:16 UTC (permalink / raw)
  To: Hani Benhabiles; +Cc: qemu-devel

On Mon, 27 Jan 2014 22:54:14 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:

> Signed-off-by: Hani Benhabiles <kroosec@gmail.com>

Applied to the qmp branch, thanks.

> ---
>  monitor.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/monitor.c b/monitor.c
> index 80456fb..a7a589e 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4254,6 +4254,25 @@ static const char *next_arg_type(const char *typestr)
>      return (p != NULL ? ++p : typestr);
>  }
>  
> +static void device_del_completion(ReadLineState *rs, BusState *bus,
> +                                  const char *str, size_t len)
> +{
> +    BusChild *kid;
> +
> +    QTAILQ_FOREACH(kid, &bus->children, sibling) {
> +        DeviceState *dev = kid->child;
> +        BusState *dev_child;
> +
> +        if (dev->id && !strncmp(str, dev->id, len)) {
> +            readline_add_completion(rs, dev->id);
> +        }
> +
> +        QLIST_FOREACH(dev_child, &dev->child_bus, sibling) {
> +            device_del_completion(rs, dev_child, str, len);
> +        }
> +    }
> +}
> +
>  static void monitor_find_completion_by_table(Monitor *mon,
>                                               const mon_cmd_t *cmd_table,
>                                               char **args,
> @@ -4330,6 +4349,10 @@ static void monitor_find_completion_by_table(Monitor *mon,
>              } else if (!strcmp(cmd->name, "help|?")) {
>                  monitor_find_completion_by_table(mon, cmd_table,
>                                                   &args[1], nb_args - 1);
> +            } else if (!strcmp(cmd->name, "device_del") && nb_args == 2) {
> +                size_t len = strlen(str);
> +                readline_set_completion_index(mon->rs, len);
> +                device_del_completion(mon->rs, sysbus_get_default(), str, len);
>              }
>              break;
>          default:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-10 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-27 21:54 [Qemu-devel] [PATCH] monitor: Add device_del argument completion Hani Benhabiles
2014-02-10 20:16 ` Luiz Capitulino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).