]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
7 years agoEnable further warning flags, address new warnings
David Oberhollenzer [Wed, 1 Nov 2017 22:08:45 +0000 (23:08 +0100)]
Enable further warning flags, address new warnings

mtd_debug: Remove a duplicate if case. MTD_CAP_NANDFLASH has only one
flag set (MTD_WRITEABLE). Directly below, we had a check for
MTD_WRITEABLE in the else branch which can't possible ever have
triggered. Checking for MTD_WRITEABLE in addition to the CAP constants
was probably not intended anyway, given the check for the individual
flags if all else fails.

integck: We already established that "r" is less than the number of
elements in the list, so the loop condition doesn't need to check
if w is NULL in addition. At least this way, the compiler "gets"
that w cannot be NULL below and doesn't issue warnings.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agojittertest: Use the appropriate versions of abs()
David Oberhollenzer [Thu, 2 Nov 2017 00:10:11 +0000 (01:10 +0100)]
jittertest: Use the appropriate versions of abs()

When passing a long argument, actually use labs().

The other case of passing a float to "int abs(int)" and
casting the result to an int doesn't really make sense.
Pull the cast inside the abs().

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agoMark or fix switch cases that fall through
David Oberhollenzer [Thu, 21 Sep 2017 09:15:32 +0000 (11:15 +0200)]
Mark or fix switch cases that fall through

Now that C++17 introduced a special fallthrough keyword for
explicitly tagging switch cases that are supposed to fall
through, newer gcc versions also implement a feature request
from 2002 to warn about maybe unwanted fall-throughs in switch
cases in other languages (like C).

For C code, we can either add a gcc specific attribute at the
end of the switch case, or use a special comment that gcc checks
for, indicating that the fall-through behaviour is indeed
intended.

This patch adds a "/* fall-through */" comment at the end of
various case blocks to silence gcc warnings and in some cases
a break, where fall-through was probably not intended.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agoAdd no-return attribute to usage() style functions
David Oberhollenzer [Thu, 21 Sep 2017 11:36:42 +0000 (13:36 +0200)]
Add no-return attribute to usage() style functions

A common pattern in command line processing is having a usage()
function that prints out how to use the command line options and
then terminates.

