Messages in this thread Patch in this message | | | Date | Thu, 4 May 2006 16:01:43 +0200 | From | Michael Holzheu <> | Subject | [PATCH 2/3] Add /sys/hypervisor subsystem |
| |
To have a home for all hypervisors, this patch creates /sys/hypervisor.
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Michael Holzheu <holzheu@de.ibm.com>
---
include/linux/kobject.h | 2 ++ kernel/ksysfs.c | 26 +++++++++++++++++++++-----
diff -urpN linux-2.6.16-hypfs-2006-04-28-update2/include/linux/kobject.h linux-2.6.16-hypfs-2006-04-28-update3/include/linux/kobject.h --- linux-2.6.16-hypfs-2006-04-28-update2/include/linux/kobject.h 2006-05-04 10:22:37.000000000 +0200 +++ linux-2.6.16-hypfs-2006-04-28-update3/include/linux/kobject.h 2006-05-04 10:29:47.000000000 +0200 @@ -186,6 +186,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. diff -urpN linux-2.6.16-hypfs-2006-04-28-update2/kernel/ksysfs.c linux-2.6.16-hypfs-2006-04-28-update3/kernel/ksysfs.c --- linux-2.6.16-hypfs-2006-04-28-update2/kernel/ksysfs.c 2006-05-04 10:22:38.000000000 +0200 +++ linux-2.6.16-hypfs-2006-04-28-update3/kernel/ksysfs.c 2006-05-04 10:30:03.000000000 +0200 @@ -53,6 +53,8 @@ KERNEL_ATTR_RW(uevent_helper); decl_subsys(kernel, NULL, NULL); EXPORT_SYMBOL_GPL(kernel_subsys); +decl_subsys(hypervisor, NULL, NULL); +EXPORT_SYMBOL_GPL(hypervisor_subsys); static struct attribute * kernel_attrs[] = { #ifdef CONFIG_HOTPLUG @@ -68,12 +70,26 @@ static struct attribute_group kernel_att static int __init ksysfs_init(void) { - int error = subsystem_register(&kernel_subsys); - if (!error) - error = sysfs_create_group(&kernel_subsys.kset.kobj, - &kernel_attr_group); + int rc; - return error; + rc = subsystem_register(&hypervisor_subsys); + if (rc) + goto fail_hyp; + rc = subsystem_register(&kernel_subsys); + if (rc) + goto fail_kernel; + rc = sysfs_create_group(&kernel_subsys.kset.kobj, + &kernel_attr_group); + if (rc) + goto fail_group; + return 0; + +fail_group: + subsystem_unregister(&kernel_subsys); +fail_kernel: + subsystem_unregister(&hypervisor_subsys); +fail_hyp: + return rc; } core_initcall(ksysfs_init); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |