Message ID | 20231101093325.30302-28-jgross@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | tools: enable xenstore-stubdom to use 9pfs | expand |
On Wed, Nov 1, 2023 at 5:50 AM Juergen Gross <jgross@suse.com> wrote: > > Some xenstored initialization needs to be done in the daemon case only, > so split it out into a new daemon_init() function being a stub in the > stubdom case. > > Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index 9f48d91027..204b932ca9 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2949,11 +2949,7 @@ int main(int argc, char *argv[]) if (optind != argc) barf("%s: No arguments desired", argv[0]); - reopen_log(); - - /* Make sure xenstored directory exists. */ - /* Errors ignored here, will be reported when we open files */ - mkdir(xenstore_daemon_rundir(), 0755); + daemon_init(); if (dofork) { openlog("xenstored", 0, LOG_DAEMON); diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index d3cd4a4c8a..a15d5b0d67 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -391,6 +391,7 @@ evtchn_port_t get_xenbus_evtchn(void); void mount_9pfs(void); #endif +void daemon_init(void); const char *xenstore_rundir(void); char *absolute_filename(const void *ctx, const char *filename); diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c index 104f37587b..cd6e288f2a 100644 --- a/tools/xenstored/minios.c +++ b/tools/xenstored/minios.c @@ -62,6 +62,10 @@ void unmap_xenbus(void *interface) xengnttab_unmap(*xgt_handle, interface, 1); } +void daemon_init(void) +{ +} + static void mount_thread(void *p) { xenbus_event_queue events = NULL; diff --git a/tools/xenstored/posix.c b/tools/xenstored/posix.c index d02d0e446f..c84e7ef3a8 100644 --- a/tools/xenstored/posix.c +++ b/tools/xenstored/posix.c @@ -163,3 +163,13 @@ const char *xenstore_rundir(void) { return xenstore_daemon_rundir(); } + +void daemon_init(void) +{ + reopen_log(); + + /* Make sure xenstored directories exist. */ + /* Errors ignored here, will be reported when we open files */ + mkdir(xenstore_daemon_rundir(), 0755); + mkdir(XENSTORE_LIB_DIR, 0755); +}
Some xenstored initialization needs to be done in the daemon case only, so split it out into a new daemon_init() function being a stub in the stubdom case. Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/xenstored/core.c | 6 +----- tools/xenstored/core.h | 1 + tools/xenstored/minios.c | 4 ++++ tools/xenstored/posix.c | 10 ++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-)