[PATCH 1/2] libmtd: Add support to access OOB available size

David Oberhollenzer david.oberhollenzer at sigma-star.at
Sun Apr 8 23:58:16 PDT 2018


Hi,

On 04/09/2018 05:10 AM, Xiaolei Li wrote:
> @@ -769,6 +774,8 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd)
>  		return -1;
>  	if (dev_read_pos_int(lib->mtd_oob_size, mtd_num, &mtd->oob_size))
>  		return -1;
> +	if (dev_read_pos_int(lib->mtd_oobavail, mtd_num, &mtd->oobavail))
> +		return -1;
>  	if (dev_read_pos_int(lib->mtd_region_cnt, mtd_num, &mtd->region_cnt))
>  		return -1;
>  	if (dev_read_hex_int(lib->mtd_flags, mtd_num, &ret))

I'm not sure if it is a good idea to do a hard fail here, since this
depends on a recent change to the kernel.

It might be preferable to catch and handle ENOENT, otherwise the next
release of mtd-utils will only work on the next kernel release onward.

Maybe mtd_oobavail could to be set to some reasonable default that
retains the current behaviour on "older" kernels?


Thanks,

David



More information about the linux-mtd mailing list