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

[Xen-devel] [PATCH 1/5] xen/sys/hypervisor: Export guest_properties/is_initial_domain



Signed-off-by: Bastian Blank <waldi@xxxxxxxxxx>
---
 drivers/xen/sys-hypervisor.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index 1e0fe01..d0916e8 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -355,6 +355,35 @@ static void xen_properties_destroy(void)
        sysfs_remove_group(hypervisor_kobj, &xen_properties_group);
 }
 
+/* xen guest properties info */
+
+static ssize_t is_initial_domain_show(struct hyp_sysfs_attr *attr, char 
*buffer)
+{
+       return sprintf(buffer, "%d\n", xen_initial_domain());
+}
+
+HYPERVISOR_ATTR_RO(is_initial_domain);
+
+static struct attribute *xen_guest_properties_attrs[] = {
+       &is_initial_domain_attr.attr,
+       NULL
+};
+
+static struct attribute_group xen_guest_properties_group = {
+       .name = "guest_properties",
+       .attrs = xen_guest_properties_attrs,
+};
+
+static int __init xen_guest_properties_init(void)
+{
+       return sysfs_create_group(hypervisor_kobj, &xen_guest_properties_group);
+}
+
+static void xen_guest_properties_destroy(void)
+{
+       sysfs_remove_group(hypervisor_kobj, &xen_guest_properties_group);
+}
+
 static int __init hyper_sysfs_init(void)
 {
        int ret;
@@ -377,9 +406,14 @@ static int __init hyper_sysfs_init(void)
        ret = xen_properties_init();
        if (ret)
                goto prop_out;
+       ret = xen_guest_properties_init();
+       if (ret)
+               goto gprop_out;
 
        goto out;
 
+gprop_out:
+       xen_properties_destroy();
 prop_out:
        xen_sysfs_uuid_destroy();
 uuid_out:
@@ -394,6 +428,7 @@ out:
 
 static void __exit hyper_sysfs_exit(void)
 {
+       xen_guest_properties_destroy();
        xen_properties_destroy();
        xen_compilation_destroy();
        xen_sysfs_uuid_destroy();
-- 
1.7.7.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.