qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Cc: peter.crosthwaite@xilinx.com, mst@redhat.com,
	hutao@cn.fujitsu.com, qemu-devel@nongnu.org,
	lcapitulino@redhat.com, isimatu.yasuaki@jp.fujitsu.com,
	pbonzini@redhat.com, imammedo@redhat.com,
	tangchen@cn.fujitsu.com, afaerber@suse.de, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 2/3] monitor: add del completion for peripheral device
Date: Sun, 19 Oct 2014 14:37:13 +0300	[thread overview]
Message-ID: <1413718633.11602.15.camel@localhost.localdomain> (raw)
In-Reply-To: <20ae54cda2f484bbdc6f182ac6a6c83841784ef7.1413525853.git.zhugh.fnst@cn.fujitsu.com>

On Fri, 2014-10-17 at 17:35 +0800, Zhu Guihua wrote:
> Add peripheral_device_del_completion() to let peripheral device del completion
> be possible.
> 
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
>  monitor.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/monitor.c b/monitor.c
> index 2d14f39..9c3fa01 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4359,6 +4359,29 @@ static void device_del_bus_completion(ReadLineState *rs,  BusState *bus,
>      }
>  }
>  
> +static void peripheral_device_del_completion(ReadLineState *rs,
> +                                             const char *str, size_t len)
> +{
> +    Object *peripheral;
> +    GSList *list = NULL, *item;
> +
> +    peripheral = object_resolve_path("/machine/peripheral/", NULL);
> +    if (peripheral == NULL) {
> +        return;
> +    }
> +
> +    object_child_foreach(peripheral, qdev_build_hotpluggable_device_list,
> +                         &list);
> +
> +    for (item = list; item; item = g_slist_next(item)) {
> +        DeviceState *dev = item->data;
> +
> +        if (dev->id && !strncmp(str, dev->id, len)) {
> +            readline_add_completion(rs, dev->id);
> +        }
> +    
Hi,

Am I missing something or g_slist_free(list)
should be somewhere here?

Thanks,
Marcel



> +}
> +
>  void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str)
>  {
>      size_t len;
> @@ -4432,6 +4455,7 @@ void device_del_completion(ReadLineState *rs, int nb_args, const char *str)
>      len = strlen(str);
>      readline_set_completion_index(rs, len);
>      device_del_bus_completion(rs, sysbus_get_default(), str, len);
> +    peripheral_device_del_completion(rs, str, len);
>  }
>  
>  void object_del_completion(ReadLineState *rs, int nb_args, const char *str)

  reply	other threads:[~2014-10-19 11:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  9:35 [Qemu-devel] [PATCH v4 0/3] monitor: add peripheral device del completion support Zhu Guihua
2014-10-17  9:35 ` [Qemu-devel] [PATCH v4 1/3] qdev: add qdev_build_hotpluggable_device_list helper Zhu Guihua
2014-10-17  9:35 ` [Qemu-devel] [PATCH v4 2/3] monitor: add del completion for peripheral device Zhu Guihua
2014-10-19 11:37   ` Marcel Apfelbaum [this message]
2014-10-20  0:58     ` Zhu Guihua
2014-10-17  9:36 ` [Qemu-devel] [PATCH v4 3/3] monitor: delete device_del_bus_completion Zhu Guihua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413718633.11602.15.camel@localhost.localdomain \
    --to=marcel.apfelbaum@gmail.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=lcapitulino@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tangchen@cn.fujitsu.com \
    --cc=zhugh.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).