提交 96c3a239 编写于 作者: D Dave Jiang 提交者: Ross Zwisler

libnvdimm: expose platform persistence attribute for nd_region

Providing a sysfs attribute for nd_region that shows the persistence
capabilities for the platform.
Signed-off-by: NDave Jiang <dave.jiang@intel.com>
Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
上级 30e6d7bf
...@@ -528,6 +528,18 @@ static ssize_t resource_show(struct device *dev, ...@@ -528,6 +528,18 @@ static ssize_t resource_show(struct device *dev,
} }
static DEVICE_ATTR_RO(resource); static DEVICE_ATTR_RO(resource);
static ssize_t persistence_domain_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct nd_region *nd_region = to_nd_region(dev);
unsigned long flags = nd_region->flags;
return sprintf(buf, "%s%s\n",
flags & BIT(ND_REGION_PERSIST_CACHE) ? "cpu_cache " : "",
flags & BIT(ND_REGION_PERSIST_MEMCTRL) ? "memory_controller " : "");
}
static DEVICE_ATTR_RO(persistence_domain);
static struct attribute *nd_region_attributes[] = { static struct attribute *nd_region_attributes[] = {
&dev_attr_size.attr, &dev_attr_size.attr,
&dev_attr_nstype.attr, &dev_attr_nstype.attr,
...@@ -543,6 +555,7 @@ static struct attribute *nd_region_attributes[] = { ...@@ -543,6 +555,7 @@ static struct attribute *nd_region_attributes[] = {
&dev_attr_init_namespaces.attr, &dev_attr_init_namespaces.attr,
&dev_attr_badblocks.attr, &dev_attr_badblocks.attr,
&dev_attr_resource.attr, &dev_attr_resource.attr,
&dev_attr_persistence_domain.attr,
NULL, NULL,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册