[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 3/7] os-posix.c: create and export os_set_chroot()
From: |
Michael Tokarev |
Subject: |
[PATCH RFC 3/7] os-posix.c: create and export os_set_chroot() |
Date: |
Sat, 12 Aug 2023 15:47:57 +0300 |
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
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
- [PATCH RFC 0/7] move softmmu options processing from os-posix.c to vl.c, Michael Tokarev, 2023/08/12
- [PATCH RFC 1/7] include/sysemu/os-posix.h: move *daemonize* declaration together, Michael Tokarev, 2023/08/12
- [PATCH RFC 2/7] os-posix: create and export os_set_runas(), Michael Tokarev, 2023/08/12
- [PATCH RFC 3/7] os-posix.c: create and export os_set_chroot(),
Michael Tokarev <=
- [PATCH RFC 5/7] softmmu/vl.c: inline include/qemu/qemu-options.h into vl.c, Michael Tokarev, 2023/08/12
- [PATCH RFC 7/7] util/async-teardown.c: move to softmmu/, only build it when system build is requested, Michael Tokarev, 2023/08/12
- [PATCH RFC 4/7] os-posix.c, softmmu/vl.c: move os_parse_cmd_args() into qemu_init(), Michael Tokarev, 2023/08/12
- [PATCH RFC 6/7] os-posix.c: move code around, Michael Tokarev, 2023/08/12