[PATCH 1/2] Add /sys/hypervisor

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

 



Hi Greg, Hi Andrew,

As discussed, here comes the final patch:

To have a home for all hypervisors, this patch
creates /sys/hypervisor.
A new config option SYS_HYPERVISOR is introduced,
which should to be set by architecture dependent
hypervisors (e.g. s390 or Xen).

Acked-by: Martin Schwidefsky <[email protected]>
Signed-off-by: Michael Holzheu <[email protected]>

---

 drivers/base/Kconfig      |    4 ++++
 drivers/base/Makefile     |    1 +
 drivers/base/base.h       |    5 +++++
 drivers/base/hypervisor.c |   19 +++++++++++++++++++
 drivers/base/init.c       |    1 +
 include/linux/kobject.h   |    2 ++
 6 files changed, 32 insertions(+)

diff -urpN linux-2.6.17-rc3-mm1/drivers/base/Kconfig linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/Kconfig
--- linux-2.6.17-rc3-mm1/drivers/base/Kconfig	2006-05-08 15:56:23.000000000 +0200
+++ linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/Kconfig	2006-05-08 16:00:58.000000000 +0200
@@ -38,3 +38,7 @@ config DEBUG_DRIVER
 	  If you are unsure about this, say N here.
 
 endmenu
+
+config SYS_HYPERVISOR
+	bool
+	default n
diff -urpN linux-2.6.17-rc3-mm1/drivers/base/Makefile linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/Makefile
--- linux-2.6.17-rc3-mm1/drivers/base/Makefile	2006-05-08 15:56:23.000000000 +0200
+++ linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/Makefile	2006-05-08 16:00:41.000000000 +0200
@@ -9,6 +9,7 @@ obj-$(CONFIG_FW_LOADER)	+= firmware_clas
 obj-$(CONFIG_NUMA)	+= node.o
 obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o
 obj-$(CONFIG_SMP)	+= topology.o
+obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
 EXTRA_CFLAGS += -DDEBUG
diff -urpN linux-2.6.17-rc3-mm1/drivers/base/base.h linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/base.h
--- linux-2.6.17-rc3-mm1/drivers/base/base.h	2006-05-08 15:57:02.000000000 +0200
+++ linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/base.h	2006-05-09 10:18:06.000000000 +0200
@@ -5,6 +5,11 @@ extern int devices_init(void);
 extern int buses_init(void);
 extern int classes_init(void);
 extern int firmware_init(void);
+#ifdef CONFIG_SYS_HYPERVISOR
+extern int hypervisor_init(void);
+#else
+static inline int hypervisor_init(void) { return 0; }
+#endif
 extern int platform_bus_init(void);
 extern int system_bus_init(void);
 extern int cpu_dev_init(void);
diff -urpN linux-2.6.17-rc3-mm1/drivers/base/hypervisor.c linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/hypervisor.c
--- linux-2.6.17-rc3-mm1/drivers/base/hypervisor.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/hypervisor.c	2006-05-08 16:00:20.000000000 +0200
@@ -0,0 +1,19 @@
+/*
+ * hypervisor.c - /sys/hypervisor subsystem.
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#include <linux/kobject.h>
+#include <linux/device.h>
+
+#include "base.h"
+
+decl_subsys(hypervisor, NULL, NULL);
+EXPORT_SYMBOL_GPL(hypervisor_subsys);
+
+int __init hypervisor_init(void)
+{
+	return subsystem_register(&hypervisor_subsys);
+}
diff -urpN linux-2.6.17-rc3-mm1/drivers/base/init.c linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/init.c
--- linux-2.6.17-rc3-mm1/drivers/base/init.c	2006-05-08 15:56:23.000000000 +0200
+++ linux-2.6.17-rc3-mm1-sys-hypervisor/drivers/base/init.c	2006-05-08 16:00:07.000000000 +0200
@@ -27,6 +27,7 @@ void __init driver_init(void)
 	buses_init();
 	classes_init();
 	firmware_init();
+	hypervisor_init();
 
 	/* These are also core pieces, but must come after the
 	 * core core pieces.
diff -urpN linux-2.6.17-rc3-mm1/include/linux/kobject.h linux-2.6.17-rc3-mm1-sys-hypervisor/include/linux/kobject.h
--- linux-2.6.17-rc3-mm1/include/linux/kobject.h	2006-05-08 15:57:05.000000000 +0200
+++ linux-2.6.17-rc3-mm1-sys-hypervisor/include/linux/kobject.h	2006-05-08 15:59:35.000000000 +0200
@@ -190,6 +190,8 @@ struct subsystem _varname##_subsys = { \
 
 /* The global /sys/kernel/ subsystem for people to chain off of */
 extern struct subsystem kernel_subsys;
+/* The global /sys/hypervisor/ subsystem  */
+extern struct subsystem hypervisor_subsys;
 
 /**
  * Helpers for setting the kset of registered objects.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux