[PATCH] mtd-utils: formatting of odd-sized OOB in nanddump
Artem Bityutskiy
dedekind1 at gmail.com
Wed Jul 7 10:07:54 EDT 2010
On Wed, 2010-06-16 at 09:42 -0700, Brian Norris wrote:
> + if (i+15 < meminfo.oobsize) {
> + /* Print 16 bytes */
> + sprintf(pretty_buf, " OOB Data: %02x %02x %02x %02x %02x %02x "
> + "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
> + oobbuf[i], oobbuf[i+1], oobbuf[i+2],
> + oobbuf[i+3], oobbuf[i+4], oobbuf[i+5],
> + oobbuf[i+6], oobbuf[i+7], oobbuf[i+8],
> + oobbuf[i+9], oobbuf[i+10], oobbuf[i+11],
> + oobbuf[i+12], oobbuf[i+13], oobbuf[i+14],
> + oobbuf[i+15]);
> + write(ofd, pretty_buf, 60);
> + } else {
> + /* Print 10 bytes */
> + sprintf(pretty_buf, " OOB Data: %02x %02x %02x %02x %02x %02x "
> + "%02x %02x %02x %02x\n",
> + oobbuf[i], oobbuf[i+1], oobbuf[i+2],
> + oobbuf[i+3], oobbuf[i+4], oobbuf[i+5],
> + oobbuf[i+6], oobbuf[i+7], oobbuf[i+8],
> + oobbuf[i+9]);
> + write(ofd, pretty_buf, 42);
> + }
Why 10 bytes, why not 12 or 14?
I think it is better to just copy-paste-modify the kernel
print_hex_dump() and utilize it, instead of this ugly crocodile code ...
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
More information about the linux-mtd
mailing list