<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mtd-utils.git/lib, branch v1.5.0</title>
<subtitle>A mirror of http://git.infradead.org/mtd-utils.git</subtitle>
<id>https://git.infraroot.at/mtd-utils.git/atom?h=v1.5.0</id>
<link rel='self' href='https://git.infraroot.at/mtd-utils.git/atom?h=v1.5.0'/>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/'/>
<updated>2012-02-29T07:19:17+00:00</updated>
<entry>
<title>libmtd_legacy: don't open device in R/W</title>
<updated>2012-02-29T07:19:17+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2012-02-08T21:26:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=ac10be41ad321752682f2549ebc42b2512012f60'/>
<id>urn:sha1:ac10be41ad321752682f2549ebc42b2512012f60</id>
<content type='text'>
On legacy kernels with ROM devices, we can get mtdinfo errors like:

libmtd: error!: cannot open "/dev/mtd4"
        error 13 (Permission denied)
mtdinfo: error!: libmtd failed get MTD device 4 information
         error 13 (Permission denied)

We don't need O_RDRW access for informational ioctls(), so make this
O_RDONLY.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>libmtd: perform device checking first</title>
<updated>2012-02-29T07:19:17+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2012-02-08T21:26:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=c3e2250260f9ab7846cea5ae974ddb7379a8fef6'/>
<id>urn:sha1:c3e2250260f9ab7846cea5ae974ddb7379a8fef6</id>
<content type='text'>
If we don't check for the MTD before calling `legacy_get_dev_info1', we may
get errors like:

libmtd: MTD subsystem is old and does not support sysfs, so MTD character device nodes have to exist
libmtd: error!: "/dev/mtd2" is not a character device
mtdinfo: error!: libmtd failed get MTD device 2 information
         error 22 (Invalid argument)

So reverse the order of these two checks.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>libmtd: fix mtd_write() issues for large data-only writes</title>
<updated>2012-02-14T09:01:20+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2012-02-11T04:35:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=71c76e74661492b4f68f670514866cfc85f47089'/>
<id>urn:sha1:71c76e74661492b4f68f670514866cfc85f47089</id>
<content type='text'>
ioctl(MEMWRITE) is implemented with memdup_user(), and so it allocates
kernel memory in contiguous regions. This limits its usefulness for large
amounts of data, since contiguous kernel memory can become scarce. I have
experienced "out of memory" problems with ubiformat, for instance, which
writes in eraseblock-sized regions:

  ...
  ubiformat: flashing eraseblock 12 -- 72 % complete
  ubiformat: page allocation failure.
  order:8, mode:0xd0
  Call Trace:
  [&lt;8043fa7c&gt;] dump_stack+0x8/0x34
  [&lt;8008c940&gt;] __alloc_pages_nodemask+0x408/0x618
  [&lt;800bd748&gt;] cache_alloc_refill+0x400/0x730
  [&lt;800bdbbc&gt;] __kmalloc+0x144/0x154
  [&lt;8009cae4&gt;] memdup_user+0x24/0x94
  [&lt;802d04e4&gt;] mtd_ioctl+0xba8/0xbd0
  [&lt;802d0544&gt;] mtd_unlocked_ioctl+0x38/0x5c
  [&lt;800d43c0&gt;] do_vfs_ioctl+0xa4/0x6e4
  [&lt;800d4a44&gt;] sys_ioctl+0x44/0xa0
  [&lt;8000f95c&gt;] stack_done+0x20/0x40
  ...
  libmtd: error!: MEMWRITE ioctl failed for eraseblock 12 (mtd0)
          error 12 (Cannot allocate memory)
  ubiformat: error!: cannot write eraseblock 12
             error 12 (Cannot allocate memory)

This error can be mitigated for now by only using ioctl(MEMWRITE) when we
need to write OOB data, since we can only do this in small transactions
anyway. Then, data-only transactions (like those originating from
ubiformat) can be carried out with write() calls.

