mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
libnvdimm: Add 'resource' sysfs attribute to regions
Adding sysfs attribute in order to export the physical address of the region. This is for supporting of user app poison clear via ND_IOCTL_CLEAR_ERROR. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
6a6bef9042
commit
802f4be6fe
1 changed files with 13 additions and 0 deletions
|
@ -463,6 +463,15 @@ static struct device_attribute dev_attr_nd_badblocks = {
|
||||||
.show = nd_badblocks_show,
|
.show = nd_badblocks_show,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ssize_t resource_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct nd_region *nd_region = to_nd_region(dev);
|
||||||
|
|
||||||
|
return sprintf(buf, "%#llx\n", nd_region->ndr_start);
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RO(resource);
|
||||||
|
|
||||||
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,
|
||||||
|
@ -476,6 +485,7 @@ static struct attribute *nd_region_attributes[] = {
|
||||||
&dev_attr_namespace_seed.attr,
|
&dev_attr_namespace_seed.attr,
|
||||||
&dev_attr_init_namespaces.attr,
|
&dev_attr_init_namespaces.attr,
|
||||||
&dev_attr_nd_badblocks.attr,
|
&dev_attr_nd_badblocks.attr,
|
||||||
|
&dev_attr_resource.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -495,6 +505,9 @@ static umode_t region_visible(struct kobject *kobj, struct attribute *a, int n)
|
||||||
if (!is_nd_pmem(dev) && a == &dev_attr_nd_badblocks.attr)
|
if (!is_nd_pmem(dev) && a == &dev_attr_nd_badblocks.attr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!is_nd_pmem(dev) && a == &dev_attr_resource.attr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (a != &dev_attr_set_cookie.attr
|
if (a != &dev_attr_set_cookie.attr
|
||||||
&& a != &dev_attr_available_size.attr)
|
&& a != &dev_attr_available_size.attr)
|
||||||
return a->mode;
|
return a->mode;
|
||||||
|
|
Loading…
Reference in a new issue