<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mtd-utils.git/lib/libmtd_legacy.c, branch v2.3.1</title>
<subtitle>A mirror of http://git.infradead.org/mtd-utils.git</subtitle>
<id>https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.1</id>
<link rel='self' href='https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.1'/>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/'/>
<updated>2023-05-30T09:12:12+00:00</updated>
<entry>
<title>libmtd: Add function to get MTD info by device name</title>
<updated>2023-05-30T09:12:12+00:00</updated>
<author>
<name>Brandon Maier</name>
<email>brandon.maier@collins.com</email>
</author>
<published>2022-12-12T18:01:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a527b22f0a30d66d4674624d16f4bb0ffe2e94d0'/>
<id>urn:sha1:a527b22f0a30d66d4674624d16f4bb0ffe2e94d0</id>
<content type='text'>
This is a convenience function for end users. In some situations it's
easier to reference MTD device's by their name then by MTD number, as
the name may be more reliable if device partitioning is dynamic or for
porting between systems.

Signed-off-by: Brandon Maier &lt;brandon.maier@collins.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>mtd-utils: Fix various TOCTOU issues</title>
<updated>2020-02-09T21:13:18+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-01-24T22:18:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=4233a39933277b0d715d59d72942a8fd65bcec4a'/>
<id>urn:sha1:4233a39933277b0d715d59d72942a8fd65bcec4a</id>
<content type='text'>
This patch restructures various code parts that follow the pattern
of "stat(x, &amp;sb) ... makes_sense(&amp;sb) ... open(x)".

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>libmtd: don't print an error message for devices without ecc support</title>
<updated>2018-09-20T09:27:01+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2018-09-12T07:40:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a63a209d8ee8f21722a3b07d01d904bca5dbbc31'/>
<id>urn:sha1:a63a209d8ee8f21722a3b07d01d904bca5dbbc31</id>
<content type='text'>
The libmtd library tries to obtain the available OOB size via the sysfs
with a fallback to the ECCGETLAYOUT ioctl. For some devices (e.g. plat-ram),
the fallback path is always taken and prints an error message to stderr
since the ioctl fails.

This patch fixes the fallback path by suppressing the error message if
errno is set to EOPNOTSUPP (i.e. the device simply doesn't support that).

Fixes: a10353584f93 ("libmtd: Add support to access OOB available size")
Reported-by: Chris Packham &lt;Chris.Packham@alliedtelesis.co.nz&gt;
Reviewed-by: Xiaolei Li &lt;xiaolei.li@mediatek.com&gt;
Tested-by: Chris Packham &lt;Chris.Packham@alliedtelesis.co.nz&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>libmtd_legacy: Fix some function description mismatches</title>
<updated>2018-04-10T13:38:59+00:00</updated>
<author>
<name>Xiaolei Li</name>
<email>xiaolei.li@mediatek.com</email>
</author>
<published>2018-04-10T07:36:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=165f2cd9f5d63fb3b3200d2ad202cf3e4f820fc4'/>
<id>urn:sha1:165f2cd9f5d63fb3b3200d2ad202cf3e4f820fc4</id>
<content type='text'>
Signed-off-by: Xiaolei Li &lt;xiaolei.li@mediatek.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>libmtd: Add support to access OOB available size</title>
<updated>2018-04-10T13:38:56+00:00</updated>
<author>
<name>Xiaolei Li</name>
<email>xiaolei.li@mediatek.com</email>
</author>
<published>2018-04-10T07:36:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a10353584f93334b5687c598a15260c0fc5b8d3e'/>
<id>urn:sha1:a10353584f93334b5687c598a15260c0fc5b8d3e</id>
<content type='text'>
This patch exposes OOB available size to user. Then user can use
OOB free area according to OOB available size.

Steps to get OOB available size:
First, access /sys/class/mtd/mtdX/oobavail. If not exist, then
try to get ecc layout by ioctl "ECCGETLAYOUT". If none of them
work, set OOB available size to 0.

Signed-off-by: Xiaolei Li &lt;xiaolei.li@mediatek.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix libmtd behaviour if MTD is not present on the system</title>
<updated>2017-03-15T11:10:34+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2017-03-15T10:26:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a2eeedb0a7af1d8ebe8593cb9a9bb994d2854e63'/>
<id>urn:sha1:a2eeedb0a7af1d8ebe8593cb9a9bb994d2854e63</id>
<content type='text'>
The documentation of libmtd_open says, if it returns NULL and errno is
zero, MTD is not present. However, the current version always returns
a libmtd_t object. The function internally checks, if it can access the
MTD sysfs files and, if not, sets a flag to use the procfs fallback.

This patch adds an additional check to libmtd_open, to test if the
MTD procfs file can be read and fails with errno cleared if it does
not exist.

Furhtermore, mtd_get_info is documented to fail with errno set to ENODEV
if MTD is not present. First of all, this was broken in the original
version. It was implemented to specification for the sysfs code path,
but if MTD is not present, that won't be executed, because of the flag
set by libmtd_open. This makes the check not only redundant, but masks
an actual error (the sysfs paths suddenly not being readable anymore).
The legacy path that was used if the sysfs files are not avaible fails
with ENOENT if it cannot read the procfs file. With the above changes
in addition, we don't have a libmtd_t object if neither sysfs nor
procfs is readable, so this error status no longer makes sense.

This patch removes the documentation on the ENODEV errno, and
makes sure that mtd_get_info always returns with apropriate errno
on failure.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Remove unused legacy_libmtd_open internal libmtd function</title>
<updated>2016-11-17T10:36:55+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2016-08-25T11:38:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=5841f15bf5d9cba2bdcc6526000538fedeee46e3'/>
<id>urn:sha1:5841f15bf5d9cba2bdcc6526000538fedeee46e3</id>
<content type='text'>
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&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>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>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>
</feed>
