summaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorJoe Jin <joe.jin@oracle.com>2018-08-28 16:56:08 +0200
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2018-08-28 23:37:40 +0200
commit076e2cedd6ea4786569c35f8725b4efdc1ecf2f2 (patch)
treed5c6d2f1523f5f130b94e3b63d656d1456c2daa4 /drivers/xen
parentx86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear (diff)
downloadlinux-076e2cedd6ea4786569c35f8725b4efdc1ecf2f2.tar.xz
linux-076e2cedd6ea4786569c35f8725b4efdc1ecf2f2.zip
xen: export device state to sysfs
Export device state to sysfs to allow for easier get device state. Signed-off-by: Joe Jin <joe.jin@oracle.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Juergen Gross <jgross@suse.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index f2088838f690..5b471889d723 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
}
static DEVICE_ATTR_RO(modalias);
+static ssize_t state_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%s\n",
+ xenbus_strstate(to_xenbus_device(dev)->state));
+}
+static DEVICE_ATTR_RO(state);
+
static struct attribute *xenbus_dev_attrs[] = {
&dev_attr_nodename.attr,
&dev_attr_devtype.attr,
&dev_attr_modalias.attr,
+ &dev_attr_state.attr,
NULL,
};