linux/debian/patches/features/all/xen/xenctrl.patch

126 lines
4.0 KiB
Diff

From 27dbc6043a8c063c434ebaa9650d28dcf72cc58d Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Mon, 4 Feb 2008 08:30:37 +0000
Subject: [PATCH] xen: Add empty xenctrl module
Add the basic infrastructure for a xenctrl module
which will contain the various kernel interfaces
used by (mainly Dom0) Xen userspace.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
arch/x86/xen/Kconfig | 7 +++++
drivers/xen/Makefile | 2 +
drivers/xen/xenctrl/Makefile | 4 +++
drivers/xen/xenctrl/main.c | 62 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 75 insertions(+), 0 deletions(-)
create mode 100644 drivers/xen/xenctrl/Makefile
create mode 100644 drivers/xen/xenctrl/main.c
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 4d5f264..4723bc1 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -22,3 +22,10 @@ config XEN
according to the maximum possible memory size of a Xen
domain. This array uses 1 page per gigabyte, so there's no
need to be too stingy here.
\ No newline at end of file
+
+config XENCTRL
+ tristate "Xen's user space control interfaces"
+ depends on XEN && PROC_FS
+ default y if XEN
+ help
+ This is the /proc/xen interface used by Xen's libxc.
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 56592f0..6737463 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -3,2 +3,4 @@
obj-$(CONFIG_XEN_XENCOMM) += xencomm.o
obj-$(CONFIG_XEN_BALLOON) += balloon.o
+
+obj-$(CONFIG_XENCTRL) += xenctrl/
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
new file mode 100644
index 0000000..1f43a43
--- /dev/null
+++ b/drivers/xen/xenctrl/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_XENCTRL) += xenctrl.o
+
+xenctrl-objs =
+xenctrl-objs += main.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
new file mode 100644
index 0000000..2965ceb
--- /dev/null
+++ b/drivers/xen/xenctrl/main.c
@@ -0,0 +1,62 @@
+/******************************************************************************
+ *
+ * main.c
+ *
+ * Xen userspace control interfaces
+ *
+ * Copyright (c) 2002-2004, K A Fraser, B Dragovic
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <asm/xen/hypervisor.h>
+
+static int __init xenctrl_init(void)
+{
+ struct proc_dir_entry *dir;
+
+ if (!is_running_on_xen())
+ return -ENODEV;
+
+ dir = proc_mkdir("xen", NULL);
+ if (!dir)
+ return -ENOMEM;
+
+ dir->owner = THIS_MODULE;
+
+ return 0;
+}
+
+static void __exit xenctrl_exit(void)
+{
+ remove_proc_entry("xen", NULL);
+}
+
+module_init(xenctrl_init);
+module_exit(xenctrl_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
--
1.5.4.1