Add --skip-all-ffs option to mtd-utils nandwrite
Marek Vasut
marek.vasut at gmail.com
Wed Dec 7 06:09:49 PST 2016
On 12/07/2016 09:21 AM, David Oberhollenzer wrote:
> On 12/07/2016 06:01 AM, Marek Vasut wrote:
>> + if (skipallffs)
>> + {
>> + for (ii = 0; ii < mtd.min_io_size; ii +=
>> sizeof(uint32_t))
>> + {
>> + if (*(uint32_t*)(writebuf + ii) !=
>> 0xffffffff)
>> + break;
>>
>> Is this memcmp()-alike function ?
>>
>> + }
>> + if (ii == mtd.min_io_size)
>> + allffs = 1;
>> + }
>> + if (!allffs) {
> The point of the patch is not to write a page that is filled with 0xFF bytes.
> A feature that is turned off by default and can be activated via a command
> line switch.
That much I figured out
> The code you are trying to replace tries to figure out if an entire block of
> memory is set to 0xFF. The code path should be conditional, as this feature
> is turned off unless explicitly requested.
And to do that, we need to open-code it like above ?
Looks pretty crappy.
>> This could be simply turned to:
>>
>> ret = 0;
>> if (!memcmp(writebuf, writebuf + 1, mtd.min_io_size - 1)) {
>> ret = mtd_write(....);
>> }
> This does something completely different.
It checks whether the buffer if full of the same bytes, yes ?
Add additional conditions as needed (check whether user provided
the arg and whether byte 0 in the buffer is 0xff and you should
be done).
--
Best regards,
Marek Vasut
More information about the linux-mtd
mailing list