Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
"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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
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>
|