[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1348769198-29580-11-git-send-email-daniel.kiper@oracle.com>
Date: Thu, 27 Sep 2012 20:06:37 +0200
From: Daniel Kiper <daniel.kiper@...cle.com>
To: konrad.wilk@...cle.com, andrew.cooper3@...rix.com,
jbeulich@...e.com, linux-kernel@...r.kernel.org,
xen-devel@...ts.xensource.com
Cc: Daniel Kiper <daniel.kiper@...cle.com>
Subject: [PATCH 10/11] drivers/xen: Export vmcoreinfo through sysfs
Export vmcoreinfo through sysfs.
Signed-off-by: Daniel Kiper <daniel.kiper@...cle.com>
---
drivers/xen/sys-hypervisor.c | 42 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index fdb6d22..0111ad0 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -355,6 +355,41 @@ static void xen_properties_destroy(void)
sysfs_remove_group(hypervisor_kobj, &xen_properties_group);
}
+#ifdef CONFIG_KEXEC
+static ssize_t vmcoreinfo_show(struct hyp_sysfs_attr *attr, char *buffer)
+{
+ return sprintf(buffer, "%lx %lx\n", xen_vmcoreinfo_maddr,
+ xen_vmcoreinfo_max_size);
+}
+
+HYPERVISOR_ATTR_RO(vmcoreinfo);
+
+static int __init xen_vmcoreinfo_init(void)
+{
+ if (!xen_vmcoreinfo_max_size)
+ return 0;
+
+ return sysfs_create_file(hypervisor_kobj, &vmcoreinfo_attr.attr);
+}
+
+static void xen_vmcoreinfo_destroy(void)
+{
+ if (!xen_vmcoreinfo_max_size)
+ return;
+
+ sysfs_remove_file(hypervisor_kobj, &vmcoreinfo_attr.attr);
+}
+#else
+static int __init xen_vmcoreinfo_init(void)
+{
+ return 0;
+}
+
+static void xen_vmcoreinfo_destroy(void)
+{
+}
+#endif
+
static int __init hyper_sysfs_init(void)
{
int ret;
@@ -377,9 +412,14 @@ static int __init hyper_sysfs_init(void)
ret = xen_properties_init();
if (ret)
goto prop_out;
+ ret = xen_vmcoreinfo_init();
+ if (ret)
+ goto vmcoreinfo_out;
goto out;
+vmcoreinfo_out:
+ xen_properties_destroy();
prop_out:
xen_sysfs_uuid_destroy();
uuid_out:
@@ -394,12 +434,12 @@ out:
static void __exit hyper_sysfs_exit(void)
{
+ xen_vmcoreinfo_destroy();
xen_properties_destroy();
xen_compilation_destroy();
xen_sysfs_uuid_destroy();
xen_sysfs_version_destroy();
xen_sysfs_type_destroy();
-
}
module_init(hyper_sysfs_init);
module_exit(hyper_sysfs_exit);
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists