forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
b2d7a075a1
commit
076e2cedd6
|
@ -73,3 +73,12 @@ KernelVersion: 3.0
|
||||||
Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||||
Description:
|
Description:
|
||||||
Number of sectors written by the frontend.
|
Number of sectors written by the frontend.
|
||||||
|
|
||||||
|
What: /sys/bus/xen-backend/devices/*/state
|
||||||
|
Date: August 2018
|
||||||
|
KernelVersion: 4.19
|
||||||
|
Contact: Joe Jin <joe.jin@oracle.com>
|
||||||
|
Description:
|
||||||
|
The state of the device. One of: 'Unknown',
|
||||||
|
'Initialising', 'Initialised', 'Connected', 'Closing',
|
||||||
|
'Closed', 'Reconfiguring', 'Reconfigured'.
|
||||||
|
|
|
@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(modalias);
|
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[] = {
|
static struct attribute *xenbus_dev_attrs[] = {
|
||||||
&dev_attr_nodename.attr,
|
&dev_attr_nodename.attr,
|
||||||
&dev_attr_devtype.attr,
|
&dev_attr_devtype.attr,
|
||||||
&dev_attr_modalias.attr,
|
&dev_attr_modalias.attr,
|
||||||
|
&dev_attr_state.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user