[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 04/36] multi-process: Refactor chardev functions out of vl.c
From: |
elena . ufimtseva |
Subject: |
[PATCH v6 04/36] multi-process: Refactor chardev functions out of vl.c |
Date: |
Mon, 6 Apr 2020 02:40:54 -0700 |
From: Elena Ufimtseva <address@hidden>
Some of the initialization helper functions w.r.t chardev
in vl.c are also used by the remote process. Therefore, these functions
are refactored into shared files that both QEMU & remote process
could use.
Signed-off-by: Elena Ufimtseva <address@hidden>
Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
chardev/char.c | 14 ++++++++++++++
include/chardev/char.h | 2 ++
softmmu/vl.c | 14 --------------
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/chardev/char.c b/chardev/char.c
index e77564060d..47dcf93da7 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -1196,3 +1196,17 @@ static void register_types(void)
}
type_init(register_types);
+
+int chardev_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+ Error *local_err = NULL;
+
+ if (!qemu_chr_new_from_opts(opts, NULL, &local_err)) {
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return -1;
+ }
+ exit(0);
+ }
+ return 0;
+}
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 00589a6025..0804e78f7a 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -290,4 +290,6 @@ GSource *qemu_chr_timeout_add_ms(Chardev *chr, guint ms,
/* console.c */
void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp);
+int chardev_init_func(void *opaque, QemuOpts *opts, Error **errp);
+
#endif
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 33568108b0..9517f0b167 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2039,20 +2039,6 @@ static int device_help_func(void *opaque, QemuOpts
*opts, Error **errp)
return qdev_device_help(opts);
}
-static int chardev_init_func(void *opaque, QemuOpts *opts, Error **errp)
-{
- Error *local_err = NULL;
-
- if (!qemu_chr_new_from_opts(opts, NULL, &local_err)) {
- if (local_err) {
- error_propagate(errp, local_err);
- return -1;
- }
- exit(0);
- }
- return 0;
-}
-
#ifdef CONFIG_VIRTFS
static int fsdev_init_func(void *opaque, QemuOpts *opts, Error **errp)
{
--
2.25.GIT
- [PATCH v6 00/36] Initial support for multi-process qemu, elena . ufimtseva, 2020/04/06
- [PATCH v6 04/36] multi-process: Refactor chardev functions out of vl.c,
elena . ufimtseva <=
- [PATCH v6 05/36] multi-process: Refactor monitor functions out of vl.c, elena . ufimtseva, 2020/04/06
- [PATCH v6 01/36] memory: alloc RAM from file at offset, elena . ufimtseva, 2020/04/06
- [PATCH v6 08/36] multi-process: Add stub functions to facilate build of multi-process, elena . ufimtseva, 2020/04/06
- [PATCH v6 07/36] multi-process: add a command line option for debug file, elena . ufimtseva, 2020/04/06
- [PATCH v6 10/36] multi-process: build system for remote device process, elena . ufimtseva, 2020/04/06
- [PATCH v6 12/36] multi-process: add functions to synchronize proxy and remote endpoints, elena . ufimtseva, 2020/04/06
- [PATCH v6 15/36] multi-process: setup memory manager for remote device, elena . ufimtseva, 2020/04/06
- [PATCH v6 17/36] multi-process: introduce proxy object, elena . ufimtseva, 2020/04/06