[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 27/29] tools/xenstored: add daemon_init() function



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@xxxxxxxx>
---
 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(-)

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);
+}
-- 
2.35.3




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.