ia64/xen-unstable

changeset 9365:349d26c1094f

Creates a module that exports Xen Hypervisor attributes to sysfs. The
module has a tri-state configuration so it can be a loadable module.

Views the hypervisor as hardware device, uses sysfs as a scripting
interface for user space tools that need these attributes.

Some user space apps, particularly for systems management, need to
know if their kernel is running in a virtual machine and if so in
what type of virtual machine. This property is contained in the
file /sys/hypervisor/type.

The file hypervisor_sysfs.c creates a generic hypervisor subsystem
that can be linked to by any hypervisor. The file xen_sysfs.c exports
the xen-specific attributes.

Signed-off-by: Mike D. Day <ncmike@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Mar 21 12:17:19 2006 +0100 (2006-03-21)
parents a66c48bdf9c3
children 045bee6e1ebd
files buildconfigs/linux-defconfig_xen0_x86_32 buildconfigs/linux-defconfig_xen0_x86_64 buildconfigs/linux-defconfig_xenU_x86_32 buildconfigs/linux-defconfig_xenU_x86_64 buildconfigs/linux-defconfig_xen_x86_32 buildconfigs/linux-defconfig_xen_x86_64 linux-2.6-xen-sparse/drivers/xen/Kconfig linux-2.6-xen-sparse/drivers/xen/core/Makefile linux-2.6-xen-sparse/drivers/xen/core/hypervisor_sysfs.c linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c linux-2.6-xen-sparse/include/xen/hypervisor_sysfs.h
line diff
     1.1 --- a/buildconfigs/linux-defconfig_xen0_x86_32	Tue Mar 21 11:49:29 2006 +0100
     1.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_32	Tue Mar 21 12:17:19 2006 +0100
     1.3 @@ -1328,6 +1328,7 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     1.4  # CONFIG_XEN_TPMDEV_FRONTEND is not set
     1.5  CONFIG_XEN_SCRUB_PAGES=y
     1.6  CONFIG_XEN_DISABLE_SERIAL=y
     1.7 +CONFIG_XEN_SYSFS=y
     1.8  CONFIG_HAVE_ARCH_ALLOC_SKB=y
     1.9  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
    1.10  
     2.1 --- a/buildconfigs/linux-defconfig_xen0_x86_64	Tue Mar 21 11:49:29 2006 +0100
     2.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_64	Tue Mar 21 12:17:19 2006 +0100
     2.3 @@ -1253,6 +1253,7 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     2.4  # CONFIG_XEN_TPMDEV_FRONTEND is not set
     2.5  CONFIG_XEN_SCRUB_PAGES=y
     2.6  CONFIG_XEN_DISABLE_SERIAL=y
     2.7 +CONFIG_XEN_SYSFS=y
     2.8  CONFIG_HAVE_ARCH_ALLOC_SKB=y
     2.9  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
    2.10  
     3.1 --- a/buildconfigs/linux-defconfig_xenU_x86_32	Tue Mar 21 11:49:29 2006 +0100
     3.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_32	Tue Mar 21 12:17:19 2006 +0100
     3.3 @@ -868,6 +868,7 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     3.4  # CONFIG_XEN_TPMDEV_FRONTEND is not set
     3.5  CONFIG_XEN_SCRUB_PAGES=y
     3.6  CONFIG_XEN_DISABLE_SERIAL=y
     3.7 +CONFIG_XEN_SYSFS=y
     3.8  CONFIG_HAVE_ARCH_ALLOC_SKB=y
     3.9  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
    3.10  
     4.1 --- a/buildconfigs/linux-defconfig_xenU_x86_64	Tue Mar 21 11:49:29 2006 +0100
     4.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_64	Tue Mar 21 12:17:19 2006 +0100
     4.3 @@ -1144,6 +1144,7 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     4.4  # CONFIG_XEN_TPMDEV_FRONTEND is not set
     4.5  CONFIG_XEN_SCRUB_PAGES=y
     4.6  CONFIG_XEN_DISABLE_SERIAL=y
     4.7 +CONFIG_XEN_SYSFS=y
     4.8  CONFIG_HAVE_ARCH_ALLOC_SKB=y
     4.9  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
    4.10  
     5.1 --- a/buildconfigs/linux-defconfig_xen_x86_32	Tue Mar 21 11:49:29 2006 +0100
     5.2 +++ b/buildconfigs/linux-defconfig_xen_x86_32	Tue Mar 21 12:17:19 2006 +0100
     5.3 @@ -2994,6 +2994,7 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     5.4  # CONFIG_XEN_TPMDEV_FRONTEND is not set
     5.5  CONFIG_XEN_SCRUB_PAGES=y
     5.6  CONFIG_XEN_DISABLE_SERIAL=y
     5.7 +CONFIG_XEN_SYSFS=m
     5.8  CONFIG_HAVE_ARCH_ALLOC_SKB=y
     5.9  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
    5.10  
     6.1 --- a/buildconfigs/linux-defconfig_xen_x86_64	Tue Mar 21 11:49:29 2006 +0100
     6.2 +++ b/buildconfigs/linux-defconfig_xen_x86_64	Tue Mar 21 12:17:19 2006 +0100
     6.3 @@ -2665,6 +2665,7 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     6.4  # CONFIG_XEN_TPMDEV_FRONTEND is not set
     6.5  CONFIG_XEN_SCRUB_PAGES=y
     6.6  CONFIG_XEN_DISABLE_SERIAL=y
     6.7 +CONFIG_XEN_SYSFS=m
     6.8  CONFIG_HAVE_ARCH_ALLOC_SKB=y
     6.9  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
    6.10  
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/Kconfig	Tue Mar 21 11:49:29 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig	Tue Mar 21 12:17:19 2006 +0100
     7.3 @@ -189,6 +189,14 @@ config XEN_DISABLE_SERIAL
     7.4  	  Disable serial port drivers, allowing the Xen console driver
     7.5  	  to provide a serial console at ttyS0.
     7.6  
     7.7 +config XEN_SYSFS
     7.8 +	tristate "Export Xen attributes in sysfs"
     7.9 +	depends on XEN
    7.10 +	depends on SYSFS
    7.11 +	default y
    7.12 +	help
    7.13 +		Xen hypervisor attributes will show up under /sys/hypervisor/.
    7.14 +
    7.15  endmenu
    7.16  
    7.17  config HAVE_ARCH_ALLOC_SKB
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/Makefile	Tue Mar 21 11:49:29 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/Makefile	Tue Mar 21 12:17:19 2006 +0100
     8.3 @@ -7,3 +7,5 @@ obj-y   := evtchn.o reboot.o gnttab.o fe
     8.4  obj-$(CONFIG_PROC_FS) += xen_proc.o
     8.5  obj-$(CONFIG_NET)     += skbuff.o
     8.6  obj-$(CONFIG_SMP)     += smpboot.o
     8.7 +obj-$(CONFIG_SYSFS)   += hypervisor_sysfs.o
     8.8 +obj-$(CONFIG_XEN_SYSFS) += xen_sysfs.o
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/hypervisor_sysfs.c	Tue Mar 21 12:17:19 2006 +0100
     9.3 @@ -0,0 +1,57 @@
     9.4 +/*
     9.5 + *  copyright (c) 2006 IBM Corporation
     9.6 + *  Authored by: Mike D. Day <ncmike@us.ibm.com>
     9.7 + *
     9.8 + *  This program is free software; you can redistribute it and/or modify
     9.9 + *  it under the terms of the GNU General Public License version 2 as
    9.10 + *  published by the Free Software Foundation.
    9.11 + */
    9.12 +
    9.13 +#include <linux/config.h>
    9.14 +#include <linux/kernel.h>
    9.15 +#include <linux/module.h>
    9.16 +#include <linux/kobject.h>
    9.17 +#include <xen/hypervisor_sysfs.h>
    9.18 +
    9.19 +decl_subsys(hypervisor, NULL, NULL);
    9.20 +
    9.21 +static ssize_t hyp_sysfs_show(struct kobject *kobj,
    9.22 +			      struct attribute *attr,
    9.23 +			      char *buffer)
    9.24 +{
    9.25 +	struct hyp_sysfs_attr *hyp_attr;
    9.26 +	hyp_attr = container_of(attr, struct hyp_sysfs_attr, attr);
    9.27 +	if (hyp_attr->show)
    9.28 +		return hyp_attr->show(hyp_attr, buffer);
    9.29 +	return 0;
    9.30 +}
    9.31 +
    9.32 +static ssize_t hyp_sysfs_store(struct kobject *kobj,
    9.33 +			       struct attribute *attr,
    9.34 +			       const char *buffer,
    9.35 +			       size_t len)
    9.36 +{
    9.37 +	struct hyp_sysfs_attr *hyp_attr;
    9.38 +	hyp_attr = container_of(attr, struct hyp_sysfs_attr, attr);
    9.39 +	if (hyp_attr->store)
    9.40 +		return hyp_attr->store(hyp_attr, buffer, len);
    9.41 +	return 0;
    9.42 +}
    9.43 +
    9.44 +struct sysfs_ops hyp_sysfs_ops = {
    9.45 +	.show = hyp_sysfs_show,
    9.46 +	.store = hyp_sysfs_store,
    9.47 +};
    9.48 +
    9.49 +static struct kobj_type hyp_sysfs_kobj_type = {
    9.50 +	.sysfs_ops = &hyp_sysfs_ops,
    9.51 +};
    9.52 +
    9.53 +static int __init hypervisor_subsys_init(void)
    9.54 +{
    9.55 +	hypervisor_subsys.kset.kobj.ktype = &hyp_sysfs_kobj_type;
    9.56 +	return subsystem_register(&hypervisor_subsys);
    9.57 +}
    9.58 +
    9.59 +device_initcall(hypervisor_subsys_init);
    9.60 +EXPORT_SYMBOL_GPL(hypervisor_subsys);
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c	Tue Mar 21 12:17:19 2006 +0100
    10.3 @@ -0,0 +1,310 @@
    10.4 +/*
    10.5 + *  copyright (c) 2006 IBM Corporation
    10.6 + *  Authored by: Mike D. Day <ncmike@us.ibm.com>
    10.7 + *
    10.8 + *  This program is free software; you can redistribute it and/or modify
    10.9 + *  it under the terms of the GNU General Public License version 2 as
   10.10 + *  published by the Free Software Foundation.
   10.11 + */
   10.12 +
   10.13 +#include <linux/config.h>
   10.14 +#include <linux/kernel.h>
   10.15 +#include <linux/module.h>
   10.16 +#include <linux/init.h>
   10.17 +#include <asm/hypervisor.h>
   10.18 +#include <xen/hypervisor_sysfs.h>
   10.19 +
   10.20 +MODULE_LICENSE("GPL");
   10.21 +MODULE_AUTHOR("Mike D. Day <ncmike@us.ibm.com>");
   10.22 +
   10.23 +static ssize_t type_show(struct hyp_sysfs_attr *attr, char *buffer)
   10.24 +{
   10.25 +	return sprintf(buffer, "xen\n");
   10.26 +}
   10.27 +
   10.28 +HYPERVISOR_ATTR_RO(type);
   10.29 +
   10.30 +static int __init xen_sysfs_type_init(void)
   10.31 +{
   10.32 +	return sysfs_create_file(&hypervisor_subsys.kset.kobj, &type_attr.attr);
   10.33 +}
   10.34 +
   10.35 +static void xen_sysfs_type_destroy(void)
   10.36 +{
   10.37 +	sysfs_remove_file(&hypervisor_subsys.kset.kobj, &type_attr.attr);
   10.38 +}
   10.39 +
   10.40 +/* xen version attributes */
   10.41 +static ssize_t major_show(struct hyp_sysfs_attr *attr, char *buffer)
   10.42 +{
   10.43 +	int version = HYPERVISOR_xen_version(XENVER_version, NULL);
   10.44 +	if (version)
   10.45 +		return sprintf(buffer, "%d\n", version >> 16);
   10.46 +	return -ENODEV;
   10.47 +}
   10.48 +
   10.49 +HYPERVISOR_ATTR_RO(major);
   10.50 +
   10.51 +static ssize_t minor_show(struct hyp_sysfs_attr *attr, char *buffer)
   10.52 +{
   10.53 +	int version = HYPERVISOR_xen_version(XENVER_version, NULL);
   10.54 +	if (version)
   10.55 +		return sprintf(buffer, "%d\n", version & 0xff);
   10.56 +	return -ENODEV;
   10.57 +}
   10.58 +
   10.59 +HYPERVISOR_ATTR_RO(minor);
   10.60 +
   10.61 +static ssize_t extra_show(struct hyp_sysfs_attr *attr, char *buffer)
   10.62 +{
   10.63 +	int ret;
   10.64 +	char *extra = kmalloc(XEN_EXTRAVERSION_LEN, GFP_KERNEL);
   10.65 +	if (extra) {
   10.66 +		ret = HYPERVISOR_xen_version(XENVER_extraversion, extra);
   10.67 +		if (!ret)
   10.68 +			return sprintf(buffer, "%s\n", extra);
   10.69 +		kfree(extra);
   10.70 +	} else
   10.71 +		ret = -ENOMEM;
   10.72 +	return ret;
   10.73 +}
   10.74 +
   10.75 +HYPERVISOR_ATTR_RO(extra);
   10.76 +
   10.77 +static struct attribute *version_attrs[] = {
   10.78 +	&major_attr.attr,
   10.79 +	&minor_attr.attr,
   10.80 +	&extra_attr.attr,
   10.81 +	NULL
   10.82 +};
   10.83 +
   10.84 +static struct attribute_group version_group = {
   10.85 +	.name = "version",
   10.86 +	.attrs = version_attrs,
   10.87 +};
   10.88 +
   10.89 +static int __init xen_sysfs_version_init(void)
   10.90 +{
   10.91 +	return sysfs_create_group(&hypervisor_subsys.kset.kobj, &version_group);
   10.92 +}
   10.93 +
   10.94 +static void xen_sysfs_version_destroy(void)
   10.95 +{
   10.96 +	sysfs_remove_group(&hypervisor_subsys.kset.kobj, &version_group);
   10.97 +}
   10.98 +
   10.99 +/* xen compilation attributes */
  10.100 +
  10.101 +static ssize_t compiler_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.102 +{
  10.103 +	int ret;
  10.104 +	struct xen_compile_info *info =
  10.105 +	    kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL);
  10.106 +	if (info) {
  10.107 +		ret = HYPERVISOR_xen_version(XENVER_compile_info, info);
  10.108 +		if (!ret)
  10.109 +			ret = sprintf(buffer, "%s\n", info->compiler);
  10.110 +		kfree(info);
  10.111 +	} else
  10.112 +		ret = -ENOMEM;
  10.113 +
  10.114 +	return ret;
  10.115 +}
  10.116 +
  10.117 +HYPERVISOR_ATTR_RO(compiler);
  10.118 +
  10.119 +static ssize_t compiled_by_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.120 +{
  10.121 +	int ret;
  10.122 +	struct xen_compile_info *info;
  10.123 +
  10.124 +	info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL);
  10.125 +	if (info) {
  10.126 +		ret = HYPERVISOR_xen_version(XENVER_compile_info, info);
  10.127 +		if (!ret)
  10.128 +			ret = sprintf(buffer, "%s\n", info->compile_by);
  10.129 +		kfree(info);
  10.130 +	} else
  10.131 +		ret = -ENOMEM;
  10.132 +	return ret;
  10.133 +}
  10.134 +
  10.135 +HYPERVISOR_ATTR_RO(compiled_by);
  10.136 +
  10.137 +static ssize_t compile_date_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.138 +{
  10.139 +	int ret;
  10.140 +	struct xen_compile_info *info;
  10.141 +
  10.142 +	info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL);
  10.143 +	if (info) {
  10.144 +		ret = HYPERVISOR_xen_version(XENVER_compile_info, info);
  10.145 +		if (!ret)
  10.146 +			ret = sprintf(buffer, "%s\n", info->compile_date);
  10.147 +		kfree(info);
  10.148 +	} else
  10.149 +		ret = -ENOMEM;
  10.150 +	return ret;
  10.151 +}
  10.152 +
  10.153 +HYPERVISOR_ATTR_RO(compile_date);
  10.154 +
  10.155 +static struct attribute *xen_compile_attrs[] = {
  10.156 +	&compiler_attr.attr,
  10.157 +	&compiled_by_attr.attr,
  10.158 +	&compile_date_attr.attr,
  10.159 +	NULL
  10.160 +};
  10.161 +
  10.162 +static struct attribute_group xen_compilation_group = {
  10.163 +	.name = "compilation",
  10.164 +	.attrs = xen_compile_attrs,
  10.165 +};
  10.166 +
  10.167 +int __init static xen_compilation_init(void)
  10.168 +{
  10.169 +	return sysfs_create_group(&hypervisor_subsys.kset.kobj,
  10.170 +				  &xen_compilation_group);
  10.171 +}
  10.172 +
  10.173 +static void xen_compilation_destroy(void)
  10.174 +{
  10.175 +	sysfs_remove_group(&hypervisor_subsys.kset.kobj,
  10.176 +			   &xen_compilation_group);
  10.177 +}
  10.178 +
  10.179 +/* xen properties info */
  10.180 +
  10.181 +static ssize_t capabilities_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.182 +{
  10.183 +	int ret;
  10.184 +	char *caps = kmalloc(XEN_CAPABILITIES_INFO_LEN, GFP_KERNEL);
  10.185 +	if (caps) {
  10.186 +		ret = HYPERVISOR_xen_version(XENVER_capabilities, caps);
  10.187 +		if (!ret)
  10.188 +			ret = sprintf(buffer, "%s\n", caps);
  10.189 +		kfree(caps);
  10.190 +	} else
  10.191 +		ret = -ENOMEM;
  10.192 +	return ret;
  10.193 +}
  10.194 +
  10.195 +HYPERVISOR_ATTR_RO(capabilities);
  10.196 +
  10.197 +static ssize_t changeset_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.198 +{
  10.199 +	int ret;
  10.200 +	char *cset = kmalloc(XEN_CHANGESET_INFO_LEN, GFP_KERNEL);
  10.201 +	if (cset) {
  10.202 +		ret = HYPERVISOR_xen_version(XENVER_changeset, cset);
  10.203 +		if (!ret)
  10.204 +			ret = sprintf(buffer, "%s\n", cset);
  10.205 +		kfree(cset);
  10.206 +	} else
  10.207 +		ret = -ENOMEM;
  10.208 +	return ret;
  10.209 +}
  10.210 +
  10.211 +HYPERVISOR_ATTR_RO(changeset);
  10.212 +
  10.213 +static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.214 +{
  10.215 +	int ret;
  10.216 +	struct xen_platform_parameters *parms =
  10.217 +	    kmalloc(sizeof(struct xen_platform_parameters), GFP_KERNEL);
  10.218 +	if (parms) {
  10.219 +		ret = HYPERVISOR_xen_version(XENVER_platform_parameters, parms);
  10.220 +		if (!ret)
  10.221 +			ret = sprintf(buffer, "%lx\n", parms->virt_start);
  10.222 +		kfree(parms);
  10.223 +	} else
  10.224 +		ret = -ENOMEM;
  10.225 +	return ret;
  10.226 +}
  10.227 +
  10.228 +HYPERVISOR_ATTR_RO(virtual_start);
  10.229 +
  10.230 +/* eventually there will be several more features to export */
  10.231 +static ssize_t xen_feature_show(int index, char *buffer)
  10.232 +{
  10.233 +	int ret;
  10.234 +
  10.235 +	struct xen_feature_info *info =
  10.236 +	    kmalloc(sizeof(struct xen_feature_info), GFP_KERNEL);
  10.237 +	if (info) {
  10.238 +		info->submap_idx = index;
  10.239 +		ret = HYPERVISOR_xen_version(XENVER_get_features, info);
  10.240 +		if (!ret)
  10.241 +			ret = sprintf(buffer, "%d\n", info->submap);
  10.242 +		kfree(info);
  10.243 +	} else
  10.244 +		ret = -ENOMEM;
  10.245 +	return ret;
  10.246 +}
  10.247 +
  10.248 +static ssize_t writable_pt_show(struct hyp_sysfs_attr *attr, char *buffer)
  10.249 +{
  10.250 +	return xen_feature_show(XENFEAT_writable_page_tables, buffer);
  10.251 +}
  10.252 +
  10.253 +HYPERVISOR_ATTR_RO(writable_pt);
  10.254 +
  10.255 +static struct attribute *xen_properties_attrs[] = {
  10.256 +	&capabilities_attr.attr,
  10.257 +	&changeset_attr.attr,
  10.258 +	&virtual_start_attr.attr,
  10.259 +	&writable_pt_attr.attr,
  10.260 +	NULL
  10.261 +};
  10.262 +
  10.263 +static struct attribute_group xen_properties_group = {
  10.264 +	.name = "properties",
  10.265 +	.attrs = xen_properties_attrs,
  10.266 +};
  10.267 +
  10.268 +static int __init xen_properties_init(void)
  10.269 +{
  10.270 +	return sysfs_create_group(&hypervisor_subsys.kset.kobj,
  10.271 +				  &xen_properties_group);
  10.272 +}
  10.273 +
  10.274 +static void xen_properties_destroy(void)
  10.275 +{
  10.276 +	sysfs_remove_group(&hypervisor_subsys.kset.kobj, &xen_properties_group);
  10.277 +}
  10.278 +
  10.279 +static int __init hyper_sysfs_init(void)
  10.280 +{
  10.281 +	int ret = xen_sysfs_type_init();
  10.282 +	if (ret)
  10.283 +		goto out;
  10.284 +	ret = xen_sysfs_version_init();
  10.285 +	if (ret)
  10.286 +		goto version_out;
  10.287 +	ret = xen_compilation_init();
  10.288 +	if (ret)
  10.289 +		goto comp_out;
  10.290 +	ret = xen_properties_init();
  10.291 +	if (!ret)
  10.292 +		goto out;
  10.293 +
  10.294 +	xen_compilation_destroy();
  10.295 +comp_out:
  10.296 +	xen_sysfs_version_destroy();
  10.297 +version_out:
  10.298 +	xen_sysfs_type_destroy();
  10.299 +out:
  10.300 +	return ret;
  10.301 +}
  10.302 +
  10.303 +static void hyper_sysfs_exit(void)
  10.304 +{
  10.305 +	xen_properties_destroy();
  10.306 +	xen_compilation_destroy();
  10.307 +	xen_sysfs_version_destroy();
  10.308 +	xen_sysfs_type_destroy();
  10.309 +
  10.310 +}
  10.311 +
  10.312 +module_init(hyper_sysfs_init);
  10.313 +module_exit(hyper_sysfs_exit);
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/linux-2.6-xen-sparse/include/xen/hypervisor_sysfs.h	Tue Mar 21 12:17:19 2006 +0100
    11.3 @@ -0,0 +1,32 @@
    11.4 +/*
    11.5 + *  copyright (c) 2006 IBM Corporation
    11.6 + *  Authored by: Mike D. Day <ncmike@us.ibm.com>
    11.7 + *
    11.8 + *  This program is free software; you can redistribute it and/or modify
    11.9 + *  it under the terms of the GNU General Public License version 2 as
   11.10 + *  published by the Free Software Foundation.
   11.11 + */
   11.12 +
   11.13 +#ifndef _HYP_SYSFS_H_
   11.14 +#define _HYP_SYSFS_H_
   11.15 +
   11.16 +#include <linux/kobject.h>
   11.17 +#include <linux/sysfs.h>
   11.18 +
   11.19 +#define HYPERVISOR_ATTR_RO(_name) \
   11.20 +static struct hyp_sysfs_attr  _name##_attr = __ATTR_RO(_name)
   11.21 +
   11.22 +#define HYPERVISOR_ATTR_RW(_name) \
   11.23 +static struct hyp_sysfs_attr _name##_attr = \
   11.24 +	__ATTR(_name, 0644, _name##_show, _name##_store)
   11.25 +
   11.26 +extern struct subsystem hypervisor_subsys;
   11.27 +
   11.28 +struct hyp_sysfs_attr {
   11.29 +	struct attribute attr;
   11.30 +	ssize_t (*show)(struct hyp_sysfs_attr *, char *);
   11.31 +	ssize_t (*store)(struct hyp_sysfs_attr *, const char *, size_t);
   11.32 +	void *hyp_attr_data;
   11.33 +};
   11.34 +
   11.35 +#endif /* _HYP_SYSFS_H_ */