@@ -35,6 +35,8 @@
#include "list.h"
#include "hashtable.h"
+#define XENSTORE_LIB_DIR XEN_LIB_DIR "/xenstore"
+
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
/* O_CLOEXEC support is needed for Live Update in the daemon case. */
@@ -385,6 +387,9 @@ static inline bool domain_is_unprivileged(const struct connection *conn)
/* Return the event channel used by xenbus. */
evtchn_port_t get_xenbus_evtchn(void);
+#ifdef __MINIOS__
+void mount_9pfs(void);
+#endif
/* Write out the pidfile */
void write_pidfile(const char *pidfile);
@@ -1236,6 +1236,8 @@ void stubdom_init(void)
barf_perror("Failed to initialize stubdom");
xenevtchn_notify(xce_handle, stubdom->port);
+
+ mount_9pfs();
#endif
}
@@ -19,6 +19,14 @@
#include <sys/mman.h>
#include "core.h"
#include <xen/grant_table.h>
+#include <mini-os/9pfront.h>
+#include <mini-os/sched.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/xmalloc.h>
+
+#define P9_STATE_PATH "device/9pfs/0/state"
+
+static void *p9_device;
void write_pidfile(const char *pidfile)
{
@@ -54,3 +62,30 @@ void unmap_xenbus(void *interface)
xengnttab_unmap(*xgt_handle, interface, 1);
}
+static void mount_thread(void *p)
+{
+ xenbus_event_queue events = NULL;
+ char *err;
+ char *dummy;
+
+ free(xenbus_watch_path_token(XBT_NIL, P9_STATE_PATH, "9pfs", &events));
+
+ for (;;) {
+ xenbus_wait_for_watch(&events);
+ err = xenbus_read(XBT_NIL, P9_STATE_PATH, &dummy);
+ if (!err)
+ break;
+ free(err);
+ }
+
+ free(dummy);
+
+ free(xenbus_unwatch_path_token(XBT_NIL, P9_STATE_PATH, "9pfs"));
+
+ p9_device = init_9pfront(0, XENSTORE_LIB_DIR);
+}
+
+void mount_9pfs(void)
+{
+ create_thread("mount-9pfs", mount_thread, NULL);
+}
Mount the 9pfs device in stubdom enabling it to use files. This has to happen in a worker thread in order to allow the main thread handling the required Xenstore accesses in parallel. Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/xenstored/core.h | 5 +++++ tools/xenstored/domain.c | 2 ++ tools/xenstored/minios.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+)