This issue can also be solved within the kernel ioctl(), but either way,
this patch is still useful, since write() is more straightforward (and
efficient?) than ioctl() for data-only writes.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>libmtd: fix segmentation fault on lib-&gt;mtd</title>
<updated>2012-02-14T09:00:12+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2012-02-09T18:13:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=6571ef822aa7d782a8168d39a27fa3e65a3032be'/>
<id>urn:sha1:6571ef822aa7d782a8168d39a27fa3e65a3032be</id>
<content type='text'>
Legacy systems do not initialize lib-&gt;mtd, so we shouldn't perform
strlen(lib-&gt;mtd); this produces a segmentation fault. As this code isn't
used in the legacy codepath, we can just move it down to an 'else' branch.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>limbtd: implement mtd_dev_present for old kernels</title>
<updated>2012-02-14T09:00:09+00:00</updated>
<author>
<name>Artem Bityutskiy</name>
<email>artem.bityutskiy@linux.intel.com</email>
</author>
<published>2012-02-09T18:13:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=eded3cd0a52252f677ceacd1fbcae13be3d55e8f'/>
<id>urn:sha1:eded3cd0a52252f677ceacd1fbcae13be3d55e8f</id>
<content type='text'>
Implement the 'legacy_dev_present()' function which will check whether an MTD
device is present by scanning the /proc/mtd file when the MTD subsystem does
not support sysfs (the case for pre-2.6.30 kernels).

This patch also moves the 'mtd_dev_present()' function to a slightly more
logical position.

Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>libmtd: add `mtd_dev_present()' library function</title>
<updated>2012-02-02T11:23:39+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2012-01-27T18:30:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=de3f8789d9e54b2e0e45197a693ad87ebf3bab60'/>
<id>urn:sha1:de3f8789d9e54b2e0e45197a693ad87ebf3bab60</id>
<content type='text'>
Will be used for `mtdinfo --all'

Artem: add a temporary stub for pre-2.6.30 kernels.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>libmtd: Variable name same as function name causing compile to fail (Android)</title>
<updated>2012-01-13T21:56:56+00:00</updated>
<author>
<name>Thomas Cannon</name>
<email>mail@thomascannon.net</email>
</author>
<published>2012-01-09T16:20:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=bacf173c87a936858125d3248067329c5b069e58'/>
<id>urn:sha1:bacf173c87a936858125d3248067329c5b069e58</id>
<content type='text'>
When compiling mtd-utils against Android's bionic libc using the
supplied cross compiler environment it errors:

lib/libmtd.c: In function 'dev_node2num':
lib/libmtd.c:444: error: called object 'major' is not a function
lib/libmtd.c:445: error: called object 'minor' is not a function
lib/libmtd.c: In function 'mtd_probe_node':
lib/libmtd.c:1384: error: called object 'major' is not a function
lib/libmtd.c:1385: error: called object 'minor' is not a function

This patch updates the variable names for "major" and "minor" in two
places. It then compiles cleanly.

Artem: pick different names, also rename major1/minor1 variables for
consistency.

Signed-off-by: Thomas Cannon &lt;mail at thomascannon.net&gt;
Cc: linux-mtd at lists.infradead.org
</content>
</entry>
<entry>
<title>libmtd: allow write operations when MEMWRITE is not supported</title>
<updated>2011-12-12T21:45:54+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2011-12-09T19:45:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=ec985197e7cd6ec33f41273bff7afd4c4f454b87'/>
<id>urn:sha1:ec985197e7cd6ec33f41273bff7afd4c4f454b87</id>
<content type='text'>
MEMWRITE is a recently introduced write interface for MTD; however, it
is 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-&gt;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 &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;Artem.Bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>mtdutils: move OOB auto-layout into libmtd's mtd_write</title>
<updated>2011-09-11T13:11:41+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2011-08-31T20:00:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=c4c8cdf621a5d1ea4f0f01ff004c6f1c33be9daa'/>
<id>urn:sha1:c4c8cdf621a5d1ea4f0f01ff004c6f1c33be9daa</id>
<content type='text'>
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 &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@intel.com&gt;
</content>
</entry>
<entry>
<title>libmtd: support MEMWRITE ioctl</title>
<updated>2011-09-11T13:11:41+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2011-08-31T20:00:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=6a8889fbc0ea7a198628c9e3901fd88038e12d09'/>
<id>urn:sha1:6a8889fbc0ea7a198628c9e3901fd88038e12d09</id>
<content type='text'>
`mtd_write()' now will first attempt to use MEMWRITE. Then, if that
doesn't exist, it will attempt to fall back to old methods for writing
OOB and/or page data.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@intel.com&gt;
</content>
</entry>
</feed>
