]> www.infradead.org Git - mtd-utils.git/commit
mtdutils: move OOB auto-layout into libmtd's mtd_write
authorBrian Norris <computersforpeace@gmail.com>
Wed, 31 Aug 2011 20:00:36 +0000 (13:00 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 13:11:41 +0000 (16:11 +0300)
commitc4c8cdf621a5d1ea4f0f01ff004c6f1c33be9daa
tree7f2c6fe98d2d87bb33105fe79e8043f19c6dfb67
parent040c937ca2c5ae1f35c24a3cc0154e9a31df5933
mtdutils: move OOB auto-layout into libmtd's mtd_write

With the addition of the the new ioctl(MEMWRITE), we can use the
kernel's internal OOB autoplacement option. It's a cleaner interface and
avoids too much duplication of coding effort.

This patch moves any legacy code (using MEMGETOOBSEL) into a legacy
function in libmtd.c. It's not exactly a "pre-2.6.30" feature, so I'm not
moving it to libmtd_legacy.c.

Now, autoplacement features are only activated if we call mtd_write with
mode == MTD_OPS_AUTO_OOB. This should fix some discrepancies for
nandwrite, where we weren't handling OOB consistently (i.e., we had
different functionality when the kernel did/didn't support MEMWRITE).
But that also means that we now default to using MTD_OPS_PLACE_OOB
instead of AUTO layout. To re-enable autoplacement, we can re-implement
the `--autoplace' option that had previously rotted.

This patch also cleans up a need for an extra OOB buffer in nandwrite.

This has been tested a little in nandsim as well as on SLC NAND flash.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
lib/libmtd.c
nandwrite.c