From a10353584f93334b5687c598a15260c0fc5b8d3e Mon Sep 17 00:00:00 2001 From: Xiaolei Li Date: Tue, 10 Apr 2018 15:36:55 +0800 Subject: 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 Signed-off-by: David Oberhollenzer --- include/libmtd.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/libmtd.h b/include/libmtd.h index db85fb4..cc24af8 100644 --- a/include/libmtd.h +++ b/include/libmtd.h @@ -66,6 +66,7 @@ struct mtd_info * @min_io_size: minimum input/output unit size * @subpage_size: sub-page size * @oob_size: OOB size (zero if the device does not have OOB area) + * @oobavail: free OOB size * @region_cnt: count of additional erase regions * @writable: zero if the device is read-only * @bb_allowed: non-zero if the MTD device may have bad eraseblocks @@ -84,6 +85,7 @@ struct mtd_dev_info int min_io_size; int subpage_size; int oob_size; + int oobavail; int region_cnt; unsigned int writable:1; unsigned int bb_allowed:1; -- cgit v1.2.3