[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation
|
From: |
Paolo Bonzini |
|
Subject: |
Re: [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking |
|
Date: |
Mon, 8 Apr 2024 11:50:48 +0200 |
On Thu, Apr 4, 2024 at 9:48 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Currently monitor stubs are scattered in 3 files.
>
> Merge these stubs in 2 files, a generic one (monitor-core)
> included in all builds (in particular user emulation), and
> a less generic one to be included by tools and system emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> stubs/fdset.c | 17 -----------------
Oops, merging fdset.c breaks storage-daemon linking.
But it is not needed, all I need is
diff --git a/stubs/meson.build b/stubs/meson.build
index 0bf25e6ca53..67cf80aa846 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -10,7 +10,6 @@ stub_ss.add(files('qemu-timer-notify-cb.c'))
stub_ss.add(files('icount.c'))
stub_ss.add(files('dump.c'))
stub_ss.add(files('error-printf.c'))
-stub_ss.add(files('fdset.c'))
stub_ss.add(files('gdbstub.c'))
stub_ss.add(files('get-vm-name.c'))
stub_ss.add(files('graph-lock.c'))
@@ -28,7 +27,10 @@ if libaio.found()
endif
stub_ss.add(files('migr-blocker.c'))
stub_ss.add(files('module-opts.c'))
-stub_ss.add(files('monitor.c'))
+if have_system or have_tools
+ stub_ss.add(files('monitor.c'))
+ stub_ss.add(files('fdset.c'))
+endif
stub_ss.add(files('monitor-core.c'))
stub_ss.add(files('physmem.c'))
stub_ss.add(files('qemu-timer-notify-cb.c'))
Paolo
> stubs/monitor-core.c | 20 +++++++++++++++-----
> stubs/monitor.c | 8 ++++++--
> stubs/meson.build | 5 +++--
> 4 files changed, 24 insertions(+), 26 deletions(-)
> delete mode 100644 stubs/fdset.c
>
> diff --git a/stubs/fdset.c b/stubs/fdset.c
> deleted file mode 100644
> index 56b3663d58..0000000000
> --- a/stubs/fdset.c
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#include "qemu/osdep.h"
> -#include "monitor/monitor.h"
> -
> -int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
> -{
> - errno = ENOSYS;
> - return -1;
> -}
> -
> -int64_t monitor_fdset_dup_fd_find(int dup_fd)
> -{
> - return -1;
> -}
> -
> -void monitor_fdset_dup_fd_remove(int dupfd)
> -{
> -}
> diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
> index afa477aae6..72e40bcc15 100644
> --- a/stubs/monitor-core.c
> +++ b/stubs/monitor-core.c
> @@ -1,6 +1,7 @@
> +/* Monitor stub required for user emulation */
> #include "qemu/osdep.h"
> #include "monitor/monitor.h"
> -#include "qapi/qapi-emit-events.h"
> +#include "../monitor/monitor-internal.h"
>
> Monitor *monitor_cur(void)
> {
> @@ -12,11 +13,22 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
> return NULL;
> }
>
> -void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
> +int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
> +{
> + errno = ENOSYS;
> + return -1;
> +}
> +
> +int64_t monitor_fdset_dup_fd_find(int dup_fd)
> +{
> + return -1;
> +}
> +
> +void monitor_fdset_dup_fd_remove(int dupfd)
> {
> }
>
> -void qapi_event_emit(QAPIEvent event, QDict *qdict)
> +void monitor_fdsets_cleanup(void)
> {
> }
>
> @@ -24,5 +36,3 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list
> ap)
> {
> abort();
> }
> -
> -
> diff --git a/stubs/monitor.c b/stubs/monitor.c
> index 20786ac4ff..2fc4dc1493 100644
> --- a/stubs/monitor.c
> +++ b/stubs/monitor.c
> @@ -1,7 +1,7 @@
> #include "qemu/osdep.h"
> #include "qapi/error.h"
> +#include "qapi/qapi-emit-events.h"
> #include "monitor/monitor.h"
> -#include "../monitor/monitor-internal.h"
>
> int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
> {
> @@ -13,6 +13,10 @@ void monitor_init_hmp(Chardev *chr, bool use_readline,
> Error **errp)
> {
> }
>
> -void monitor_fdsets_cleanup(void)
> +void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
> +{
> +}
> +
> +void qapi_event_emit(QAPIEvent event, QDict *qdict)
> {
> }
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 0bf25e6ca5..ca1bc07d30 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -10,7 +10,6 @@ stub_ss.add(files('qemu-timer-notify-cb.c'))
> stub_ss.add(files('icount.c'))
> stub_ss.add(files('dump.c'))
> stub_ss.add(files('error-printf.c'))
> -stub_ss.add(files('fdset.c'))
> stub_ss.add(files('gdbstub.c'))
> stub_ss.add(files('get-vm-name.c'))
> stub_ss.add(files('graph-lock.c'))
> @@ -28,7 +27,9 @@ if libaio.found()
> endif
> stub_ss.add(files('migr-blocker.c'))
> stub_ss.add(files('module-opts.c'))
> -stub_ss.add(files('monitor.c'))
> +if have_system or have_tools
> + stub_ss.add(files('monitor.c'))
> +endif
> stub_ss.add(files('monitor-core.c'))
> stub_ss.add(files('physmem.c'))
> stub_ss.add(files('qemu-timer-notify-cb.c'))
> --
> 2.41.0
>
- [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process, Philippe Mathieu-Daudé, 2024/04/04
- [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation, Philippe Mathieu-Daudé, 2024/04/04
- [PATCH-for-9.1 2/7] yank: Restrict to system emulation, Philippe Mathieu-Daudé, 2024/04/04
- [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking, Philippe Mathieu-Daudé, 2024/04/04
- Re: [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking,
Paolo Bonzini <=
- [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c, Philippe Mathieu-Daudé, 2024/04/04
- [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation, Philippe Mathieu-Daudé, 2024/04/04
- [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set, Philippe Mathieu-Daudé, 2024/04/04
- [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build, Philippe Mathieu-Daudé, 2024/04/04