* [PATCH 1/8] include/sysemu/os-posix.h: move *daemonize* declarations together
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
@ 2023-09-01 10:12 ` Michael Tokarev
2023-09-01 10:12 ` [PATCH 2/8] os-posix: create and export os_set_runas() Michael Tokarev
` (7 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/sysemu/os-posix.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 1030d39904..65b9c94e91 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -47,13 +47,12 @@ void os_set_line_buffering(void);
void os_setup_early_signal_handling(void);
void os_set_proc_name(const char *s);
void os_setup_signal_handling(void);
+int os_set_daemonize(bool d);
+bool is_daemonized(void);
void os_daemonize(void);
void os_setup_post(void);
int os_mlock(void);
-int os_set_daemonize(bool d);
-bool is_daemonized(void);
-
/**
* qemu_alloc_stack:
* @sz: pointer to a size_t holding the requested usable stack size
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/8] os-posix: create and export os_set_runas()
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
2023-09-01 10:12 ` [PATCH 1/8] include/sysemu/os-posix.h: move *daemonize* declarations together Michael Tokarev
@ 2023-09-01 10:12 ` Michael Tokarev
2023-09-01 20:11 ` Richard Henderson
2023-09-01 10:12 ` [PATCH 3/8] os-posix.c: create and export os_set_chroot() Michael Tokarev
` (6 subsequent siblings)
8 siblings, 1 reply; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/sysemu/os-posix.h | 1 +
os-posix.c | 23 ++++++++++++++++-------
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 65b9c94e91..d32630f9e7 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -50,6 +50,7 @@ void os_setup_signal_handling(void);
int os_set_daemonize(bool d);
bool is_daemonized(void);
void os_daemonize(void);
+bool os_set_runas(const char *optarg);
void os_setup_post(void);
int os_mlock(void);
diff --git a/os-posix.c b/os-posix.c
index cfcb96533c..0202bb4898 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -102,8 +102,14 @@ void os_set_proc_name(const char *s)
#endif
}
-
-static bool os_parse_runas_uid_gid(const char *optarg)
+/*
+ * Prepare to change user ID. optarg can be one of 3 forms:
+ * - a username, in which case user ID will be changed to its uid,
+ * with primary and supplementary groups set up too;
+ * - a nemeric uid, in which case only the uid will be set;
+ * - a pair of numeric uid:gid.
+ */
+bool os_set_runas(const char *optarg)
{
unsigned long lv;
const char *ep;
@@ -111,6 +117,13 @@ static bool os_parse_runas_uid_gid(const char *optarg)
gid_t got_gid;
int rc;
+ user_pwd = getpwnam(optarg);
+ if (user_pwd) {
+ user_uid = -1;
+ user_gid = -1;
+ return true;
+ }
+
rc = qemu_strtoul(optarg, &ep, 0, &lv);
got_uid = lv; /* overflow here is ID in C99 */
if (rc || *ep != ':' || got_uid != lv || got_uid == (uid_t)-1) {
@@ -137,11 +150,7 @@ int os_parse_cmd_args(int index, const char *optarg)
{
switch (index) {
case QEMU_OPTION_runas:
- user_pwd = getpwnam(optarg);
- if (user_pwd) {
- user_uid = -1;
- user_gid = -1;
- } else if (!os_parse_runas_uid_gid(optarg)) {
+ if (!os_set_runas(optarg)) {
error_report("User \"%s\" doesn't exist"
" (and is not <uid>:<gid>)",
optarg);
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/8] os-posix.c: create and export os_set_chroot()
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
2023-09-01 10:12 ` [PATCH 1/8] include/sysemu/os-posix.h: move *daemonize* declarations together Michael Tokarev
2023-09-01 10:12 ` [PATCH 2/8] os-posix: create and export os_set_runas() Michael Tokarev
@ 2023-09-01 10:12 ` Michael Tokarev
2023-09-01 10:12 ` [PATCH 4/8] os-posix.c, softmmu/vl.c: move os_parse_cmd_args() into qemu_init() Michael Tokarev
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/sysemu/os-posix.h | 1 +
os-posix.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index d32630f9e7..8a66763395 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -51,6 +51,7 @@ int os_set_daemonize(bool d);
bool is_daemonized(void);
void os_daemonize(void);
bool os_set_runas(const char *optarg);
+void os_set_chroot(const char *optarg);
void os_setup_post(void);
int os_mlock(void);
diff --git a/os-posix.c b/os-posix.c
index 0202bb4898..081f3db685 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -159,7 +159,7 @@ int os_parse_cmd_args(int index, const char *optarg)
break;
case QEMU_OPTION_chroot:
warn_report("option is deprecated, use '-run-with chroot=...' instead");
- chroot_dir = optarg;
+ os_set_chroot(optarg);
break;
case QEMU_OPTION_daemonize:
daemonize = 1;
@@ -184,7 +184,7 @@ int os_parse_cmd_args(int index, const char *optarg)
#endif
str = qemu_opt_get(opts, "chroot");
if (str) {
- chroot_dir = str;
+ os_set_chroot(str);
}
break;
}
@@ -232,6 +232,11 @@ static void change_process_uid(void)
}
}
+void os_set_chroot(const char *optarg)
+{
+ chroot_dir = optarg;
+}
+
static void change_root(void)
{
if (chroot_dir) {
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/8] os-posix.c, softmmu/vl.c: move os_parse_cmd_args() into qemu_init()
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
` (2 preceding siblings ...)
2023-09-01 10:12 ` [PATCH 3/8] os-posix.c: create and export os_set_chroot() Michael Tokarev
@ 2023-09-01 10:12 ` Michael Tokarev
2023-09-01 10:12 ` [PATCH 5/8] os-posix.c: move code around Michael Tokarev
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
This will stop linking softmmu-specific os_parse_cmd_args() into every
qemu executable which happens to use other functions from os-posix.c,
such as os_set_line_buffering() or os_setup_signal_handling().
Also, since there's no win32-specific options, *all* option parsing is
now done in softmmu/vl.c:qemu_init(), which is easier to read without
extra indirection, - all options are in the single function now.
This effectively reverts commit 59a5264b99434.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/sysemu/os-posix.h | 1 -
include/sysemu/os-win32.h | 1 -
os-posix.c | 82 ---------------------------------------
softmmu/vl.c | 76 ++++++++++++++++++++++++++++++++++--
4 files changed, 73 insertions(+), 87 deletions(-)
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 8a66763395..6dfdcbb086 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -42,7 +42,6 @@
extern "C" {
#endif
-int os_parse_cmd_args(int index, const char *optarg);
void os_set_line_buffering(void);
void os_setup_early_signal_handling(void);
void os_set_proc_name(const char *s);
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index 91aa0d7ec0..8ae30fac15 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -101,7 +101,6 @@ static inline void os_setup_signal_handling(void) {}
static inline void os_daemonize(void) {}
static inline void os_setup_post(void) {}
static inline void os_set_proc_name(const char *dummy) {}
-static inline int os_parse_cmd_args(int index, const char *optarg) { return -1; }
void os_set_line_buffering(void);
void os_setup_early_signal_handling(void);
diff --git a/os-posix.c b/os-posix.c
index 081f3db685..4102fcdb5e 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -31,18 +31,13 @@
/* Needed early for CONFIG_BSD etc. */
#include "net/slirp.h"
-#include "qemu/qemu-options.h"
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "sysemu/runstate.h"
#include "qemu/cutils.h"
-#include "qemu/config-file.h"
-#include "qemu/option.h"
-#include "qemu/module.h"
#ifdef CONFIG_LINUX
#include <sys/prctl.h>
-#include "qemu/async-teardown.h"
#endif
/*
@@ -142,59 +137,6 @@ bool os_set_runas(const char *optarg)
return true;
}
-/*
- * Parse OS specific command line options.
- * return 0 if option handled, -1 otherwise
- */
-int os_parse_cmd_args(int index, const char *optarg)
-{
- switch (index) {
- case QEMU_OPTION_runas:
- if (!os_set_runas(optarg)) {
- error_report("User \"%s\" doesn't exist"
- " (and is not <uid>:<gid>)",
- optarg);
- exit(1);
- }
- break;
- case QEMU_OPTION_chroot:
- warn_report("option is deprecated, use '-run-with chroot=...' instead");
- os_set_chroot(optarg);
- break;
- case QEMU_OPTION_daemonize:
- daemonize = 1;
- break;
-#if defined(CONFIG_LINUX)
- /* deprecated */
- case QEMU_OPTION_asyncteardown:
- init_async_teardown();
- break;
-#endif
- case QEMU_OPTION_run_with: {
- const char *str;
- QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("run-with"),
- optarg, false);
- if (!opts) {
- exit(1);
- }
-#if defined(CONFIG_LINUX)
- if (qemu_opt_get_bool(opts, "async-teardown", false)) {
- init_async_teardown();
- }
-#endif
- str = qemu_opt_get(opts, "chroot");
- if (str) {
- os_set_chroot(str);
- }
- break;
- }
- default:
- return -1;
- }
-
- return 0;
-}
-
static void change_process_uid(void)
{
assert((user_uid == (uid_t)-1) || user_pwd == NULL);
@@ -371,27 +313,3 @@ int os_mlock(void)
return -ENOSYS;
#endif
}
-
-static QemuOptsList qemu_run_with_opts = {
- .name = "run-with",
- .head = QTAILQ_HEAD_INITIALIZER(qemu_run_with_opts.head),
- .desc = {
-#if defined(CONFIG_LINUX)
- {
- .name = "async-teardown",
- .type = QEMU_OPT_BOOL,
- },
-#endif
- {
- .name = "chroot",
- .type = QEMU_OPT_STRING,
- },
- { /* end of list */ }
- },
-};
-
-static void register_runwith(void)
-{
- qemu_add_opts(&qemu_run_with_opts);
-}
-opts_init(register_runwith);
diff --git a/softmmu/vl.c b/softmmu/vl.c
index b0b96f67fa..0a74810ca3 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -49,6 +49,7 @@
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "qemu/accel.h"
+#include "qemu/async-teardown.h"
#include "hw/usb.h"
#include "hw/isa/isa.h"
#include "hw/scsi/scsi.h"
@@ -748,6 +749,33 @@ static QemuOptsList qemu_smp_opts = {
},
};
+#if defined(CONFIG_POSIX)
+static QemuOptsList qemu_run_with_opts = {
+ .name = "run-with",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_run_with_opts.head),
+ .desc = {
+#if defined(CONFIG_LINUX)
+ {
+ .name = "async-teardown",
+ .type = QEMU_OPT_BOOL,
+ },
+#endif
+ {
+ .name = "chroot",
+ .type = QEMU_OPT_STRING,
+ },
+ { /* end of list */ }
+ },
+};
+
+#define qemu_add_run_with_opts() qemu_add_opts(&qemu_run_with_opts)
+
+#else
+
+#define qemu_add_run_with_opts()
+
+#endif /* CONFIG_POSIX */
+
static void realtime_init(void)
{
if (enable_mlock) {
@@ -2704,6 +2732,7 @@ void qemu_init(int argc, char **argv)
qemu_add_opts(&qemu_semihosting_config_opts);
qemu_add_opts(&qemu_fw_cfg_opts);
qemu_add_opts(&qemu_action_opts);
+ qemu_add_run_with_opts();
module_call_init(MODULE_INIT_OPTS);
error_init(argv[0]);
@@ -3522,11 +3551,52 @@ void qemu_init(int argc, char **argv)
case QEMU_OPTION_nouserconfig:
/* Nothing to be parsed here. Especially, do not error out below. */
break;
- default:
- if (os_parse_cmd_args(popt->index, optarg)) {
- error_report("Option not supported in this build");
+#if defined(CONFIG_POSIX)
+ case QEMU_OPTION_runas:
+ if (!os_set_runas(optarg)) {
+ error_report("User \"%s\" doesn't exist"
+ " (and is not <uid>:<gid>)",
+ optarg);
+ exit(1);
+ }
+ break;
+ case QEMU_OPTION_chroot:
+ warn_report("option is deprecated,"
+ " use '-run-with chroot=...' instead");
+ os_set_chroot(optarg);
+ break;
+ case QEMU_OPTION_daemonize:
+ os_set_daemonize(true);
+ break;
+#if defined(CONFIG_LINUX)
+ /* deprecated */
+ case QEMU_OPTION_asyncteardown:
+ init_async_teardown();
+ break;
+#endif
+ case QEMU_OPTION_run_with: {
+ const char *str;
+ opts = qemu_opts_parse_noisily(qemu_find_opts("run-with"),
+ optarg, false);
+ if (!opts) {
exit(1);
}
+#if defined(CONFIG_LINUX)
+ if (qemu_opt_get_bool(opts, "async-teardown", false)) {
+ init_async_teardown();
+ }
+#endif
+ str = qemu_opt_get(opts, "chroot");
+ if (str) {
+ os_set_chroot(str);
+ }
+ break;
+ }
+#endif /* CONFIG_POSIX */
+
+ default:
+ error_report("Option not supported in this build");
+ exit(1);
}
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/8] os-posix.c: move code around
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
` (3 preceding siblings ...)
2023-09-01 10:12 ` [PATCH 4/8] os-posix.c, softmmu/vl.c: move os_parse_cmd_args() into qemu_init() Michael Tokarev
@ 2023-09-01 10:12 ` Michael Tokarev
2023-09-01 10:13 ` [PATCH 6/8] os-posix.c: remove unneeded #includes Michael Tokarev
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
this moves code blocks so that functions and variables which
belongs to the same concept are now close to each other.
There's no actual code changes in there.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
os-posix.c | 49 +++++++++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 22 deletions(-)
diff --git a/os-posix.c b/os-posix.c
index 4102fcdb5e..340373d972 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -40,17 +40,6 @@
#include <sys/prctl.h>
#endif
-/*
- * Must set all three of these at once.
- * Legal combinations are unset by name by uid
- */
-static struct passwd *user_pwd; /* NULL non-NULL NULL */
-static uid_t user_uid = (uid_t)-1; /* -1 -1 >=0 */
-static gid_t user_gid = (gid_t)-1; /* -1 -1 >=0 */
-
-static const char *chroot_dir;
-static int daemonize;
-static int daemon_pipe;
void os_setup_early_signal_handling(void)
{
@@ -97,6 +86,15 @@ void os_set_proc_name(const char *s)
#endif
}
+
+/*
+ * Must set all three of these at once.
+ * Legal combinations are unset by name by uid
+ */
+static struct passwd *user_pwd; /* NULL non-NULL NULL */
+static uid_t user_uid = (uid_t)-1; /* -1 -1 >=0 */
+static gid_t user_gid = (gid_t)-1; /* -1 -1 >=0 */
+
/*
* Prepare to change user ID. optarg can be one of 3 forms:
* - a username, in which case user ID will be changed to its uid,
@@ -174,6 +172,9 @@ static void change_process_uid(void)
}
}
+
+static const char *chroot_dir;
+
void os_set_chroot(const char *optarg)
{
chroot_dir = optarg;
@@ -194,6 +195,21 @@ static void change_root(void)
}
+
+static int daemonize;
+static int daemon_pipe;
+
+bool is_daemonized(void)
+{
+ return daemonize;
+}
+
+int os_set_daemonize(bool d)
+{
+ daemonize = d;
+ return 0;
+}
+
void os_daemonize(void)
{
if (daemonize) {
@@ -287,17 +303,6 @@ void os_set_line_buffering(void)
setvbuf(stdout, NULL, _IOLBF, 0);
}
-bool is_daemonized(void)
-{
- return daemonize;
-}
-
-int os_set_daemonize(bool d)
-{
- daemonize = d;
- return 0;
-}
-
int os_mlock(void)
{
#ifdef HAVE_MLOCKALL
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/8] os-posix.c: remove unneeded #includes
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
` (4 preceding siblings ...)
2023-09-01 10:12 ` [PATCH 5/8] os-posix.c: move code around Michael Tokarev
@ 2023-09-01 10:13 ` Michael Tokarev
2023-09-01 10:13 ` [PATCH 7/8] softmmu/vl.c: inline include/qemu/qemu-options.h into vl.c Michael Tokarev
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
os-posix.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/os-posix.c b/os-posix.c
index 340373d972..d3490b0a9b 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -29,8 +29,6 @@
#include <grp.h>
#include <libgen.h>
-/* Needed early for CONFIG_BSD etc. */
-#include "net/slirp.h"
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "sysemu/runstate.h"
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 7/8] softmmu/vl.c: inline include/qemu/qemu-options.h into vl.c
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
` (5 preceding siblings ...)
2023-09-01 10:13 ` [PATCH 6/8] os-posix.c: remove unneeded #includes Michael Tokarev
@ 2023-09-01 10:13 ` Michael Tokarev
2023-09-01 10:13 ` [PATCH 8/8] util/async-teardown.c: move to softmmu/, only build it when system build is requested Michael Tokarev
2023-09-01 21:44 ` [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Paolo Bonzini
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
qemu-options.h just includes qemu-options.def with some #defines.
We already do this in vl.c in other place. Since no other file
includes qemu-options.h anymore, just inline it in vl.c.
This effectively reverts second half of commit 59a5264b99434.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/qemu/qemu-options.h | 41 -------------------------------------
softmmu/vl.c | 11 +++++++++-
2 files changed, 10 insertions(+), 42 deletions(-)
delete mode 100644 include/qemu/qemu-options.h
diff --git a/include/qemu/qemu-options.h b/include/qemu/qemu-options.h
deleted file mode 100644
index 4a62c83c45..0000000000
--- a/include/qemu/qemu-options.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * qemu-options.h
- *
- * Defines needed for command line argument processing.
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- * Copyright (c) 2010 Jes Sorensen <Jes.Sorensen@redhat.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef QEMU_OPTIONS_H
-#define QEMU_OPTIONS_H
-
-enum {
-
-#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
- opt_enum,
-#define DEFHEADING(text)
-#define ARCHHEADING(text, arch_mask)
-
-#include "qemu-options.def"
-};
-
-#endif
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 0a74810ca3..78b6570f19 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -91,7 +91,6 @@
#include "qapi/qobject-input-visitor.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
-#include "qemu/qemu-options.h"
#include "qemu/main-loop.h"
#ifdef CONFIG_VIRTFS
#include "fsdev/qemu-fsdev.h"
@@ -894,6 +893,16 @@ static void help(int exitcode)
exit(exitcode);
}
+enum {
+
+#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
+ opt_enum,
+#define DEFHEADING(text)
+#define ARCHHEADING(text, arch_mask)
+
+#include "qemu-options.def"
+};
+
#define HAS_ARG 0x0001
typedef struct QEMUOption {
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 8/8] util/async-teardown.c: move to softmmu/, only build it when system build is requested
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
` (6 preceding siblings ...)
2023-09-01 10:13 ` [PATCH 7/8] softmmu/vl.c: inline include/qemu/qemu-options.h into vl.c Michael Tokarev
@ 2023-09-01 10:13 ` Michael Tokarev
2023-09-01 21:44 ` [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Paolo Bonzini
8 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2023-09-01 10:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Michael Tokarev, Eric Blake
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
{util => softmmu}/async-teardown.c | 0
softmmu/meson.build | 1 +
util/meson.build | 1 -
3 files changed, 1 insertion(+), 1 deletion(-)
rename {util => softmmu}/async-teardown.c (100%)
diff --git a/util/async-teardown.c b/softmmu/async-teardown.c
similarity index 100%
rename from util/async-teardown.c
rename to softmmu/async-teardown.c
diff --git a/softmmu/meson.build b/softmmu/meson.build
index ea5603f021..c18b7ad738 100644
--- a/softmmu/meson.build
+++ b/softmmu/meson.build
@@ -37,3 +37,4 @@ endif
system_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
system_ss.add(when: fdt, if_true: files('device_tree.c'))
+system_ss.add(when: 'CONFIG_LINUX', if_true: files('async-teardown.c'))
diff --git a/util/meson.build b/util/meson.build
index a375160286..c4827fd70a 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -3,7 +3,6 @@ util_ss.add(files('thread-context.c'), numa)
if not config_host_data.get('CONFIG_ATOMIC64')
util_ss.add(files('atomic64.c'))
endif
-util_ss.add(when: 'CONFIG_LINUX', if_true: files('async-teardown.c'))
util_ss.add(when: 'CONFIG_POSIX', if_true: files('aio-posix.c'))
util_ss.add(when: 'CONFIG_POSIX', if_true: files('fdmon-poll.c'))
if config_host_data.get('CONFIG_EPOLL_CREATE1')
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c
2023-09-01 10:12 [PATCH 0/8] move softmmu options processing from os-posix.c to vl.c Michael Tokarev
` (7 preceding siblings ...)
2023-09-01 10:13 ` [PATCH 8/8] util/async-teardown.c: move to softmmu/, only build it when system build is requested Michael Tokarev
@ 2023-09-01 21:44 ` Paolo Bonzini
2023-09-05 14:34 ` Eric Blake
8 siblings, 1 reply; 12+ messages in thread
From: Paolo Bonzini @ 2023-09-01 21:44 UTC (permalink / raw)
To: Michael Tokarev; +Cc: qemu-devel
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 12+ messages in thread