Message ID | 1267034160-3517-36-git-send-email-armbru@redhat.com |
---|---|
State | New |
Headers | show |
On Wed, 24 Feb 2010 18:55:47 +0100 Markus Armbruster <armbru@redhat.com> wrote: > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > monitor.c | 5 +++++ > monitor.h | 2 ++ > 2 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/monitor.c b/monitor.c > index a4263af..5c87a98 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -194,6 +194,11 @@ static inline int monitor_ctrl_mode(const Monitor *mon) > return (mon->flags & MONITOR_USE_CONTROL); > } > > +int in_qmp_mon(void) > +{ > + return cur_mon && monitor_ctrl_mode(cur_mon); > +} > + Afaik, all public monitor functions begin with 'monitor_'. While it's debatable if it's a good name, let's keep the consistency. Also, I'm going to rename monitor_ctrl_mode() to something like monitor_qmp_mode() or monitor_is_qmp(). In this case the difference with in_qmp_mon() is not clear.
Luiz Capitulino <lcapitulino@redhat.com> writes: > On Wed, 24 Feb 2010 18:55:47 +0100 > Markus Armbruster <armbru@redhat.com> wrote: > >> >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> monitor.c | 5 +++++ >> monitor.h | 2 ++ >> 2 files changed, 7 insertions(+), 0 deletions(-) >> >> diff --git a/monitor.c b/monitor.c >> index a4263af..5c87a98 100644 >> --- a/monitor.c >> +++ b/monitor.c >> @@ -194,6 +194,11 @@ static inline int monitor_ctrl_mode(const Monitor *mon) >> return (mon->flags & MONITOR_USE_CONTROL); >> } >> >> +int in_qmp_mon(void) >> +{ >> + return cur_mon && monitor_ctrl_mode(cur_mon); >> +} >> + > > Afaik, all public monitor functions begin with 'monitor_'. While it's > debatable if it's a good name, let's keep the consistency. > > Also, I'm going to rename monitor_ctrl_mode() to something like > monitor_qmp_mode() or monitor_is_qmp(). In this case the difference with > in_qmp_mon() is not clear. Care to suggest a name?
On Mon, 01 Mar 2010 10:19:49 +0100 Markus Armbruster <armbru@redhat.com> wrote: > Luiz Capitulino <lcapitulino@redhat.com> writes: > > > On Wed, 24 Feb 2010 18:55:47 +0100 > > Markus Armbruster <armbru@redhat.com> wrote: > > > >> > >> Signed-off-by: Markus Armbruster <armbru@redhat.com> > >> --- > >> monitor.c | 5 +++++ > >> monitor.h | 2 ++ > >> 2 files changed, 7 insertions(+), 0 deletions(-) > >> > >> diff --git a/monitor.c b/monitor.c > >> index a4263af..5c87a98 100644 > >> --- a/monitor.c > >> +++ b/monitor.c > >> @@ -194,6 +194,11 @@ static inline int monitor_ctrl_mode(const Monitor *mon) > >> return (mon->flags & MONITOR_USE_CONTROL); > >> } > >> > >> +int in_qmp_mon(void) > >> +{ > >> + return cur_mon && monitor_ctrl_mode(cur_mon); > >> +} > >> + > > > > Afaik, all public monitor functions begin with 'monitor_'. While it's > > debatable if it's a good name, let's keep the consistency. > > > > Also, I'm going to rename monitor_ctrl_mode() to something like > > monitor_qmp_mode() or monitor_is_qmp(). In this case the difference with > > in_qmp_mon() is not clear. > > Care to suggest a name? Maybe, monitor_ctrl_mode() should be monitor_is_qmp() and the new one monitor_cur_is_qmp()? Or should we start exporting monitor names as 'mon_' to make them short?
Luiz Capitulino <lcapitulino@redhat.com> writes: > On Mon, 01 Mar 2010 10:19:49 +0100 > Markus Armbruster <armbru@redhat.com> wrote: > >> Luiz Capitulino <lcapitulino@redhat.com> writes: >> >> > On Wed, 24 Feb 2010 18:55:47 +0100 >> > Markus Armbruster <armbru@redhat.com> wrote: >> > >> >> >> >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> >> --- >> >> monitor.c | 5 +++++ >> >> monitor.h | 2 ++ >> >> 2 files changed, 7 insertions(+), 0 deletions(-) >> >> >> >> diff --git a/monitor.c b/monitor.c >> >> index a4263af..5c87a98 100644 >> >> --- a/monitor.c >> >> +++ b/monitor.c >> >> @@ -194,6 +194,11 @@ static inline int monitor_ctrl_mode(const Monitor *mon) >> >> return (mon->flags & MONITOR_USE_CONTROL); >> >> } >> >> >> >> +int in_qmp_mon(void) >> >> +{ >> >> + return cur_mon && monitor_ctrl_mode(cur_mon); >> >> +} >> >> + >> > >> > Afaik, all public monitor functions begin with 'monitor_'. While it's >> > debatable if it's a good name, let's keep the consistency. >> > >> > Also, I'm going to rename monitor_ctrl_mode() to something like >> > monitor_qmp_mode() or monitor_is_qmp(). In this case the difference with >> > in_qmp_mon() is not clear. >> >> Care to suggest a name? > > Maybe, monitor_ctrl_mode() should be monitor_is_qmp() and the new one > monitor_cur_is_qmp()? Works for me. > Or should we start exporting monitor names as 'mon_' to make them short? Fine with me, but not in my patch series, it's plenty long already :)
diff --git a/monitor.c b/monitor.c index a4263af..5c87a98 100644 --- a/monitor.c +++ b/monitor.c @@ -194,6 +194,11 @@ static inline int monitor_ctrl_mode(const Monitor *mon) return (mon->flags & MONITOR_USE_CONTROL); } +int in_qmp_mon(void) +{ + return cur_mon && monitor_ctrl_mode(cur_mon); +} + static void monitor_read_command(Monitor *mon, int show_prompt) { if (!mon->rs) diff --git a/monitor.h b/monitor.h index 1222ff0..9fc9639 100644 --- a/monitor.h +++ b/monitor.h @@ -30,6 +30,8 @@ typedef enum MonitorEvent { QEVENT_MAX, } MonitorEvent; +int in_qmp_mon(void); + void monitor_protocol_event(MonitorEvent event, QObject *data); void monitor_init(CharDriverState *chr, int flags);
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- monitor.c | 5 +++++ monitor.h | 2 ++ 2 files changed, 7 insertions(+), 0 deletions(-)