Am 04.06.2012 15:10, schrieb Corey Bryant: > This patch adds QMP support for the getfd command using the QAPI framework. > Like the HMP getfd command, it is used to pass a file descriptor via > SCM_RIGHTS. However, the QMP getfd command also returns the received file > descriptor, which is a difference in behavior from the HMP getfd command, > which returns nothing. > > Signed-off-by: Corey Bryant <cor...@linux.vnet.ibm.com> > --- > hmp-commands.hx | 2 +- > monitor.c | 37 ++++++++++++++++++++++++++++++++++++- > qapi-schema.json | 13 +++++++++++++ > qmp-commands.hx | 6 ++++-- > 4 files changed, 54 insertions(+), 4 deletions(-) > > diff --git a/hmp-commands.hx b/hmp-commands.hx > index 18cb415..dfab369 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -1211,7 +1211,7 @@ ETEXI > .params = "getfd name", > .help = "receive a file descriptor via SCM rights and assign > it a name", > .user_print = monitor_user_noop, > - .mhandler.cmd_new = do_getfd, > + .mhandler.cmd_new = hmp_getfd, > }, > > STEXI > diff --git a/monitor.c b/monitor.c > index 12a6fe2..6acf5a3 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -2199,7 +2199,7 @@ static void do_inject_mce(Monitor *mon, const QDict > *qdict) > } > #endif > > -static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data) > +static int hmp_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data) > { > const char *fdname = qdict_get_str(qdict, "fdname"); > mon_fd_t *monfd;
This should become a wrapper around qmp_getfd() instead of duplicating the logic. Kevin