[PATCH] libmtd: allow write operations when MEMWRITE is not supported

Brian Norris computersforpeace at gmail.com
Mon Dec 12 16:40:43 EST 2011


On Mon, Dec 12, 2011 at 1:26 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Fri, 2011-12-09 at 11:45 -0800, Brian Norris wrote:
>> MEMWRITE is a recently introduced write interface for MTD; however, it
>> is, for now, only supported on NAND flash. mtd-utils should fall back to
>> old write methods when either ENOTTY or EOPNOTSUPP are returned.
>>
>> This is a showstopper when, for instance, using ubiformat on NOR, which
>> don't have a mtd->write_oob interface (and thus don't support MEMWRITE):
>>
>>   ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
>>           error 122 (Operation not supported)
>>
>> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
>
> I guess this require an urgent mtd-utils release.
>
> Also, why you say 'for now', does even make-sense to implement this for
> NOR?

I think when (somewhat hurriedly) writing this patch, I was
considering issues with the libmtd interface (mtd_write) and with the
ioctl (MEMWRITE). I kinda mixed them up and wrote something that
wasn't really applicable to either one. Deleting "for now" is good.

Another issue: there are strictly non-NAND flash with OOB as well, so
my statement ("only supported on NAND flash") isn't quite as good as
yours ("not supported for flashes without OOB, e.g., NOR flash"). Not
hugely important on a mtd-utils patch though.

> I've also just pushed this patch, does it look OK to you?

Yes, it looks fine.

Brian

P.S. FYI, I don't see the mtd-utils "push" yet.



More information about the linux-mtd mailing list