Age | Commit message (Collapse) | Author |
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
If we build mtd-utils outside the source path, we cannot use relative
paths to refere to headers in the source tree. We have to specify
absoulte paths using the top_srcdir variable.
This was done right for the utility binaries, but overlooked for the
unit test porgrams.
This patch fixes the header paths and SYSROOT variable for the unit
tests, so they build and run propperly outside the source tree.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Currently, Jffs2 clean marker is not written actually, because the oob
write length is set to 0 when do mtd_write().
So, get OOB available size at first, and set the correct clean marker
length, then program clean marker to free OOB area.
Fixes: d7e86124d55b ("mtd-utils: Support jffs2 flash-erase for large OOB (>32b)")
Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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 <xiaolei.li@mediatek.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Fixes: 1d04b4d5361a ("fix build when WITHOUT_LZO is set")
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
When using a local root folder the permissions, user and group settings
are taken from the local folder. These permissions might be incorrect if
the folder has been created for the local user. Creating an UBIFS image
on my local system resulted in the following output on the target:
drwx------ 17 1000 1000 1264 Jan 1 00:00 .
drwx------ 17 1000 1000 1264 Jan 1 00:00 ..
drwxr-xr-x 2 root root 9104 May 30 2017 bin
drwxr-xr-x 7 root root 2760 Jan 1 00:00 dev
...
mkfs.ubifs aborts with an error message when the device table contains
a root entry. This patch allows setting the root folder permissions,
user and group to overwrite local configurations.
Signed-off-by: David Engraf <david.engraf@sysgo.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
When there is only a single erase block, the cross erase test
does not report sensible errors. Warn in case there is only
a single erase block instead of executing the test.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Sometimes __xstat is called instead that makes tests fragile.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: Balint Reczey <balint.reczey@canonical.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This fixes tests on s390x
Signed-off-by: Balint Reczey <balint.reczey@canonical.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Do not cast percent to double, it is just used as upper limit.
Avoid floating point to fix compilation for aarch64 against klibc:
error: '-mgeneral-regs-only' is incompatible with floating-point code
| int percent = ((double)si->ok_cnt)/si->good_cnt * 100;
| ^~~~~~~
Notes:
* The checks in the code above this line ensure that si->good_cnt is not 0.
* The code assumes si->good_cnt * 100 will not overflow, then we can use
(si->ok_cnt * 100) safely because the former is bigger.
* The truncated result does not affect the logic:
i.e. a value of 49.9 is truncated to 49 and is still <50.
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
We use floating point just to print out KiB, MiB, GiB.
Avoid that to be klibc friendly.
Fixes compilation for aarch64 against klibc:
error: '-mgeneral-regs-only' is incompatible with floating-point argument
| printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024));
etc.
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
If the number of erase blocks to use is not specified, ebcnt originally
set to -1 leads the program to exit with:
"Cannot run with less than two blocks."
If the number of erase blocks to use is not specified and thus ebcnt is
equal to -1, the expected behaviour is to perform the test on all the
erase blocks of the mtd partition.
This fixes the change introduced in
4458ad6481f60d9884925d5bc62a7954880d181b.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: Rock Lee <rockdotlee@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: Rock Lee <rockdotlee@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
When a command line option is used (e.g. --version), the tool
tries to open it as a file first, then *uppon success* attempts
to process the command line options (including what it assumed
to be an input file) which is obviously broken.
This patch moves command line processing first and then attempts
to open *the first unprocessed* argument.
Reported-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
When porting some of the mtd-tests to user space, some code was
simplified. Among others, a while loop that iterates of page contents
was replaced with a for loop, but the old increment was left in place,
so every second byte was skipped.
This patch removes the erroneous second increment.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Use casts to void instead. Clang generates warnings about that by
default.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|