The function is typically used inside a switch block for command
line options like `-h' or unknown options. In a lot of places, the
break keyword is omitted, because the function exits anyway. However,
this triggers gcc warnings about implicit fall-through.

Rather than adding a phony "/* fall-through */" this patch flags the
usage() style function with a gcc attribute, indicating that they do
not return and removes further superfluous break statements.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agoRemove self-assignments of unused paramters
David Oberhollenzer [Wed, 1 Nov 2017 23:50:27 +0000 (00:50 +0100)]
Remove self-assignments of unused paramters

Use casts to void instead. Clang generates warnings about that by
default.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agomkfs.ubifs: ignore EOPNOTSUPP when listing extended attributes
Pavel Roskin [Tue, 24 Oct 2017 15:07:30 +0000 (08:07 -0700)]
mkfs.ubifs: ignore EOPNOTSUPP when listing extended attributes

Systems that don't support extended attributes should still be able to
create ubifs images.

Signed-off-by: Pavel Roskin <plroskin@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agotests: checkfs: Remove unused source file from makefiles
David Oberhollenzer [Thu, 21 Sep 2017 14:19:08 +0000 (16:19 +0200)]
tests: checkfs: Remove unused source file from makefiles

The file comm.c was erroneously compiled into makefiles. This patch
fixes that in the Automake file.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agomisc-utils: initialize "ip" in docfdisk to NULL
David Oberhollenzer [Thu, 21 Sep 2017 14:16:22 +0000 (16:16 +0200)]
misc-utils: initialize "ip" in docfdisk to NULL

Technically it is initializied in the for loop right before being
used. From the conditional above, we know that the for loop is
executed at least once and the variable is always initialized, but
gcc doesn't appear to perform the same reasoning.

This patch adds an initialization of the variable for the sake of
making the compiler happy.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agoubi-tests: io_update: fix missleading indentation
David Oberhollenzer [Thu, 21 Sep 2017 12:12:39 +0000 (14:12 +0200)]
ubi-tests: io_update: fix missleading indentation

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agomkfs.ubifs: Apply squash-uids to the root node
Romain Izard [Tue, 3 Oct 2017 08:50:28 +0000 (10:50 +0200)]
mkfs.ubifs: Apply squash-uids to the root node

The root node of the file system needs to be handled as a special case
when removing the owner information from the input.

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agoAdd ctags files to .gitignore
Uwe Kleine-König [Thu, 24 Aug 2017 15:22:38 +0000 (17:22 +0200)]
Add ctags files to .gitignore

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agoRelease mtd-utils-2.0.1 v2.0.1
David Oberhollenzer [Thu, 24 Aug 2017 12:36:15 +0000 (14:36 +0200)]
Release mtd-utils-2.0.1

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agomtd-utils: tests: Avoid using less than two blocks in nandpagetest
Miquel Raynal [Thu, 24 Aug 2017 10:59:46 +0000 (12:59 +0200)]
mtd-utils: tests: Avoid using less than two blocks in nandpagetest

Forbid the use of less than 2 eraseblocks in nandpagetest. It is obvious
that the test cannot run on zero block, but it cannot run on only one
block neither. The reason is: get_first_and_last_block() will return the
same id for both the first and the last blocks. In erasecrosstest(),
the logic is:
- erase/write/read/verify first block
- erase/write again first block
- erase *last* block
- read/verify first block
When using only one block, 'first' refers to the same block as 'last',
leading to erasing the block before reading it. Hence, the test would
fail with no actual reason.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
7 years agomtd-utils: ubinfo: add parameter check
Aaron Marcher [Tue, 8 Aug 2017 10:53:27 +0000 (12:53 +0200)]
mtd-utils: ubinfo: add parameter check

Adds a check if the UBI device number is specified when passing a volume
name as parameter.

This fixes an issue, where by default an inexistent UBI device named
"ubi-1" is selected because of missing checks.

Signed-off-by: Aaron Marcher <me@drkhsh.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomkfs-ubifs: fix inclusion of uuid.h
Rolf Eike Beer [Mon, 10 Jul 2017 11:54:24 +0000 (13:54 +0200)]
mkfs-ubifs: fix inclusion of uuid.h

The include directory exported by uuid.pc is */include/uuid, so uuid.h
must be included without any directory in the path. This usually works
out because uuid is installed in the normal prefix, so the parent
directory of what uuid has as include dir ends up in the include path
anyway. In case one uses a custom uuid outside of the regular include
path this breaks.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: tests: Add Erased Pages Bit Flip Test
Harpreet Eli Sangha [Fri, 30 Jun 2017 22:12:18 +0000 (15:12 -0700)]
mtd-utils: tests: Add Erased Pages Bit Flip Test

Bit flip detection for written and erased pages tend to have different
implementations. Where written pages are detected and corrected using
ECC, erased pages are typically detected by ensuring that the number of
zeros is less than a specified threshold.

As such, it's necessary to have the 'nandbiterrs' test support the
testing of written and erased pages. Bit flips in erased pages are
emulated by rewriting the page in raw mode, to prevent the use of ECC.

Signed-off-by: Harpreet Eli Sangha <harpreet@nestlabs.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoAdd const modifier to read only strings and string constants
David Oberhollenzer [Thu, 22 Jun 2017 12:00:04 +0000 (14:00 +0200)]
Add const modifier to read only strings and string constants

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoSilence warnings about unused arguments
David Oberhollenzer [Thu, 22 Jun 2017 11:41:55 +0000 (13:41 +0200)]
Silence warnings about unused arguments

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRemove unused variables and functions
David Oberhollenzer [Thu, 22 Jun 2017 11:41:22 +0000 (13:41 +0200)]
Remove unused variables and functions

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoEliminate warnings about missing prototypes
David Oberhollenzer [Thu, 22 Jun 2017 11:37:40 +0000 (13:37 +0200)]
Eliminate warnings about missing prototypes

This patch eliminates warnings generated by the -Wmissing-prototypes
option. With this flag set, we are now forced to have prototypes for
all global, exported functions, that have to be made visible to the
definitions and we are forced to mark all local functions as static.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoEnable compiler warnings
David Oberhollenzer [Thu, 22 Jun 2017 13:06:58 +0000 (15:06 +0200)]
Enable compiler warnings

This patch borrows the compiler.m4 script from util-linux to check
for compiler support of a number of warning flags and sets them if
they are supported.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoMove libfec declarations to public header in global include directory
David Oberhollenzer [Thu, 22 Jun 2017 11:39:31 +0000 (13:39 +0200)]
Move libfec declarations to public header in global include directory

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoUse autoconf header detection correctly for libmissing
David Oberhollenzer [Wed, 21 Jun 2017 08:27:47 +0000 (10:27 +0200)]
Use autoconf header detection correctly for libmissing

AC_CHECK_HEADERS already makes sure our config header contains a
HAVE_$FOO_H macro if a header was found. There is no need to
awkwardly set our own Automake conditionals and check for it all
over the place in the Automake files.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRestructure autoconf configure.ac
David Oberhollenzer [Wed, 14 Jun 2017 13:06:41 +0000 (15:06 +0200)]
Restructure autoconf configure.ac

This patch attempts to cleanly seperate configure switches,
dependency checking and generating of output files inside
the autoconf configure.ac file.

Also, instead of aborting immediately if a dependency is missing,
the configure script now completes dependency checking and then
lists ALL dependencies that are missing for the selected build
options. In addtion, suggestions on how to disable some features
that require the missing dependencies are printed out.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoReplace defunct ubifs_assert
David Oberhollenzer [Wed, 14 Jun 2017 13:37:52 +0000 (15:37 +0200)]
Replace defunct ubifs_assert

The ubifs assert defined in defs.h was only used in three places
inside key.h and defined to never perform any checks at all.

This patch replaces ubifs_assert in mkfs.ubifs with the regular
libc assert macro.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: tests: Fix nandbiterrs Failure Check
Harpreet Eli Sangha [Tue, 27 Jun 2017 20:52:26 +0000 (13:52 -0700)]
mtd-utils: tests: Fix nandbiterrs Failure Check

After a page read, the old failure statistics are compared against the
new failure statistics before the new values are actually read.

Signed-off-by: Harpreet "Eli" Sangha <harpreet@nestlabs.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoubi-utils: Return error code if command line option is unknown
Daniel Wagner [Mon, 12 Jun 2017 10:50:54 +0000 (12:50 +0200)]
ubi-utils: Return error code if command line option is unknown

The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.

We need to return -1 instead of EXIT_FAILURE to be consistent with the
other exit code places.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonor-utils: Return error code if command line option is unknown
Daniel Wagner [Mon, 12 Jun 2017 10:50:52 +0000 (12:50 +0200)]
nor-utils: Return error code if command line option is unknown

The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agojffsX-utils: Return error code if command line option is unknown
Daniel Wagner [Mon, 12 Jun 2017 10:50:42 +0000 (12:50 +0200)]
jffsX-utils: Return error code if command line option is unknown

The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoftl_format: Use return directly to leave main function
Daniel Wagner [Mon, 12 Jun 2017 10:50:49 +0000 (12:50 +0200)]
ftl_format: Use return directly to leave main function

We can use return with the exit code instead of the sliglty odd exit,
return pattern.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoflashcp: Drop exit code defines
Daniel Wagner [Mon, 12 Jun 2017 10:50:48 +0000 (12:50 +0200)]
flashcp: Drop exit code defines

The EXIT_{FAILURE|SUCCESS} are already defined in stdlib.h.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoUse defines for exit code values
Daniel Wagner [Mon, 12 Jun 2017 10:50:43 +0000 (12:50 +0200)]
Use defines for exit code values

Make the usage of exit consist. That is use the pre defined exit
values.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomkfs.ubifs: Add support for symlinks in device table
David Engraf [Tue, 23 May 2017 06:52:52 +0000 (08:52 +0200)]
mkfs.ubifs: Add support for symlinks in device table

It is not possible to change ownership for symlinks in the device table file.
This patch adds support for symlinks equal to mkfs.jffs2 and updates the
sample device table file. The permission entry for symlinks in the device
table must be set to 0777.

Signed-off-by: David Engraf <david.engraf@sysgo.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agolibiniparser: remove unused function needing float
Andrea Adami [Sat, 28 Jun 2014 22:44:57 +0000 (00:44 +0200)]
libiniparser: remove unused function needing float

Fixes:
|   LD      ubi-utils/ubiformat
| .../git/ubi-utils/libiniparser.a(libiniparser.o): In function
| `  LD      ubi-utils/ubirename
| iniparser_getdouble':
| .../git/ubi-utils/libiniparser.c:336: undefined reference to `atof'

Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so
remove it: floating-point is not supported in klibc

Upstream-Status: Pending

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agolibubi.c: add klibc specific fixes for ioctl
Andrea Adami [Sat, 28 Jun 2014 22:40:15 +0000 (00:40 +0200)]
libubi.c: add klibc specific fixes for ioctl

First issue is that ioctl() in klibc doesn't expect a constant as arg3.
Second issue is that arg3 in klibc ioctl() implementation is not optional.

Fixes:

| ubi-utils/libubi.c: In function 'do_attach':
| ubi-utils/libubi.c:698:8: warning: passing argument 3 of 'ioctl' discards
| 'const' qualifier from pointer target type
|   ret = ioctl(fd, UBI_IOCATT, r);
|         ^
| In file included from ubi-utils/libubi.c:32:0:
| .../lib/klibc/include/sys/ioctl.h:15:14: note: expected 'void *' but argument
| is of type 'const struct ubi_attach_req *'
|  __extern int ioctl(int, int, void *);
|               ^

| ubi-utils/libubi.c: In function 'ubi_vol_block_create':
| ubi-utils/libubi.c:1118:9: error: too few arguments to function 'ioctl'
|   return ioctl(fd, UBI_IOCVOLCRBLK);
|          ^
| In file included from ubi-utils/libubi.c:32:0:
| .../lib/klibc/include/sys/ioctl.h:15:14: note: declared here
|  __extern int ioctl(int, int, void *);
|               ^
| ubi-utils/libubi.c: In function 'ubi_vol_block_remove':
| ubi-utils/libubi.c:1123:9: error: too few arguments to function 'ioctl'
|   return ioctl(fd, UBI_IOCVOLRMBLK);
|          ^
| In file included from ubi-utils/libubi.c:32:0:
| .../usr/lib/klibc/include/sys/ioctl.h:15:14: note: declared here
|  __extern int ioctl(int, int, void *);
|               ^

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoReturn correct error number in ubi_get_vol_info1
David Oberhollenzer [Wed, 22 Mar 2017 09:10:23 +0000 (10:10 +0100)]
Return correct error number in ubi_get_vol_info1

If the specified UBI device or volume does not exist, the function
is supposed to set errno to ENODEV.

This patch adds a check to ubi_get_vol_info1 to change the errno
to ENODEV if vol_get_major cannot access the underlying sysfs file,
so the function propperly returns that the device or volume does
not exist, instead of failing with errno set to ENOENT.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoFix libmtd behaviour if MTD is not present on the system
David Oberhollenzer [Wed, 15 Mar 2017 10:26:38 +0000 (11:26 +0100)]
Fix libmtd behaviour if MTD is not present on the system

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 <david.oberhollenzer@sigma-star.at>
8 years agoFix build with musl
Khem Raj [Tue, 6 Oct 2015 23:51:34 +0000 (23:51 +0000)]
Fix build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoReplace rpmatch() usage with checking first character of line
David Oberhollenzer [Thu, 2 Mar 2017 10:40:36 +0000 (11:40 +0100)]
Replace rpmatch() usage with checking first character of line

This is based on the patch from Khem Raj used by openembedded. In
addition to the original patch, this also removes the fallback
implementation that was provided for C libraries that don't implement
rpmatch.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoFix alignment trap triggered by NEON instructions
Yuanjie Huang [Thu, 2 Mar 2017 09:43:56 +0000 (10:43 +0100)]
Fix alignment trap triggered by NEON instructions

NEON instruction VLD1.64 was used to copy 64 bits data after type
casting, and they will trigger alignment trap.
This patch uses memcpy to avoid alignment problem.

Signed-off-by: Yuanjie Huang <Yuanjie.Huang@windriver.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: Support jffs2 flash-erase for large OOB (>32b)
Manikandan Ramachandran [Thu, 6 Aug 2015 18:38:14 +0000 (11:38 -0700)]
mtd-utils: Support jffs2 flash-erase for large OOB (>32b)

"flash_erase" fails on nand flash with JFFS2 that has OOB size greater than
32 bytes. "flash_erase" uses "MEMGETOOSEL" to determine OOB size. This ioctl
call is obsolete and returns error if OOB size is more than 32 bytes.

This patch fixes this issue by using "mtd_write" to update clean-marker
instead of mtd_oob_write. This fix is based on the discussion:
http://lists.infradead.org/pipermail/linux-mtd/2011-September/037958.html.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoubi: tests: Speedup io_paral by using rand_r()
Richard Weinberger [Mon, 22 Feb 2016 13:52:05 +0000 (14:52 +0100)]
ubi: tests: Speedup io_paral by using rand_r()

rand() is not thread safe, but glibc seems to use a shared state which is
protected by a mutex. io_paral spawns a few threads and they call rand()
more or less in parallel, which causes heavy lock contention. That
makes the test extremely slow on some setups.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoubi: tests: Support up to 65k NAND page size
Richard Weinberger [Mon, 22 Feb 2016 13:52:04 +0000 (14:52 +0100)]
ubi: tests: Support up to 65k NAND page size

io_read and io_update of mtd-utils support NAND with 4k page size only.
Increase that to support up to 65k page size.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoubi: tests: Replace variable-length array with malloc()
David Gstir [Mon, 22 Feb 2016 13:52:03 +0000 (14:52 +0100)]
ubi: tests: Replace variable-length array with malloc()

io_read and io_update of mtd-utils use variable-length arrays for test data.
Since this could result in allocating many megabytes using alloca(), switch
to malloc().

Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRemove README.udev from ubi-tests extra dist
David Oberhollenzer [Mon, 20 Feb 2017 13:29:28 +0000 (14:29 +0100)]
Remove README.udev from ubi-tests extra dist

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoubirename: trivial fixes to the help text
Luca Ceresoli [Sun, 12 Feb 2017 21:55:54 +0000 (22:55 +0100)]
ubirename: trivial fixes to the help text

Add a missing space after PROGRAM_NAME and fix a typo.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRemove UDEV_SETTLE_HACK
Richard Weinberger [Tue, 26 Apr 2016 21:47:37 +0000 (23:47 +0200)]
Remove UDEV_SETTLE_HACK

UDEV_SETTLE_HACK addresses a problem which does no longer exist on Linux.
These days we have devtmpfs. New devices will automatically created on
the kernel side and user space has no longer to wait for udev.
As udev has a hard dependency on devtmpfs we can depend on it too.
People which don't use udev nor plain devtmpfs are anyways on their own.
Android, I'm looking at you...

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: serve_image: Use PRIdoff_t as format specifier.
Torsten Fleischer [Sat, 11 Feb 2017 16:43:32 +0000 (17:43 +0100)]
mtd-utils: serve_image: Use PRIdoff_t as format specifier.

To be independent on the size of off_t the format specifier determined of
common.h should be used instead of PRIu64.

Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: Fix format specifier definitions for off_t and loff_t.
Torsten Fleischer [Sat, 11 Feb 2017 16:43:31 +0000 (17:43 +0100)]
mtd-utils: Fix format specifier definitions for off_t and loff_t.

On 32bit systems (e.g. ARM) the size of off_t can be 4 byte and the size of loff_t 8 byte.

This causes compiler warnings like the following:

flash_erase.c: In function 'show_progress':
flash_erase.c:56:22: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'off_t {aka long int}' [-Wformat=]
  bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ",

and an output like this:

~# flash_erase /dev/mtd2 0 1
Erasing 64 Kibyte @ 6400000000 -- 0 % complete

~#

Since the size of off_t and loff_t can differ from each other, the
printf format specifier should be determined separately for both.
Further the format specifiers should be based directly on the size of the
particular data type.

Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonanddump: Add --skip-bad-blocks-to-start option
Mike Crowe [Tue, 17 Jan 2017 11:54:04 +0000 (11:54 +0000)]
nanddump: Add --skip-bad-blocks-to-start option

The --skip-bad-blocks-to-start option will increase the start address by
the size of each bad block encountered between the start of the partition
and the specified start address.

This can be useful if other readers of the partition will be reading using
a simple bad-block-skipping algorithm.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonandwrite: Add --skip-bad-blocks-to-start option
Mike Crowe [Tue, 17 Jan 2017 11:54:03 +0000 (11:54 +0000)]
nandwrite: Add --skip-bad-blocks-to-start option

The --skip-bad-blocks-to-start option will increase the seek offset by the
size of each bad block encountered between the start of the partition and
the specified start address.

This can be useful when writing part way through a partition that will be
read using a simple bad-block-skipping algorithm.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonandwrite: fix/cleanup bad block skipping
David Oberhollenzer [Wed, 11 Jan 2017 13:02:04 +0000 (14:02 +0100)]
nandwrite: fix/cleanup bad block skipping

JFFS2 supports clustering erase blocks to virtual erase blocks.
nandwrite supports this, but previously mixed up virtual and
physical erase block numbers when checking for bad blocks.

This patch adds a function for checking if a virtual erase block
is bad and replaces the broken mtd_is_bad loop.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonandwrite: replace erase loop with mtd_erase_multi
David Oberhollenzer [Wed, 11 Jan 2017 10:53:51 +0000 (11:53 +0100)]
nandwrite: replace erase loop with mtd_erase_multi

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonandwrite: add stricter sanity checking for blockalign
David Oberhollenzer [Wed, 11 Jan 2017 10:45:18 +0000 (11:45 +0100)]
nandwrite: add stricter sanity checking for blockalign

This patch makes sure that a virtual erase block is always
composed of a postivie number of erase blocks (i.e. 1 or more)
and enforces the block alignment to be a power of two as
suggested by the help text and assumed throughout the program.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRelease mtd-utils-2.0.0 v2.0.0
David Oberhollenzer [Thu, 22 Dec 2016 10:21:37 +0000 (11:21 +0100)]
Release mtd-utils-2.0.0

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: Add configure switches to disable jffsX or ubifs tools
David Oberhollenzer [Wed, 21 Dec 2016 14:42:12 +0000 (15:42 +0100)]
mtd-utils: Add configure switches to disable jffsX or ubifs tools

For some applications, like building a root filesystem for an embedded
device, it may be desireable to only build and install a subset of the
mtd-utils. This can be done throught the targets of the generated
Makefile and hand picking executables, however the jffsX and ubifs
utilities have external build dependencies that may not be needed.

This patch adds configure switches to disable building the jffsX and
ubifs utilities. Their respective build dependencies (zlib, lzo, uuid)
are only requested if the tools are being built.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Richard Weinberger <richard@nod.at>
8 years agoRelease mtd-utils-2.0.0-rc2 v2.0.0-rc2
David Oberhollenzer [Wed, 14 Dec 2016 16:05:35 +0000 (17:05 +0100)]
Release mtd-utils-2.0.0-rc2

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoEnable tests so they are included in the make dist target
David Oberhollenzer [Wed, 14 Dec 2016 16:04:24 +0000 (17:04 +0100)]
Enable tests so they are included in the make dist target

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agomtd-utils: Correct casting for final status report in flashcp
Jonathan Fether [Wed, 14 Dec 2016 02:00:28 +0000 (18:00 -0800)]
mtd-utils: Correct casting for final status report in flashcp

Add correct casting for filestat.st_size in flashcp.c. While the
interim status updates had correct casting from commit 08b243, the
final update was not.

Signed-off-by: Jonathan Fether <jonf@mds.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoFix packaging of unit test files
David Oberhollenzer [Mon, 12 Dec 2016 10:31:59 +0000 (11:31 +0100)]
Fix packaging of unit test files

Previously, the unit test sysfs mock files and headers were not
added to the distribution packag. Not packaging the header leads
to compilation of the unit tests failing. Not packaging the stub
files caueses the unit tests themselves to fail.

This patch explicitly adds the header and sysfs mock files to the
distribution target, allowing the unit tests to be used outside
the git tree.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agonandwrite: Factor out buffer checking code
Marek Vasut [Fri, 9 Dec 2016 01:47:41 +0000 (02:47 +0100)]
nandwrite: Factor out buffer checking code

Pull the buffer content checking code into separate function and
simplify the code invoking it slightly.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRelease mtd-utils-2.0.0-rc1 v2.0.0-rc1
David Oberhollenzer [Wed, 7 Dec 2016 14:04:48 +0000 (15:04 +0100)]
Release mtd-utils-2.0.0-rc1

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agocommon: Fix 'unchecked return code' warnings
Boris Brezillon [Fri, 25 Nov 2016 17:30:41 +0000 (18:30 +0100)]
common: Fix 'unchecked return code' warnings

Several tools are simply not checking return code of functions marked
with 'warn_unused_result'.

Provide wrappers for the read/write functions to avoid patching old
code and providing proper error handling.
Fix the remaining ones (calls to fgets() and system()).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agocommon: Fix PRI{x,d}off definitions for x86_64 platform
Boris Brezillon [Fri, 25 Nov 2016 17:30:40 +0000 (18:30 +0100)]
common: Fix PRI{x,d}off definitions for x86_64 platform

Compiling for x86_64 generates a lot of warning because the PRIxoff_t and
PRIdoff_t are not properly defined, which comes from the missing
SIZEOF_LONG definition.

Use the autotools to generate a config.h header, include this header from
common.h and ask autoheader to generate the SIZEOF_LONG and SIZEOF_LOFF_T
definitions.
Use these new definitions to assign the proper descriptors to PRIxoff_t
and PRIdoff_t.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agonandwrite: add skip-all-ff-pages-option
Kees Trommel [Tue, 6 Dec 2016 08:21:19 +0000 (09:21 +0100)]
nandwrite: add skip-all-ff-pages-option

Signed-off-by: Kees Trommel <ctrommel@linvm302.aimsys.nl>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoDefine WITHOUT_XATTR if sys/acl.h or sys/xattr.h is missing
David Oberhollenzer [Tue, 29 Nov 2016 21:31:11 +0000 (22:31 +0100)]
Define WITHOUT_XATTR if sys/acl.h or sys/xattr.h is missing

The programs mkfs.jffs2 and mkfs.ubifs include those two headers if
WITHOUT_XATTR is not defined. Up to now, this macro is only defined
if the configure script is run with --without-xattr. If the headers
are not present on a system and the configure script is run without
special flags set, the build fails.

This patch adds a check for the presence of those headers and disables
the feature if one of the headers is missing.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoAllow version string to have a release candidate suffix
David Oberhollenzer [Thu, 17 Nov 2016 14:55:27 +0000 (15:55 +0100)]
Allow version string to have a release candidate suffix

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoMove ubi-utils libraries to common library location
David Oberhollenzer [Thu, 1 Sep 2016 13:52:33 +0000 (15:52 +0200)]
Move ubi-utils libraries to common library location

Historically, the mtd-utils and ubi-utils were seperate packages. The
ubi-utils were at some point merged into the mtd-utils. They first
appeared in the release tar-ball in version 1.1.0 in their own
sub-hirarchy with their own buildsystem, readme, documentation, etc.
A lot of the duplicated stuff got centralized/removed over time.

This patch further cleans up the directory hirarchy duplication by
moving common libraries from the ubi-utils/ into the central lib/
and include/ directories in the top directory of the mtd-utils package.

This includes:
 - libuib.a & libubigen.a used by the ubi utilities
 - libscan.a currently only used by ubiformat
 - libiniparser.a used by ubinize

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoMerge rest of ubiutils-common into libmtd common
David Oberhollenzer [Thu, 1 Sep 2016 13:27:38 +0000 (15:27 +0200)]
Merge rest of ubiutils-common into libmtd common

This patch moves the remaining 3 functions from ubiutils-common.{c,h}
into libmtd common.{c,h}.

The functions are only generic utility functions that other mtd-utils
programs may also find usefull and every program that uses libubi links
against libmtd anyway so there is no real reason for keeping around a
seperate ubiutils-common with only generic helper functions.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRemove unused ubiutils_print_text from ubi-utils common
David Oberhollenzer [Thu, 1 Sep 2016 13:08:06 +0000 (15:08 +0200)]
Remove unused ubiutils_print_text from ubi-utils common

The function ubiutils_print_text was previously used by ubinize to
pretty-print parts of the help text. Since the help text has been
moved to a man page, the function is no longer used/needed.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoAdd ubinize manpage
David Oberhollenzer [Thu, 1 Sep 2016 13:03:14 +0000 (15:03 +0200)]
Add ubinize manpage

This patch removes the lengthy help text from the ubinize utility
that attempted to describte the file format and every minor detail,
and reformats it into a more readable man page.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoAdd Makefile for unittests
Daniel Walter [Wed, 31 Aug 2016 08:11:14 +0000 (10:11 +0200)]
Add Makefile for unittests

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoAdd unittests for libubi
Daniel Walter [Wed, 31 Aug 2016 08:09:15 +0000 (10:09 +0200)]
Add unittests for libubi

Add unittests for most functions provided by
libubi

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
8 years agoAdd unittest for libmtd
Daniel Walter [Wed, 31 Aug 2016 08:08:30 +0000 (10:08 +0200)]
Add unittest for libmtd

unit tests for most functions provided by
libmtd.

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
8 years agoAdd sysfs tree for unittests
Daniel Walter [Wed, 31 Aug 2016 08:09:37 +0000 (10:09 +0200)]
Add sysfs tree for unittests

add mocked sysfs used by libmtd and libubi
unittests

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
8 years agoAdd support for sysfs mocking
Daniel Walter [Wed, 31 Aug 2016 08:05:36 +0000 (10:05 +0200)]
Add support for sysfs mocking

In order to use test files, allow sysfs root
to be set during compile time

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
8 years agoAdd unit test helpers
Daniel Walter [Wed, 31 Aug 2016 08:10:55 +0000 (10:10 +0200)]
Add unit test helpers

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
8 years agoFix uninitialized buffers
Daniel Walter [Wed, 31 Aug 2016 08:06:28 +0000 (10:06 +0200)]
Fix uninitialized buffers

Uninitialized buffers lead to failing
unittests, since padding was not set to 0.
Additionally this stops valgrind from complaining as well.

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
8 years agomtd-utils: Add nand sub-page test utility
David Oberhollenzer [Mon, 22 Aug 2016 14:21:57 +0000 (16:21 +0200)]
mtd-utils: Add nand sub-page test utility

Basically a user space port of the mtd sub page test kernel module.
In addition to the module parameters, the utility supports using
only a sub-range of the flash erase blocks with a configurable
stride and can restore the block contents after the test.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add nand page test utility
David Oberhollenzer [Mon, 22 Aug 2016 14:19:55 +0000 (16:19 +0200)]
mtd-utils: Add nand page test utility

Basically a user space port of the mtd page test kernel module.
In addition to the module parameters, the utility supports using
only a sub-range of the flash erase blocks with a configurable stride.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add flash read test utility
David Oberhollenzer [Mon, 22 Aug 2016 14:14:37 +0000 (16:14 +0200)]
mtd-utils: Add flash read test utility

Basically a user space port of the mtd read test kernel module.
In addition to the module parameters, the utility can scan only
a sub-range of the flash erase block with a configurable stride.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add nand flash bit errors test
David Oberhollenzer [Mon, 22 Aug 2016 14:12:20 +0000 (16:12 +0200)]
mtd-utils: Add nand flash bit errors test

Basically a user space port of the mtd speed test kernel module.
In addition to the module parameters, the utility can resture
the block contents after test and allows setting the maxium writes
for the test.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add flash speed test utility
David Oberhollenzer [Mon, 22 Aug 2016 14:10:16 +0000 (16:10 +0200)]
mtd-utils: Add flash speed test utility

Basically a user space port of the mtd speed test kernel module.
In addition to the block offset and count module parameters, the
utility supports a block stride and can restore the block contents
after test. Furthermore, a flag can be used to disable destructive
tests (i.e. only perform read speed tests).

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add flash stress test utility
David Oberhollenzer [Mon, 22 Aug 2016 14:08:34 +0000 (16:08 +0200)]
mtd-utils: Add flash stress test utility

Basically a user space port of the mtd stress test kernel module.
In addition to the block offset and count module parameters, the
utility supports a block stride and can restore the block contents
after test.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add flash torture test utility
David Oberhollenzer [Mon, 22 Aug 2016 14:05:19 +0000 (16:05 +0200)]
mtd-utils: Add flash torture test utility

Basically a user space port of the mtd torture test kernel module. In
addition to the block offset and count module parameters, the utility
supports a block stride and can restore the block contents after test.

In contrast to the kernel module, the torture test is implemented by
the libmtd mtd_toruture function and thus doesn't allow for similarly
fine grained options on diagnostics.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agomtd-utils: Add multi-block erase function
David Oberhollenzer [Mon, 25 Apr 2016 22:13:23 +0000 (00:13 +0200)]
mtd-utils: Add multi-block erase function

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoAdd libmissing
David Oberhollenzer [Thu, 1 Sep 2016 09:20:05 +0000 (11:20 +0200)]
Add libmissing

This patch adds a libmissing library to mtd-utils, containing
implementations of functionality found in glibc but typically
missing from embedded C libraries such as uclibc ot musl.

For now, the library only contains stub implementations of
the backtrace*() family of functions.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoAdd -lrt for clock_gettime() in glibc < 2.17.
David Gstir [Thu, 15 Sep 2016 05:20:07 +0000 (07:20 +0200)]
Add -lrt for clock_gettime() in glibc < 2.17.

Some tools use clock_gettime() which requires building with -lrt for
versions of glibc before 2.17.

Signed-off-by: David Gstir <david@sigma-star.at>
8 years agoFix make_a_release script
David Oberhollenzer [Thu, 21 Jul 2016 13:29:12 +0000 (15:29 +0200)]
Fix make_a_release script

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoFix paths in .gitignore and add autotools generated files
David Oberhollenzer [Tue, 19 Jul 2016 13:30:53 +0000 (15:30 +0200)]
Fix paths in .gitignore and add autotools generated files

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoUnify version string printing
David Oberhollenzer [Tue, 19 Jul 2016 13:06:58 +0000 (15:06 +0200)]
Unify version string printing

When a program does sophisticated enough command line processing
(i.e. getopt), make sure it responds to -V and --version.

When a program prints a version string, make sure it uses the
common_print_version macro to print out its name, that it is part
of mtd-utils and the mtd-utils version from the build system in a
fashion similar to common program packages like the GNU coreutils.

When a program responds to -V/--version or -h/--help, make sure it
reports success exit status.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoIntegrate tests into autotools build system
David Oberhollenzer [Wed, 13 Jul 2016 14:10:28 +0000 (16:10 +0200)]
Integrate tests into autotools build system

Add automake files for the test binaries. If configured to do so,
install the test binaries to libexec/mtd-utils and use autoconf to
fix the paths in the test scripts.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoChange build system to autotools
Richard Weinberger [Tue, 26 Apr 2016 20:09:08 +0000 (22:09 +0200)]
Change build system to autotools

This patch is largely based on Richards original RFC.

The major differences to the RFC patch are:
 - Add missing sumtools & mtdpart targets
 - Fix name of mkfs.jffs2 target
 - Add missing subdir-objects option for non-recursive make
 - Move all automake options to configure.ac
 - Add manpages to install target
 - Make XATTR & LZO support configurable
 - Install binaries to sbin directory like in the old build system
 - Install flash_erase wrapper script
 - Add files missing from distribution target

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoRemove feature-removal-schedule.txt
David Oberhollenzer [Thu, 1 Sep 2016 15:47:48 +0000 (17:47 +0200)]
Remove feature-removal-schedule.txt

This patch removes the old feature-removal-schedule.txt file from
mtd-utils, mostly for reasons similar to the ones that lead to the
decision of removing the feature-removal-schedule.txt from the kernel.

Removing features by itself is rather problematic as there is no
simple way of estimating whether something is being used widley or
not at all. Thus, consensus usually tends towards not removing
features at all.

Even if there is a file anouncing feature removal, users in large
won't read this file _if_ it is even included in distribution
packages. People working on mtd-uils would end up removing features
that _they_ find useless and users would start complaining once
their setups break after they install a new version of mtd-utils.

In conclusion, once introduced, features should not be removed to
begin with and this file is entirely usless.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 years agoRemove duplicate copies of GPLv2 license text
David Oberhollenzer [Tue, 23 Aug 2016 13:40:44 +0000 (15:40 +0200)]
Remove duplicate copies of GPLv2 license text

Some of the programs in the mtd-utils used to be seperate packages that
were at some point merged into mtd-utils. As a result, some subdirectories
contain their own README and COPYING files with copies of the GPLv2
license text.

Since those programs are now part of mtd-utils that contains a copy of the
GPLv2 in the file COPYING in the package root directory, those extra files
can be removed, as there is no need for distributing an extra copy of the
license text for each individual program in the bundle.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoRemove RPM spec file
David Oberhollenzer [Tue, 23 Aug 2016 10:17:28 +0000 (12:17 +0200)]
Remove RPM spec file

Building packages for distributions is typically something highly
distribution specific. While there are widely used package formats
like RPM, implementing a de-facto standard, the build process,
list of files actually packaged, list of required dependencies,
package grouping, package versioning, etc... is still _very_
distribution specific. In fact, this spec file completely fails to
address some of these points.

Actual RPM based distributions out there currently use their own,
distribution specific, RPM spec files that were possibly _based_ on
this one at some point (judging from similar descriptions).

The spec file _may_ have worked at some point, but it definitely doesn't
work with the new build system and there is no real reason to fix it
(which, by definition, isn't possible for the reasons above) and drag it
along for another decade or two.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoRemove unused and broken mtd_write_img function from libmtd
David Oberhollenzer [Thu, 25 Aug 2016 11:41:50 +0000 (13:41 +0200)]
Remove unused and broken mtd_write_img function from libmtd

The function _tries_ to support short reads but doesn't adjust the
pointer into the buffer. If a short read happens, we scrambles the
flash contents. Interrupted reads aren't handled. Short or
interrupted writes aren't handled at all. Either a write succeeds
writing the entire buffer or the function gives up.

During an attempt at fixing it, it was discovered, that no mtd-utils
program uses this function. Furthermore, its highly specific nature
makes it more of a "feature looking for use case".

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoRemove unused legacy_libmtd_open internal libmtd function
David Oberhollenzer [Thu, 25 Aug 2016 11:38:20 +0000 (13:38 +0200)]
Remove unused legacy_libmtd_open internal libmtd function

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoRemove jffs-dump.c
David Oberhollenzer [Tue, 23 Aug 2016 11:12:06 +0000 (13:12 +0200)]
Remove jffs-dump.c

This _entire_ file is dead code. The download packages on the FTP
server contain it all the way back to mtd-utils 1.0, but it isn't
built in any of them. The git history (which dates back to 2006)
contains no instance where that file was ever used in a build process.
A quick look at various distribution packages didn't reveal any that
contained a jffs-dump utilty. There have been no major changes to this
file since the initial commit. It won't even compile as it doesn't have
a PROGRAM_NAME defined required by common.h at least since 2010.

At this point, it can be safeley assumed that nobody will miss this.
They had at least 10 years to do something about it.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
8 years agoEliminate warnings about implicit non-const casting in libmtd
David Oberhollenzer [Tue, 23 Aug 2016 08:51:21 +0000 (10:51 +0200)]
Eliminate warnings about implicit non-const casting in libmtd

The mtd_get_dev_info1 function reads (among other things) name and type
string into coresponding struct mtd_dev_info fields.

The struct mtd_dev_info has the string fields marked const, requiring
them to be cast to non-const version during initialization.

This cast was previously omitted from the dev_read_data calls,
triggering warnings during compilation.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>