From: Luiz Capitulino <lcapitulino@redhat.com>
To: Hani Benhabiles <kroosec@gmail.com>
Cc: kwolf@redhat.com, imammedo@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/7] monitor: Add command_completion callback to mon_cmd_t.
Date: Fri, 28 Mar 2014 09:10:36 -0400 [thread overview]
Message-ID: <20140328091036.2c12e3e3@redhat.com> (raw)
In-Reply-To: <20140327215546.GD22714@Inspiron-3521>
On Thu, 27 Mar 2014 22:55:46 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:
> On Thu, Mar 27, 2014 at 04:21:51PM -0400, Luiz Capitulino wrote:
> >
> > I think this patch has to be split into at least three patches. One for
> > the drive_del change (which is unrelated with the other stuff), one
> > converting device_add & device_del and the third one converting
> > object_add and object_del.
> >
> > Also, please, take the simplest conversion for the first patch, which
> > introduces the callback.
> >
>
> Ok, I will split them. Just felt that the number of patches was growing-up too
> fast.
That's not a problem.
> > One more comment below.
> >
> > >
> > > Signed-off-by: Hani Benhabiles <hani@linux.com>
> > > Suggested-by: Luiz Capitulino <lcapitulino@redhat.com>
> > > ---
> > > hmp-commands.hx | 6 +++++-
> > > hmp.h | 4 ++++
> > > monitor.c | 65 +++++++++++++++++++++++++++++++++++----------------------
> > > 3 files changed, 49 insertions(+), 26 deletions(-)
> > >
> > > diff --git a/hmp-commands.hx b/hmp-commands.hx
> > > index f3fc514..4c4d261 100644
> > > --- a/hmp-commands.hx
> > > +++ b/hmp-commands.hx
> > > @@ -176,7 +176,7 @@ ETEXI
> > >
> > > {
> > > .name = "drive_del",
> > > - .args_type = "id:s",
> > > + .args_type = "id:B",
> > > .params = "device",
> > > .help = "remove host block device",
> > > .user_print = monitor_user_noop,
> > > @@ -658,6 +658,7 @@ ETEXI
> > > .help = "add device, like -device on the command line",
> > > .user_print = monitor_user_noop,
> > > .mhandler.cmd_new = do_device_add,
> > > + .command_completion = device_add_completion,
> > > },
> > >
> > > STEXI
> > > @@ -673,6 +674,7 @@ ETEXI
> > > .params = "device",
> > > .help = "remove device",
> > > .mhandler.cmd = hmp_device_del,
> > > + .command_completion = device_del_completion,
> > > },
> > >
> > > STEXI
> > > @@ -1254,6 +1256,7 @@ ETEXI
> > > .params = "[qom-type=]type,id=str[,prop=value][,...]",
> > > .help = "create QOM object",
> > > .mhandler.cmd = hmp_object_add,
> > > + .command_completion = object_add_completion,
> > > },
> > >
> > > STEXI
> > > @@ -1268,6 +1271,7 @@ ETEXI
> > > .params = "id",
> > > .help = "destroy QOM object",
> > > .mhandler.cmd = hmp_object_del,
> > > + .command_completion = object_del_completion,
> > > },
> > >
> > > STEXI
> > > diff --git a/hmp.h b/hmp.h
> > > index ed58f0e..558658f 100644
> > > --- a/hmp.h
> > > +++ b/hmp.h
> > > @@ -92,5 +92,9 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict);
> > > void hmp_cpu_add(Monitor *mon, const QDict *qdict);
> > > void hmp_object_add(Monitor *mon, const QDict *qdict);
> > > void hmp_object_del(Monitor *mon, const QDict *qdict);
> > > +void device_add_completion(Monitor *mon, int nb_args, const char *str);
> > > +void device_del_completion(Monitor *mon, int nb_args, const char *str);
> > > +void object_add_completion(Monitor *mon, int nb_args, const char *str);
> > > +void object_del_completion(Monitor *mon, int nb_args, const char *str);
> > >
> > > #endif
> > > diff --git a/monitor.c b/monitor.c
> > > index 342e83b..2c8528c 100644
> > > --- a/monitor.c
> > > +++ b/monitor.c
> > > @@ -137,6 +137,7 @@ typedef struct mon_cmd_t {
> > > * used, and mhandler of 1st level plays the role of help function.
> > > */
> > > struct mon_cmd_t *sub_table;
> > > + void (*command_completion)(Monitor *mon, int nb_args, const char *str);
> >
> > Why does command_completion need 'mon'? It seems to me that a ReadLineState
> > suffices.
>
> No particular reason right now. I just tried to keep the prototype general
> enough in order to not have to make a mass conversion in case some need shows up
> in the future. Should I just use ReadLineState in the next series version ?
IMO, yes. If, in the future, it turns out we need a Monitor object we can
just update the callback signature.
next prev parent reply other threads:[~2014-03-28 13:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 11:16 [Qemu-devel] [PATCH 0/7] monitor: Completion support for various commands Hani Benhabiles
2014-03-09 11:16 ` [Qemu-devel] [PATCH 1/7] monitor: Add command_completion callback to mon_cmd_t Hani Benhabiles
2014-03-27 20:21 ` Luiz Capitulino
2014-03-27 21:55 ` Hani Benhabiles
2014-03-28 13:10 ` Luiz Capitulino [this message]
2014-03-09 11:16 ` [Qemu-devel] [PATCH 2/7] monitor: Add chardev-remove id argument completion Hani Benhabiles
2014-03-09 11:16 ` [Qemu-devel] [PATCH 3/7] monitor: Add chardev-add backend " Hani Benhabiles
2014-03-09 11:16 ` [Qemu-devel] [PATCH 4/7] monitor: Add cpu index " Hani Benhabiles
2014-03-27 20:24 ` Luiz Capitulino
2014-03-27 21:51 ` Hani Benhabiles
2014-03-09 11:16 ` [Qemu-devel] [PATCH 5/7] monitor: Add set_link arguments completion Hani Benhabiles
2014-03-09 11:16 ` [Qemu-devel] [PATCH 6/7] monitor: Add netdev_add type argument completion Hani Benhabiles
2014-03-09 11:16 ` [Qemu-devel] [PATCH 7/7] monitor: Add netdev_del id " Hani Benhabiles
2014-03-10 14:44 ` [Qemu-devel] [PATCH 0/7] monitor: Completion support for various commands Luiz Capitulino
2014-03-11 7:18 ` Hani Benhabiles
2014-03-27 20:26 ` Luiz Capitulino
2014-03-27 21:47 ` Hani Benhabiles
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=20140328091036.2c12e3e3@redhat.com \
--to=lcapitulino@redhat.com \
--cc=imammedo@redhat.com \
--cc=kroosec@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.