<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mtd-utils.git/lib, branch v1.5.2</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.2</id>
<link rel='self' href='https://git.infraroot.at/mtd-utils.git/atom?h=v1.5.2'/>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/'/>
<updated>2015-05-28T23:31:34+00:00</updated>
<entry>
<title>libmtd: fix comment typo</title>
<updated>2015-05-28T23:31:34+00:00</updated>
<author>
<name>Baruch Siach</name>
<email>baruch@tkos.co.il</email>
</author>
<published>2015-04-29T08:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=22cffe1259ce128766c7f00da84a614a06e77fcc'/>
<id>urn:sha1:22cffe1259ce128766c7f00da84a614a06e77fcc</id>
<content type='text'>
Signed-off-by: Baruch Siach &lt;baruch@tkos.co.il&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>mtd-utils: libfec: use standard C type instead of u_long</title>
<updated>2015-05-28T23:31:34+00:00</updated>
<author>
<name>Imre Kaloz</name>
<email>kaloz@openwrt.org</email>
</author>
<published>2015-05-04T13:36:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=f4d4ad26d57ed2d57509ed8fda2da99ce7b5f9ec'/>
<id>urn:sha1:f4d4ad26d57ed2d57509ed8fda2da99ce7b5f9ec</id>
<content type='text'>
Fixes compilation on hosts with the musl C library.
Also drops the unused u_short typedef.

Signed-off-by: Imre Kaloz &lt;kaloz@openwrt.org&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>libmtd: don't ignore "region index" parameter in mtd_regioninfo()</title>
<updated>2014-11-05T03:00:42+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2014-09-15T17:35:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=6eb466a4f34808d29e3a704f6cabc7f70beebdc8'/>
<id>urn:sha1:6eb466a4f34808d29e3a704f6cabc7f70beebdc8</id>
<content type='text'>
ioctl(MEMGETREGIONINFO) has one input parameter (regionindex) and three
output parameters (info about the erase region). There are two problems
in mtdinfo/libmtd here:

 1. mtdinfo.c doesn't initialize its region_info_user struct, instead
    passing uninitialized data to mtd_regioninfo()

 2. mtd_regioninfo() fails to utilize the 'regidx' parameter to fill out
    the regionindex parameter properly, so the garbage from mtdinfo.c is
    propagated to the ioctl()

This means that mtdinfo will continuously probe the same (possibly
out-of-range) erase region, instead of looping over the valid regions.

Let's fix this in the mtd_regioninfo() helper, and at the same time,
let's zero out the mtdinfo.c buffer, as an additional precaution to keep
from using uninitialized data.

Initial error report from Yang, when running "mtdinfo /dev/mtd0" on a
Cavium 6100 board:

	root@CN61XX:~# mtdinfo /dev/mtd0
	mtd0
	Name:                           phys_mapped_flash
	Type:                           nor
	Eraseblock size:                65536 bytes, 64.0 KiB
	Amount of eraseblocks:          128 (8388608 bytes, 8.0 MiB)
	Minimum input/output unit size: 1 byte
	Sub-page size:                  1 byte
	Additional erase regions:       0
	Character device major/minor:   90:0
	Bad blocks are allowed:         false
	Device is writable:             true
	libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 0
	        error 22 (Invalid argument)
	Eraseblock region 0:  info is unavailable
	libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 1
	        error 22 (Invalid argument)
	Eraseblock region 1:  info is unavailable

Reported-by: Yang Wei &lt;Wei.Yang@windriver.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>libmtd: fix mtd_dev_present return value on legacy systems</title>
<updated>2014-09-15T17:11:02+00:00</updated>
<author>
<name>Guido Martínez</name>
<email>guido@vanguardiasur.com.ar</email>
</author>
<published>2014-09-10T14:56:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=51b71fb46a069fa137c7a02769d60561e178ba15'/>
<id>urn:sha1:51b71fb46a069fa137c7a02769d60561e178ba15</id>
<content type='text'>
On legacy systems, if "/proc/mtd" doesn't exist or gives a read error,
mtd_dev_present returns -1 (since it calls legacy_dev_present), contrary
to what's specified in the header file.

This causes checks like

  if (mtd_dev_present(n)) {
    ...
  }

to give false positives. Fix this by comparing the return value to 1.

Signed-off-by: Guido Martínez &lt;guido@vanguardiasur.com.ar&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>check the MLC nand type</title>
<updated>2013-10-22T23:19:23+00:00</updated>
<author>
<name>Huang Shijie</name>
<email>b32955@freescale.com</email>
</author>
<published>2013-08-20T05:58:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=263e138719f6358c3cf2ce47d6254cebef31dd4b'/>
<id>urn:sha1:263e138719f6358c3cf2ce47d6254cebef31dd4b</id>
<content type='text'>
In the current code, the MTD_NANDFLASH stands for both the SLC and MLC.

In the kernel, the MTD_NANDFLASH only stands for the SLC now,
so in order to keep the logic unchanged, we should also check the MLC
NAND by MTD_MLCNANDFLASH.

Signed-off-by: Huang Shijie &lt;b32955@freescale.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>add the MTD_MLCNANDFLASH case</title>
<updated>2013-10-22T23:17:52+00:00</updated>
<author>
<name>Huang Shijie</name>
<email>b32955@freescale.com</email>
</author>
<published>2013-08-20T05:58:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=2e4fe96b2bc5ad33793d0d5cbeb23c9f76155211'/>
<id>urn:sha1:2e4fe96b2bc5ad33793d0d5cbeb23c9f76155211</id>
<content type='text'>
The MTD_MLCNANDFLASH case is missed in the current code.
This patch adds it.

Signed-off-by: Huang Shijie &lt;b32955@freescale.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>consistency between u_int32_t / off_t / off64_t</title>
<updated>2012-09-25T15:06:50+00:00</updated>
<author>
<name>Richard Genoud</name>
<email>richard.genoud@gmail.com</email>
</author>
<published>2012-09-12T14:38:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=f3f3a208048eac5f8b5752a17ebcd44db9230fd8'/>
<id>urn:sha1:f3f3a208048eac5f8b5752a17ebcd44db9230fd8</id>
<content type='text'>
We should use the off_t type instead of off64_t or u_int32_t as its
length is controlled by the WITHOUT_LARGEFILE flag.

Signed-off-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<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>
</feed>
