diff options
author | Xiaolei Li <xiaolei.li@mediatek.com> | 2018-04-10 15:36:55 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-04-10 15:38:56 +0200 |
commit | a10353584f93334b5687c598a15260c0fc5b8d3e (patch) | |
tree | cb2916f76ba8c9cbe131b7cf632027891f94d964 /lib/libmtd_int.h | |
parent | 044ed4c0dd788f980a3a1a6fc6bf855a239f12e5 (diff) |
libmtd: Add support to access OOB available size
This patch exposes OOB available size to user. Then user can use
OOB free area according to OOB available size.
Steps to get OOB available size:
First, access /sys/class/mtd/mtdX/oobavail. If not exist, then
try to get ecc layout by ioctl "ECCGETLAYOUT". If none of them
work, set OOB available size to 0.
Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/libmtd_int.h')
-rw-r--r-- | lib/libmtd_int.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libmtd_int.h b/lib/libmtd_int.h index 03b0863..c0514d2 100644 --- a/lib/libmtd_int.h +++ b/lib/libmtd_int.h @@ -44,6 +44,7 @@ extern "C" { #define MTD_MIN_IO_SIZE "writesize" #define MTD_SUBPAGE_SIZE "subpagesize" #define MTD_OOB_SIZE "oobsize" +#define MTD_OOBAVAIL "oobavail" #define MTD_REGION_CNT "numeraseregions" #define MTD_FLAGS "flags" @@ -63,6 +64,7 @@ extern "C" { * @mtd_min_io_size: minimum I/O unit size file pattern * @mtd_subpage_size: sub-page size file pattern * @mtd_oob_size: MTD device OOB size file pattern + * @mtd_oobavail: MTD device free OOB size file pattern * @mtd_region_cnt: count of additional erase regions file pattern * @mtd_flags: MTD device flags file pattern * @sysfs_supported: non-zero if sysfs is supported by MTD @@ -92,6 +94,7 @@ struct libmtd char *mtd_min_io_size; char *mtd_subpage_size; char *mtd_oob_size; + char *mtd_oobavail; char *mtd_region_cnt; char *mtd_flags; unsigned int sysfs_supported:1; @@ -103,6 +106,8 @@ int legacy_dev_present(int mtd_num); int legacy_mtd_get_info(struct mtd_info *info); int legacy_get_dev_info(const char *node, struct mtd_dev_info *mtd); int legacy_get_dev_info1(int dev_num, struct mtd_dev_info *mtd); +int legacy_get_mtd_oobavail(const char *node); +int legacy_get_mtd_oobavail1(int mtd_num); #ifdef __cplusplus } |