diff mbox series

qdev: Collect HMP handlers command handlers in qdev-monitor.c

Message ID 20190709185936.31335-1-armbru@redhat.com
State New
Headers show
Series qdev: Collect HMP handlers command handlers in qdev-monitor.c | expand

Commit Message

Markus Armbruster July 9, 2019, 6:59 p.m. UTC
Move hmp_device_add(), hmp_device_del() from monitor/hmp-cmds.c to
qdev-monitor.c, where they are covered by MAINTAINERS section "QOM",
just like qapi/qdev.json.  hmp_info_qtree() and hmp_info_qdm() are
already there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
This is a follow-up to my "Move QOM, qdev, machine core and dump code"
series, merged in commit 374f63f6810.

 monitor/hmp-cmds.c | 19 -------------------
 qdev-monitor.c     | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 19 deletions(-)

Comments

Philippe Mathieu-Daudé July 10, 2019, 9:25 a.m. UTC | #1
On 7/9/19 8:59 PM, Markus Armbruster wrote:
> Move hmp_device_add(), hmp_device_del() from monitor/hmp-cmds.c to
> qdev-monitor.c, where they are covered by MAINTAINERS section "QOM",
> just like qapi/qdev.json.  hmp_info_qtree() and hmp_info_qdm() are
> already there.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> This is a follow-up to my "Move QOM, qdev, machine core and dump code"
> series, merged in commit 374f63f6810.
> 
>  monitor/hmp-cmds.c | 19 -------------------
>  qdev-monitor.c     | 18 ++++++++++++++++++
>  2 files changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index 99ceb0846b..550d363374 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -25,7 +25,6 @@
>  #include "qemu/timer.h"
>  #include "qemu/sockets.h"
>  #include "monitor/monitor-internal.h"
> -#include "monitor/qdev.h"
>  #include "qapi/error.h"
>  #include "qapi/clone-visitor.h"
>  #include "qapi/opts-visitor.h"
> @@ -35,7 +34,6 @@
>  #include "qapi/qapi-commands-migration.h"
>  #include "qapi/qapi-commands-misc.h"
>  #include "qapi/qapi-commands-net.h"
> -#include "qapi/qapi-commands-qdev.h"
>  #include "qapi/qapi-commands-rocker.h"
>  #include "qapi/qapi-commands-run-state.h"
>  #include "qapi/qapi-commands-tpm.h"
> @@ -2181,23 +2179,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
>      }
>  }
>  
> -void hmp_device_add(Monitor *mon, const QDict *qdict)
> -{
> -    Error *err = NULL;
> -
> -    qmp_device_add((QDict *)qdict, NULL, &err);
> -    hmp_handle_error(mon, &err);
> -}
> -
> -void hmp_device_del(Monitor *mon, const QDict *qdict)
> -{
> -    const char *id = qdict_get_str(qdict, "id");
> -    Error *err = NULL;
> -
> -    qmp_device_del(id, &err);
> -    hmp_handle_error(mon, &err);
> -}
> -
>  void hmp_netdev_add(Monitor *mon, const QDict *qdict)
>  {
>      Error *err = NULL;
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index 58222c2211..cd6299e92b 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -20,6 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "hw/qdev.h"
>  #include "hw/sysbus.h"
> +#include "monitor/hmp.h"
>  #include "monitor/monitor.h"
>  #include "monitor/qdev.h"
>  #include "sysemu/arch_init.h"
> @@ -844,6 +845,23 @@ void qmp_device_del(const char *id, Error **errp)
>      }
>  }
>  
> +void hmp_device_add(Monitor *mon, const QDict *qdict)
> +{
> +    Error *err = NULL;
> +
> +    qmp_device_add((QDict *)qdict, NULL, &err);
> +    hmp_handle_error(mon, &err);
> +}
> +
> +void hmp_device_del(Monitor *mon, const QDict *qdict)
> +{
> +    const char *id = qdict_get_str(qdict, "id");
> +    Error *err = NULL;
> +
> +    qmp_device_del(id, &err);
> +    hmp_handle_error(mon, &err);
> +}
> +
>  BlockBackend *blk_by_qdev_id(const char *id, Error **errp)
>  {
>      DeviceState *dev;
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Markus Armbruster Aug. 12, 2019, 2:10 p.m. UTC | #2
Markus Armbruster <armbru@redhat.com> writes:

> Move hmp_device_add(), hmp_device_del() from monitor/hmp-cmds.c to
> qdev-monitor.c, where they are covered by MAINTAINERS section "QOM",
> just like qapi/qdev.json.  hmp_info_qtree() and hmp_info_qdm() are
> already there.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Queued for 4.2.
diff mbox series

Patch

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 99ceb0846b..550d363374 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -25,7 +25,6 @@ 
 #include "qemu/timer.h"
 #include "qemu/sockets.h"
 #include "monitor/monitor-internal.h"
-#include "monitor/qdev.h"
 #include "qapi/error.h"
 #include "qapi/clone-visitor.h"
 #include "qapi/opts-visitor.h"
@@ -35,7 +34,6 @@ 
 #include "qapi/qapi-commands-migration.h"
 #include "qapi/qapi-commands-misc.h"
 #include "qapi/qapi-commands-net.h"
-#include "qapi/qapi-commands-qdev.h"
 #include "qapi/qapi-commands-rocker.h"
 #include "qapi/qapi-commands-run-state.h"
 #include "qapi/qapi-commands-tpm.h"
@@ -2181,23 +2179,6 @@  void hmp_migrate(Monitor *mon, const QDict *qdict)
     }
 }
 
-void hmp_device_add(Monitor *mon, const QDict *qdict)
-{
-    Error *err = NULL;
-
-    qmp_device_add((QDict *)qdict, NULL, &err);
-    hmp_handle_error(mon, &err);
-}
-
-void hmp_device_del(Monitor *mon, const QDict *qdict)
-{
-    const char *id = qdict_get_str(qdict, "id");
-    Error *err = NULL;
-
-    qmp_device_del(id, &err);
-    hmp_handle_error(mon, &err);
-}
-
 void hmp_netdev_add(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 58222c2211..cd6299e92b 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -20,6 +20,7 @@ 
 #include "qemu/osdep.h"
 #include "hw/qdev.h"
 #include "hw/sysbus.h"
+#include "monitor/hmp.h"
 #include "monitor/monitor.h"
 #include "monitor/qdev.h"
 #include "sysemu/arch_init.h"
@@ -844,6 +845,23 @@  void qmp_device_del(const char *id, Error **errp)
     }
 }
 
+void hmp_device_add(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+
+    qmp_device_add((QDict *)qdict, NULL, &err);
+    hmp_handle_error(mon, &err);
+}
+
+void hmp_device_del(Monitor *mon, const QDict *qdict)
+{
+    const char *id = qdict_get_str(qdict, "id");
+    Error *err = NULL;
+
+    qmp_device_del(id, &err);
+    hmp_handle_error(mon, &err);
+}
+
 BlockBackend *blk_by_qdev_id(const char *id, Error **errp)
 {
     DeviceState *dev;