Commit 1107ba88 authored by Alex Zeffertt's avatar Alex Zeffertt Committed by Linus Torvalds
Browse files

xen: add xenfs to allow usermode <-> Xen interaction



The xenfs filesystem exports various interfaces to usermode.  Initially
this exports a file to allow usermode to interact with xenbus/xenstore.

Traditionally this appeared in /proc/xen.  Rather than extending procfs,
this patch adds a backward-compat mountpoint on /proc/xen, and provides
a xenfs filesystem which can be mounted there.

Signed-off-by: default avatarAlex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d8220347
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -17,3 +17,27 @@ config XEN_SCRUB_PAGES
	  is not accidentally visible to other domains.  Is it more
	  secure, but slightly less efficient.
	  If in doubt, say yes.

config XENFS
	tristate "Xen filesystem"
	depends on XEN
	default y
	help
	  The xen filesystem provides a way for domains to share
	  information with each other and with the hypervisor.
	  For example, by reading and writing the "xenbus" file, guests
	  may pass arbitrary information to the initial domain.
	  If in doubt, say yes.

config XEN_COMPAT_XENFS
       bool "Create compatibility mount point /proc/xen"
       depends on XENFS
       default y
       help
         The old xenstore userspace tools expect to find "xenbus"
         under /proc/xen, but "xenbus" is now found at the root of the
         xenfs filesystem.  Selecting this causes the kernel to create
         the compatibilty mount point /proc/xen if it is running on
         a xen platform.
         If in doubt, say yes.
+2 −0
Original line number Diff line number Diff line
obj-y	+= grant-table.o features.o events.o manage.o
obj-y	+= xenbus/

obj-$(CONFIG_HOTPLUG_CPU)	+= cpu_hotplug.o
obj-$(CONFIG_XEN_XENCOMM)	+= xencomm.o
obj-$(CONFIG_XEN_BALLOON)	+= balloon.o
obj-$(CONFIG_XENFS)		+= xenfs/
 No newline at end of file
+22 −6
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include <linux/ctype.h>
#include <linux/fcntl.h>
#include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/notifier.h>
#include <linux/kthread.h>
#include <linux/mutex.h>
@@ -55,7 +56,10 @@
#include "xenbus_comms.h"
#include "xenbus_probe.h"


int xen_store_evtchn;
EXPORT_SYMBOL(xen_store_evtchn);

struct xenstore_domain_interface *xen_store_interface;
static unsigned long xen_store_mfn;

@@ -166,6 +170,9 @@ static int read_backend_details(struct xenbus_device *xendev)
	return read_otherend_details(xendev, "backend-id", "backend");
}

static struct device_attribute xenbus_dev_attrs[] = {
	__ATTR_NULL
};

/* Bus type for frontend drivers. */
static struct xen_bus_type xenbus_frontend = {
@@ -180,6 +187,7 @@ static struct xen_bus_type xenbus_frontend = {
		.probe     = xenbus_dev_probe,
		.remove    = xenbus_dev_remove,
		.shutdown  = xenbus_dev_shutdown,
		.dev_attrs = xenbus_dev_attrs,
	},
};

@@ -852,6 +860,14 @@ static int __init xenbus_probe_init(void)
	if (!xen_initial_domain())
		xenbus_probe(NULL);

#ifdef CONFIG_XEN_COMPAT_XENFS
	/*
	 * Create xenfs mountpoint in /proc for compatibility with
	 * utilities that expect to find "xenbus" under "/proc/xen".
	 */
	proc_mkdir("xen", NULL);
#endif

	return 0;

  out_unreg_back:
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)

	return ret;
}
EXPORT_SYMBOL(xenbus_dev_request_and_reply);

/* Send message to xs, get kmalloc'ed reply.  ERR_PTR() on error. */
static void *xs_talkv(struct xenbus_transaction t,
+3 −0
Original line number Diff line number Diff line
obj-$(CONFIG_XENFS) += xenfs.o

xenfs-objs = super.o xenbus.o
 No newline at end of file
Loading