mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 05:11:48 +00:00
mtd: Add sysfs attribute for mtd OOB available size
Expose mtd OOB available size by sysfs file. Then users can get available OOB size by accessing /sys/class/mtd/mtdX/oobavail. Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
This commit is contained in:
parent
c3c9a2c4b9
commit
7cc9aa669a
@ -232,3 +232,11 @@ Description:
|
|||||||
of the parent (another partition or a flash device) in bytes.
|
of the parent (another partition or a flash device) in bytes.
|
||||||
This attribute is absent on flash devices, so it can be used
|
This attribute is absent on flash devices, so it can be used
|
||||||
to distinguish them from partitions.
|
to distinguish them from partitions.
|
||||||
|
|
||||||
|
What: /sys/class/mtd/mtdX/oobavail
|
||||||
|
Date: April 2018
|
||||||
|
KernelVersion: 4.16
|
||||||
|
Contact: linux-mtd@lists.infradead.org
|
||||||
|
Description:
|
||||||
|
Number of bytes available for a client to place data into
|
||||||
|
the out of band area.
|
||||||
|
@ -210,6 +210,15 @@ static ssize_t mtd_oobsize_show(struct device *dev,
|
|||||||
}
|
}
|
||||||
static DEVICE_ATTR(oobsize, S_IRUGO, mtd_oobsize_show, NULL);
|
static DEVICE_ATTR(oobsize, S_IRUGO, mtd_oobsize_show, NULL);
|
||||||
|
|
||||||
|
static ssize_t mtd_oobavail_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct mtd_info *mtd = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
return snprintf(buf, PAGE_SIZE, "%u\n", mtd->oobavail);
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR(oobavail, S_IRUGO, mtd_oobavail_show, NULL);
|
||||||
|
|
||||||
static ssize_t mtd_numeraseregions_show(struct device *dev,
|
static ssize_t mtd_numeraseregions_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
@ -327,6 +336,7 @@ static struct attribute *mtd_attrs[] = {
|
|||||||
&dev_attr_writesize.attr,
|
&dev_attr_writesize.attr,
|
||||||
&dev_attr_subpagesize.attr,
|
&dev_attr_subpagesize.attr,
|
||||||
&dev_attr_oobsize.attr,
|
&dev_attr_oobsize.attr,
|
||||||
|
&dev_attr_oobavail.attr,
|
||||||
&dev_attr_numeraseregions.attr,
|
&dev_attr_numeraseregions.attr,
|
||||||
&dev_attr_name.attr,
|
&dev_attr_name.attr,
|
||||||
&dev_attr_ecc_strength.attr,
|
&dev_attr_ecc_strength.attr,
|
||||||
|
Loading…
Reference in New Issue
Block a user