]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
14 years agoserve_image: adjust classifier and type for printf
Andy Shevchenko [Wed, 20 Apr 2011 09:35:10 +0000 (12:35 +0300)]
serve_image: adjust classifier and type for printf

The argument type of printf is __off64_t, meanwhile the classifier is "%ld".
We agreed to use PRIu64 in such case.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: use PRIu64 classifier for uint64_t printf arguments
Andy Shevchenko [Wed, 20 Apr 2011 09:35:09 +0000 (12:35 +0300)]
libmtd: use PRIu64 classifier for uint64_t printf arguments

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: fix casting of __off64_t
Andy Shevchenko [Wed, 20 Apr 2011 09:35:08 +0000 (12:35 +0300)]
mkfs.jffs2: fix casting of __off64_t

The casting of __off64_t to unsigned long potentially wrong for values higher
than ULONG_MAX.  Let's fix that by using PRIu64 classifier.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not expect max name length to be 256
Artem Bityutskiy [Wed, 13 Apr 2011 14:21:05 +0000 (17:21 +0300)]
fs-tests: integck: do not expect max name length to be 256

The 'make_name()' function assumes that the maxumum file name length
is 256 bytes, which is wrong. This patch fixes this.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: implement own version of CHECK
Artem Bityutskiy [Wed, 13 Apr 2011 14:09:36 +0000 (17:09 +0300)]
fs-tests: integck: implement own version of CHECK

Remove the final dependency on the common code - the CHECK() macro.
Now we are finally independent. The reason we needed this is that
we are going to improve integck to handle errors more gracefully,
in order to support failure testing better. And this requires changes
in the common code, but it is ancient and shared by many tests, and
we do not want to touch it. So we better make integck independent
and concentrate on integck only.

This patch also removes Makefile dependencies. And while on it, remove
the broken 'tests' target.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use tests_random_no
Artem Bityutskiy [Wed, 13 Apr 2011 13:49:20 +0000 (16:49 +0300)]
fs-tests: integck: do not use tests_random_no

Do not use the shared 'tests_random_no()' function but use our own
simple implementation instead. We do not need those rather complex
and difficult to understand computations.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use global common variables
Artem Bityutskiy [Wed, 13 Apr 2011 13:28:06 +0000 (16:28 +0300)]
fs-tests: integck: do not use global common variables

Do not use the 'tests_file_system_mount_dir' and 'tests_file_system_type'
variables because we do not depend on them any longer.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use tests_get_total_space
Artem Bityutskiy [Wed, 13 Apr 2011 13:25:28 +0000 (16:25 +0300)]
fs-tests: integck: do not use tests_get_total_space

Do not use the common tests_get_total_space but extend our own
get_free_space function and make it return both free and total
amount of space.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use tests_remount
Artem Bityutskiy [Wed, 13 Apr 2011 13:15:06 +0000 (16:15 +0300)]
fs-tests: integck: do not use tests_remount

Implement our own version of 'tests_remount()' instead of depending
on the common implementation.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use tests_fs_is_rootfs
Artem Bityutskiy [Wed, 13 Apr 2011 12:06:18 +0000 (15:06 +0300)]
fs-tests: integck: do not use tests_fs_is_rootfs

Do not use the shared 'tests_fs_is_rootfs()' function - introduce
'fsinfo.is_rootfs' flag and utilize it instead. This is another step
forward the goal to make integck independent of the common code.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: prefer to check for success
Artem Bityutskiy [Wed, 13 Apr 2011 11:27:34 +0000 (14:27 +0300)]
fs-tests: integck: prefer to check for success

Many of standard C libraries return 0 on success and -1 on failure.
Currently integck mostly checks for failure by comparing with -1, like:

CHECK(fsync(fd) != -1) /* Don't die if not failure */

but in some places the check is like

CHECK(fsync(fd) == 0) /* Don't die if success */

This patch harmonizes this an makes integck to use the second style
which seems to be more logical. Besides, the binary is smaller in
this case:

[dedekind@eru fs-tests (master)]$ size integrity/integck-old
   text    data     bss     dec     hex filename
  44677    1200   37408   83285   14555 integrity/integck
[dedekind@eru fs-tests (master)]$ size integrity/integck-new
   text    data     bss     dec     hex filename
  44661    1200   37408   83269   14545 integrity/integck

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use space after cast
Artem Bityutskiy [Wed, 13 Apr 2011 11:09:47 +0000 (14:09 +0300)]
fs-tests: integck: do not use space after cast

Since we are kernel people lets use the style we are accustomed
to - no space between the cast and the variable: (type)a, not (type) a.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use tests_clear_dir
Artem Bityutskiy [Tue, 12 Apr 2011 13:22:35 +0000 (16:22 +0300)]
fs-tests: integck: do not use tests_clear_dir

Do not use shared 'tests_clear_dir()' function which removes a directory
tree recursively, but instead use own implementation. This is because
I'm trying to make integck independend on the shared code because I
need this to do further improvements.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: clean up test directory creation
Artem Bityutskiy [Tue, 12 Apr 2011 12:15:53 +0000 (15:15 +0300)]
fs-tests: integck: clean up test directory creation

Move the test directory name to the fsinfo structure and do few
other cleanups while on it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not use tests_cat_pid
Artem Bityutskiy [Tue, 12 Apr 2011 11:36:57 +0000 (14:36 +0300)]
fs-tests: integck: do not use tests_cat_pid

Do not use the shared 'tests_cat_pid' function but use a simple
sprintf instead. This is another step to make integck independent
of the common code.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: remove trailing backslashes from mount point
Artem Bityutskiy [Tue, 12 Apr 2011 11:29:08 +0000 (14:29 +0300)]
fs-tests: integck: remove trailing backslashes from mount point

The test is not working if the user specified mount point with a trailing
back-slash at the end. Note, this had not worked before my changes as well.
Fix this.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: move log10_initial_free to fsinfo
Artem Bityutskiy [Tue, 12 Apr 2011 11:03:09 +0000 (14:03 +0300)]
fs-tests: integck: move log10_initial_free to fsinfo

Similarly to the previous patches, move the log10_initial_free variable
to the fsinfo data structure.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: add own get_free_space function
Artem Bityutskiy [Tue, 12 Apr 2011 09:25:32 +0000 (12:25 +0300)]
fs-tests: integck: add own get_free_space function

Do not use the shared 'tests_get_free_space' function but use own
implementation instead. This is another step to make integck independent
on the common infrastructure.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: move more variables to fsinfo
Artem Bityutskiy [Tue, 12 Apr 2011 09:10:58 +0000 (12:10 +0300)]
fs-tests: integck: move more variables to fsinfo

Aggregate all the information about the tested file-system in
the fsinf object for better readability and cleanness. Move
'can_mmap' and 'check_nospc_files' there as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: move mem_page_size to fsinfo
Artem Bityutskiy [Tue, 12 Apr 2011 09:00:22 +0000 (12:00 +0300)]
fs-tests: integck: move mem_page_size to fsinfo

The fsinfo structure will aggregate all the information about the
tested file-system. Move 'mem_page_size' which we use for 'mmap()'
there as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: make integck function return error
Artem Bityutskiy [Tue, 12 Apr 2011 08:46:20 +0000 (11:46 +0300)]
fs-tests: integck: make integck function return error

Turn the 'void integck(void)' function into 'static int integck(void)'.
We need to teach the test to gracefully handle some error cases like
'EROFS' instead of failing and exiting straight away. And the ground
work for this is making all functions return errors. This is the first
tiny step in this direction.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: get rid of tests_check_test_file_system
Artem Bityutskiy [Mon, 11 Apr 2011 16:14:06 +0000 (19:14 +0300)]
fs-tests: integck: get rid of tests_check_test_file_system

Stop using the shared 'tests_check_test_file_system()' function but
instead, use own independed version of this function. This is another
step forward the goal to make integck independent of the common
shared code.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: clean-up copy_string
Artem Bityutskiy [Mon, 11 Apr 2011 15:30:57 +0000 (18:30 +0300)]
fs-tests: integck: clean-up copy_string

This is a clean-up patch which:
1. Simplifies copy_string by useng strdup instead of malloc
2. Adds an assertion which checks the input parameter agains NULL,
   instead of checking it.
3. Re-names it to dup_string which looks more readable to me.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: implement own parameters parsing
Artem Bityutskiy [Fri, 8 Apr 2011 16:02:04 +0000 (19:02 +0300)]
fs-tests: integck: implement own parameters parsing

Instead of using shared command line arguments parsing routine
implement own. The reason is that I want to add more parameters,
which are integck-specific. Also, longer-term plan is to make
integck independent of the common tests.c file.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: change tests defaults
Artem Bityutskiy [Mon, 11 Apr 2011 13:57:53 +0000 (16:57 +0300)]
fs-tests: integck: change tests defaults

Currently integck assumes that by default the file-system cannot
do shared writable mmap-ing and does not preserve accurate file
size after ENOSPC errors. And then it overrides these default
settings if this is UBIFS.

But it seems that only JFFS2 has those limitations. So make the
defaults to be the opposite and override them for JFFS2 only.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: shrink write_info even more
Artem Bityutskiy [Mon, 11 Apr 2011 11:55:49 +0000 (14:55 +0300)]
fs-tests: integck: shrink write_info even more

The 'struct write_info' data strucutre records information about
truncation, and has a separate integer field to specify if this is
a truncation or not. But it is too wasteful because we have huge
amount of these objects.

But it is easy to notice that the 'random_seed' field is not used
for truncation records, so we can use that as the truncation flag.

This patch introduces MAX_RANDOM_SEED macro and when the 'random_seed'
field is greater than that, we treat it as the truncation flag.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: abuse random_offset field nicer
Artem Bityutskiy [Mon, 11 Apr 2011 11:27:46 +0000 (14:27 +0300)]
fs-tests: integck: abuse random_offset field nicer

Currently integck uses the 'random_offset' filed to store the new file
length sometimes, thus abusing this field. But we can do this nicer -
introduce an anonymous union and add 'new_length' filed which will be
used instead of 'random_offset' to make the code look nicer.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: srink file_info structure even more
Artem Bityutskiy [Mon, 11 Apr 2011 10:48:38 +0000 (13:48 +0300)]
fs-tests: integck: srink file_info structure even more

The 'check_run_no' field does not have to be 64-bit, it can be
32-bit instead and we can save 4 bytes per object. Actually, it
could also be 16-bit, and we could make link_count 16-bit as well,
but that would need a bit more work.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: shrink file_info structure size
Artem Bityutskiy [Mon, 11 Apr 2011 10:07:26 +0000 (13:07 +0300)]
fs-tests: integck: shrink file_info structure size

We do not have to store boolean flags in 'int' variables which
consume 4 bytes each, we can store those in bit-fields instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: shrink dir_entry_info structure size
Artem Bityutskiy [Mon, 11 Apr 2011 08:22:48 +0000 (11:22 +0300)]
fs-tests: integck: shrink dir_entry_info structure size

Turn "int checked" flag into 'char' flag to lessen memory
consumption a bit. Indeed, the test allocates a lot of these
data objects, so the size decrease from 36 to 32 bytes on
32-bit platforms is good to have.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: ubi-tests: clean libubi.a and *.o
Andy Shevchenko [Wed, 13 Apr 2011 13:20:29 +0000 (16:20 +0300)]
tests: ubi-tests: clean libubi.a and *.o

The common.mk contains clean target that removes *.o and $(TARGETS). Thus, make
custom clean target only for libubi.a

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: checkfs: adjust Makefile
Andy Shevchenko [Wed, 13 Apr 2011 13:20:28 +0000 (16:20 +0300)]
tests: checkfs: adjust Makefile

This patch brings common Makefile (in terms of mtd-utils project) to the
checkfs test suite. Additionally it fixes a build error related to usage of
open().

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: fs-tests: read() returns ssize_t value
Andy Shevchenko [Wed, 13 Apr 2011 13:20:27 +0000 (16:20 +0300)]
tests: fs-tests: read() returns ssize_t value

Use ssize_t instead of size_t.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: fix casting of printf argument
Andy Shevchenko [Wed, 13 Apr 2011 13:20:25 +0000 (16:20 +0300)]
mkfs.jffs2: fix casting of printf argument

The compiler warns us about cast mismatch for %9lu specifier.  In original code
the argument has __off64_t type. Here is a simple type casting fix.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: use common printing macros
Artem Bityutskiy [Fri, 8 Apr 2011 13:25:51 +0000 (16:25 +0300)]
fs-tests: integck: use common printing macros

Instead of using printf() directly, use the shared mtd-utils printing
macros.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: include the common mtd-utils header
Artem Bityutskiy [Fri, 8 Apr 2011 12:27:03 +0000 (15:27 +0300)]
fs-tests: integck: include the common mtd-utils header

Include the commong mtd-utils "common.h" header in integck test to
make it possible to use shared macros.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: remove unnecessary check
Artem Bityutskiy [Mon, 28 Mar 2011 12:05:18 +0000 (15:05 +0300)]
fs-tests: integck: remove unnecessary check

The 'link_new()' function has only one user, and the user checks
that the third 'file' argument is non NULL, so remove this check
from 'link_new()'. Let's be consistent and assume the 3rd argument
is never NULL, just like the first and the second ones.

This is just a minor improvement.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: simplify dir_entry_info fields
Artem Bityutskiy [Mon, 28 Mar 2011 11:04:10 +0000 (14:04 +0300)]
fs-tests: integck: simplify dir_entry_info fields

Instead of using named union 'entry' in 'struct dir_entry_info'
and having to type long 'entry->entry.file', 'entry->entry.symlink',
etc, use anonymous union which makes the syntax simpler: 'entry->file',
'entry->symlink', etc.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: do not cast void pointers
Artem Bityutskiy [Mon, 28 Mar 2011 10:24:57 +0000 (13:24 +0300)]
fs-tests: integck: do not cast void pointers

The malloc function returns 'void *', so it is not necessary to
cast it when assigning. This is just a small clean-up patch.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: introduce zalloc
Artem Bityutskiy [Mon, 28 Mar 2011 10:22:26 +0000 (13:22 +0300)]
fs-tests: integck: introduce zalloc

The integck test often allocates memory and fills it with zeroes.
Introduce a helper function for this frequent operation.

This is just a clean-up patch which makes the code 23 lines shorter.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: switch ubi and ubifs tools to use common strtoX funcs
Artem Bityutskiy [Fri, 8 Apr 2011 14:58:55 +0000 (17:58 +0300)]
mtd-utils: switch ubi and ubifs tools to use common strtoX funcs

Instead of using strtol and Co directly, use our share simple_strtoX()
helpers. This is just a cleanup.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: improve simple_strtoX usage commentary
Artem Bityutskiy [Fri, 8 Apr 2011 15:05:10 +0000 (18:05 +0300)]
mtd-utils: improve simple_strtoX usage commentary

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs_tests: make the test-suite finish faster
Artem Bityutskiy [Fri, 8 Apr 2011 14:09:45 +0000 (17:09 +0300)]
fs_tests: make the test-suite finish faster

Currently the stress tests may run up to 1 hour, make the limit
to be 6 minutes instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: Makefile: introduce cscope target
Artem Bityutskiy [Fri, 8 Apr 2011 12:09:43 +0000 (15:09 +0300)]
mtd-utils: Makefile: introduce cscope target

Add a "cscope" target to make it easier to develop in the repository.
Indeed, many people like me are accustomed to "make cscope" in the
kernel, and it is very convenient to have this in mtd-utils as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoMakefile: introduce new target tests in Makefile
Andy Shevchenko [Thu, 7 Apr 2011 13:10:38 +0000 (16:10 +0300)]
Makefile: introduce new target tests in Makefile

This patch appends Makefile to the tests subdirectory and introduces tests
target in the root Makefile.

Additionally the clean target removes temporary stuff under tests subdirectory
as well.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: jittertest: fix set of compiler warnings
Andy Shevchenko [Tue, 5 Apr 2011 14:32:29 +0000 (17:32 +0300)]
tests: jittertest: fix set of compiler warnings

- time() was used without prototype.
- the return value of read() and write() wasn't checked
- classificator in printf() was wrong for argument of size_t type

Don't continue to read the /proc/profile in case when write was failed.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: ubi-tests: seed_random_generator() was used w/o prototype
Andy Shevchenko [Tue, 5 Apr 2011 13:55:54 +0000 (16:55 +0300)]
tests: ubi-tests: seed_random_generator() was used w/o prototype

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: fs-tests: check return value of functions
Andy Shevchenko [Tue, 5 Apr 2011 13:55:52 +0000 (16:55 +0300)]
tests: fs-tests: check return value of functions

chdir() returns negative value in case of error.
fscanf() returns amount of successfully parsed parameters.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: checkfs: fix linker warnings
Andy Shevchenko [Tue, 5 Apr 2011 13:55:51 +0000 (16:55 +0300)]
tests: checkfs: fix linker warnings

The sys_errlist[errno] is deprecated. We should use strerror(errno) instead.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: checkfs: fix compiler warnings
Andy Shevchenko [Tue, 5 Apr 2011 13:55:50 +0000 (16:55 +0300)]
tests: checkfs: fix compiler warnings

There are two warnings:
 - strlen() is used without prototype
 - argument of printf() is unsigned long, but used specifier is for int

This patch fixes them.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agotests: make jittertest buildable
Andy Shevchenko [Tue, 5 Apr 2011 11:33:08 +0000 (14:33 +0300)]
tests: make jittertest buildable

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: check output first
Andy Shevchenko [Mon, 4 Apr 2011 08:21:15 +0000 (11:21 +0300)]
mkfs.ubifs: check output first

Artem: this is jut a clean-up, no functional changes.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: fix OOB read and write interface v1.4.4
Artem Bityutskiy [Fri, 1 Apr 2011 08:11:15 +0000 (11:11 +0300)]
libmtd: fix OOB read and write interface

When reading and writing OOB we specify the address as absolute
offset from the beginning of the MTD device. This offset is
basically an absolute page offset plus the OOB offset. And it does
not have to be aligned to the min. I/O unit size (NAND page size).

So fix the 'do_oob_op()' function and remove incorrect checking
that the offset is page-aligned. This check leads to the following
errors:

libmtd: error!: unaligned address 2, mtd0 page size is 2048

But obviously, the intent was to write to offset 2 of the OOB area
of the very first NAND page.

Instead of that incorrect check, we should check that the OOB offset
we write to is within the OOB size and the length is withing the OOB
size. This patch adds such check.

Reported-by: Kelly Anderson <kelly@silka.with-linux.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tested-by: Kelly Anderson <kelly@silka.with-linux.com>
14 years agofs-tests: integck: improve re-mounting test coverage
Artem Bityutskiy [Thu, 24 Mar 2011 13:43:35 +0000 (15:43 +0200)]
fs-tests: integck: improve re-mounting test coverage

The integck tests re-mounts the file-system from time to time
and checks the integrity afterwords. And it re-mounts always
the same-way: unmount and then mount R/W back. However, it is
better to do it differently some times, e.g.:

* re-mount R/O then re-mount R/W
* unmount then mount R/W
* both of the above
* unmount, mount R/O, then re-mount R/W
* etc.

This will give better test coverage. This patch does exactly
that by improving the 'tests_remount()' function.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: perf: fix compilation warning
Artem Bityutskiy [Thu, 24 Mar 2011 11:32:44 +0000 (13:32 +0200)]
fs-tests: perf: fix compilation warning

Fix the following compilation warning:
perf.c: In function â€˜perf’:
perf.c:144: warning: format â€˜%lld’ expects type â€˜long long int’, but argument 2 has type â€˜int64_t’

by adding a (long long int) cast.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: test_1: fix compilation warnings
Artem Bityutskiy [Thu, 24 Mar 2011 08:19:21 +0000 (10:19 +0200)]
fs-tests: test_1: fix compilation warnings

Fix the following compilation warnings:
test_1.c: In function â€˜test_1’:
test_1.c:67:4: warning: format â€˜%llu’ expects type â€˜long long unsigned int’, but argument 3 has type â€˜uint64_t’
test_1.c:88:3: warning: format â€˜%llu’ expects type â€˜long long unsigned int’, but argument 3 has type â€˜uint64_t’

The fix is to cast the argument with (unsigned long long).

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: fail if -s parameter is unaligned
Artem Bityutskiy [Fri, 18 Mar 2011 11:38:02 +0000 (13:38 +0200)]
nanddump: fail if -s parameter is unaligned

Implement the feature which we planned long time ago - make nanddump
fail if the -s parameter is not NAND page-aligned. Also bump nanddump
version.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: deprecate squash-rino-perm options
Artem Bityutskiy [Fri, 18 Mar 2011 11:31:09 +0000 (13:31 +0200)]
mkfs.ubifs: deprecate squash-rino-perm options

As we have planned, make --nosquash-rino-perm option to be the
default. Deprecate both options at the same time and print a
warning if they are used. Later we can remove them

Also, bump mkfs.ubifs version number.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_erase: increas version number v1.4.3
Artem Bityutskiy [Fri, 18 Mar 2011 10:54:16 +0000 (12:54 +0200)]
flash_erase: increas version number

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_erase: start position should be in bytes
Peter Korsgaard [Fri, 18 Mar 2011 10:21:57 +0000 (11:21 +0100)]
flash_erase: start position should be in bytes

Commit a8801d8 (unify flash_erase and flash_eraseall) changed the
flash_erase interface in a backwards incompatible way. Before that
commit start position was given in bytes, and now it must be provided
in blocks.

While I agree the new interface is nicer, we shouldn't break the
interface. I have scripts that expect the old behaviour, and I'm
most likely not alone, so change the interface back to the old
way.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonandwrite: add only write oob option
Lei Wen [Mon, 7 Mar 2011 09:44:46 +0000 (01:44 -0800)]
nandwrite: add only write oob option

Write only oob part goes different path in nand_base.c, it is better
to have userland program so that we could easy debug this path when
the write only oob fail like the mtd_oobtest in mtd_test suit.

Signed-off-by: Lei Wen <leiwen@marvell.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: common.h: simple_strtoll type usage
Brian Norris [Wed, 16 Feb 2011 01:47:58 +0000 (17:47 -0800)]
mtd-utils: common.h: simple_strtoll type usage

We must use "long long" and "unsigned long long" types when
implementing the functions "simple_strtoll()" and "simple_strtoull()",
respectively. This prevents casting/truncation errors on systems where
"long" is not the same size as "long long" (that is, on most systems).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: fix repeated dev nodes v1.4.2
Thomas Chou [Fri, 31 Dec 2010 01:45:19 +0000 (09:45 +0800)]
mkfs.jffs2: fix repeated dev nodes

Fix the repeated nodes with the same primary name in device_table.txt.
They were not generated correctly.

/dev/tty    c    666    0    0    5    0    0    0    -
/dev/tty    c    666    0    0    4    0    0    1    6

# IDE Devices
/dev/hda    b    640    0    0    3    0    0    0    -
/dev/hda    b    640    0    0    3    1    1    1    15
/dev/hdb    b    640    0    0    3    64    0    0    -
/dev/hdb    b    640    0    0    3    65    1    1    15

Only created,
/dev/tty
/dev/hda
/dev/hdb

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: fix devtable count as mkfs.ubifs does
Thomas Chou [Fri, 31 Dec 2010 03:16:06 +0000 (11:16 +0800)]
mkfs.jffs2: fix devtable count as mkfs.ubifs does

The counting was incorrect. Follow that of mkfs.ubifs.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonandwrite: use common.h "errmsg_die"
Brian Norris [Wed, 1 Dec 2010 06:20:46 +0000 (22:20 -0800)]
nandwrite: use common.h "errmsg_die"

errmsg_die() should be nearly the equivalent of the error message used
here. This saves a few lines.

Also edited the error message to include the offending option and got
rid of the quotes.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonandwrite: add check for negative blockalign
Brian Norris [Wed, 1 Dec 2010 06:19:44 +0000 (22:19 -0800)]
nandwrite: add check for negative blockalign

Includes error messages for negative blockalign, telling the user what
the offending option and value were.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: choose correct "printf" format-specifier
Brian Norris [Mon, 29 Nov 2010 08:02:00 +0000 (00:02 -0800)]
nanddump: choose correct "printf" format-specifier

The mtd-descriptor attributes contain signed data, not unsigned.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: check for negative inputs
Brian Norris [Wed, 1 Dec 2010 07:12:30 +0000 (23:12 -0800)]
nanddump: check for negative inputs

Includes error messages for negative device offsets and negative lengths,
telling the user what the offending option and value were.

Previous patch left out the "negative" in the error message.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: change "unsigned" to "signed"
Brian Norris [Mon, 29 Nov 2010 08:01:58 +0000 (00:01 -0800)]
nanddump: change "unsigned" to "signed"

For consistency between nanddump and nandwrite and in order to provide
better means for checking for negative inputs, the "offset" and "length"
types in nanddump should be changed to signed integer types. This also
solves a signed/unsigned comparison warning.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: Refactor pretty print code into an sprintf()
Brian Norris [Mon, 29 Nov 2010 08:01:57 +0000 (00:01 -0800)]
nanddump: Refactor pretty print code into an sprintf()

A do-while loop in pretty_dump_to_buffer() can be refactored into a
single sprintf() statement. MAX() and MIN() are used to ensure that:
(1) We have at least a single space between hex and ASCII output
(2) We don't overflow the line buffer

This patch was suggested by Mike Frysinger.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agocommon.h: Add MAX() macro, fix MIN()
Brian Norris [Mon, 29 Nov 2010 08:01:56 +0000 (00:01 -0800)]
common.h: Add MAX() macro, fix MIN()

Add MAX() macro to common.h, to be used in future patches.

Also a style change in comma location on MIN().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump/nandwrite: use "simple_" str functions
Brian Norris [Mon, 29 Nov 2010 08:01:55 +0000 (00:01 -0800)]
nanddump/nandwrite: use "simple_" str functions

Per Mike Frysinger's suggestion, we check for strtoll() and strtoull()
errors by using the "common.h" helper functions simple_strtoll() and
simple_strtoull().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: fix OOB size initialization in legacy code
Ketil Froyn [Thu, 25 Nov 2010 08:52:12 +0000 (09:52 +0100)]
libmtd: fix OOB size initialization in legacy code

legacy_get_dev_info() forgot to set the OOB size

Signed-off-by: Ketil Froyn <ketil@froyn.name>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: type consistency
Brian Norris [Thu, 11 Nov 2010 06:39:14 +0000 (22:39 -0800)]
mtd-utils: nandwrite: type consistency

Change type off "offs" for type consistency of 64-bit data types. The
"loff_t" type is no longer needed for the MEMGETBADBLOCK ioctl since
it isn't called dirently anymore - this is handled by mtd_is_bad().

Also change an accompanying printf().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: full 64-bit support w/ libmtd
Brian Norris [Thu, 11 Nov 2010 06:39:13 +0000 (22:39 -0800)]
mtd-utils: nandwrite: full 64-bit support w/ libmtd

Several ioctls are replaced with libmtd calls which should give us 64-bit
support for large devices. libmtd mostly provides drop-in replacements
for the functionality we need. However, when we require erasure of a
badly-written block, mtd_erase() only erases a single block, whereas
MEMERASE could erase a larger region. In nandwrite, we may have a "virtual
blocksize" of more than one (when blockalign > 1). Thus, I added a loop
for this case.

The mtd_oob_buf struct is no longer needed, nor is "erase_info_t".

Error messages for the new libmtd calls reflect the style found in
flash_erase.

Tested with nandsim and with NAND chips up to 4GB in size (I don't have
a device that truly requires 64-bit addressing yet).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: prevent 32-bit overflow
Brian Norris [Thu, 11 Nov 2010 06:31:41 +0000 (22:31 -0800)]
mtd-utils: nandwrite: prevent 32-bit overflow

For large block- and page-sizes, the multiplication of ebsize_aligned
and pagelen can overflow a 32-bit integer.  This overflow can be
prevented by a simple change in order of operations (i.e., do division
first).

Since ebsize_aligned is always a multiple of mtd.min_io_size, this
produces no change in results.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: avoid NULL buffer pointers
Brian Norris [Wed, 3 Nov 2010 08:27:24 +0000 (01:27 -0700)]
mtd-utils: nandwrite: avoid NULL buffer pointers

Commit 07005d915d6a79dbdee14b0c4360df5058c3a98b made changes to the
buffer allocation in nandwrite and did not handle all affected code
areas properly. In particular, we were assigning:
oob.ptr = noecc ? oobreadbuf : oobbuf;
However, since oobreadbuf and oobbuf are declared dynamically, they
are NULL at this point. If they aren't properly assigned later, we
unwittingly are passing a NULL pointer as oob buffer.

This assignment line is best moved after the buffer allocations and
pointer assignment.

Effects of this problem can be seen when writing oob data with the "-o"
flag and without the "-n" flag:
$ ./nandwrite -o /dev/mtd0 img.bin
Writing data to block 0 at offset 0x0
ioctl(MEMWRITEOOB): Bad address
Data was only partially written due to error
: Bad address

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: Use 64-bit offset
Brian Norris [Wed, 3 Nov 2010 08:27:23 +0000 (01:27 -0700)]
mtd-utils: nandwrite: Use 64-bit offset

To support large NAND devices, we need 64-bit data types for
write offsets. This patch makes data type changes along with
their corresponding printf() formats and the input conversion
(i.e., use "strtoll()" instead of "strol()").

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: Use libmtd to get correct mtd parameters
Brian Norris [Wed, 3 Nov 2010 08:27:22 +0000 (01:27 -0700)]
mtd-utils: nandwrite: Use libmtd to get correct mtd parameters

Begin utilizing libmtd for MTD operations: use mtd_get_dev_info() to return
a more detailed set of information about our MTD. Most importantly, libmtd
will yield a 64-bit "size" parameter. This is necessary to properly detect
devices larer than 4GB.

printf() arguments needed reformatted for the new mtd_dev_info data types.
In addition, the printf() was restructured to keep lines shorter.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: switch "oobsize" for "writesize"
Brian Norris [Wed, 3 Nov 2010 08:27:21 +0000 (01:27 -0700)]
mtd-utils: nandwrite: switch "oobsize" for "writesize"

The text of a printf() states that we're printing OOB area, but the
corresponding argument passes writesize. That probably wasn't the intent.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: Clarify usage of aligned "erasesize"
Brian Norris [Wed, 3 Nov 2010 08:27:20 +0000 (01:27 -0700)]
mtd-utils: nandwrite: Clarify usage of aligned "erasesize"

Due to the presence of the "--block-align" flag, nandwrite uses a
blocksize throughout that, depeding on the execution parameters, may
not be the actual erasesize of the NAND flash. In order to clarify
this situation for the untrained viewer of nandwrite's code, we should
not change the value of "meminfo.erasesize" itself; rather, we can
utilize a separate, calculated "ebsize_aligned". Then, when a user
actually wants to refer to the physical erasesize, it's straightforward.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: Comment, style fixups
Brian Norris [Wed, 3 Nov 2010 08:27:19 +0000 (01:27 -0700)]
mtd-utils: nandwrite: Comment, style fixups

Comment on "blockalign" default value is incorrect; it only defaults
to a 1x multiplier of the actual block size. Perhaps this is a relic
of early NAND where all block sizes were 16KB?

Reformatted a multi-line comment.

Changed separete "if" statements to a combined "if-else-if" since they
were logically combinable. Should have no effect on results with minor
effect on efficiency.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nanddump: Allow 64-bit lengths
Brian Norris [Wed, 3 Nov 2010 08:27:18 +0000 (01:27 -0700)]
mtd-utils: nanddump: Allow 64-bit lengths

We should allow the dump length to be 64-bit, especially since the value
was read in as a "long long" by strtoll().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoFix make install errors
Mike Frysinger [Wed, 27 Oct 2010 18:27:31 +0000 (21:27 +0300)]
Fix make install errors

This patch heals 'make install' which tried to install the utilities
to '/usr/local//usr/sbin'.

Reported-by: Charles Manning <manningc2@actrix.gen.nz>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: Fix typo in short options of mkfs.ubifs
Vivenzio Pagliari [Mon, 25 Oct 2010 11:58:54 +0000 (13:58 +0200)]
mkfs.ubifs: Fix typo in short options of mkfs.ubifs

The short option for specifying the count of erase blocks for orphans '-p'
was not detected due to a typo.

Signed-off-by: Vivenzio Pagliari <vivenzio.pagliari@gmx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nanddump: add 64-bit support, utilize libmtd
Brian Norris [Thu, 21 Oct 2010 07:19:37 +0000 (00:19 -0700)]
mtd-utils: nanddump: add 64-bit support, utilize libmtd

Adds support for 64-bit offsets (i.e., devices larger than 4GB).
Utilizes the "unsigned long long" data type as the standard type
for 64-bit offsets throughout. Reformats a few printf statements
to avoid casting and to properly handle "long long."

Calls to ioctls are mostly replaced by libmtd interfaces (which should
choose the proper ioctls for us); however, a few remain and probably
should be handled with more robust interfaces, as some of these
ioctls are considered "legacy."

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nanddump/nandwrite: style, signed-ness, printing fixups
Brian Norris [Thu, 21 Oct 2010 07:19:36 +0000 (00:19 -0700)]
mtd-utils: nanddump/nandwrite: style, signed-ness, printing fixups

There were some signed/unsigned integer comparisons. Their types were
changed for safety. Also, "strtol" was improperly used for unsigned
data types.

Nanddump's pretty print options needed a slight reformat to prepare for
printing offsets that are more than 32 bits (8 hex characters) wide.
This prevents overlap of output and ensures that at least one space is
printed between hex and ascii printouts. Perhaps this could use some
better alignment in the future.

Other fixes:
* Corrected several simple spacing issues
* Changed indentation of some global variable declarations in
  order to prepare for the next patch, which makes those
  declarations longer
* Used macro for PRETTY_ROW_SIZE instead of constant 16
* Reformatted, edited a multi-line comment
* Removed some unnecessary casts

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 years agonanddump: warn when the start address is not page aligned
Baruch Siach [Mon, 18 Oct 2010 07:23:25 +0000 (09:23 +0200)]
nanddump: warn when the start address is not page aligned

nanddump should be consistent with nandwrite, which does not accept non page
aligned start addresses. Thus, non page aligned dumps are useless.

To ease migration only warn for now. Add the plan of making this an error to
feature-removal-schedule.txt.

Tweaked by Artem.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nanddump/nandwrite: Style fixups
Brian Norris [Fri, 15 Oct 2010 07:44:23 +0000 (00:44 -0700)]
mtd-utils: nanddump/nandwrite: Style fixups

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: flash_erase: Fix output of offsets
Brian Norris [Sat, 16 Oct 2010 20:54:05 +0000 (13:54 -0700)]
mtd-utils: flash_erase: Fix output of offsets

Need to use unsigned arithmetic and a 64-bit cast in order to
calculate and output the correct offset for eraseblocks at large
offsets. Signed integer arithmetic does not produce the correct
result "uint64_t" result, so for offsets over 2GB we get
messages like:

Erasing 512 Kibyte @ ffffffff83180000 -- 4308642136 % complete.

Note that this error was not affecting proper erasure; it just
produced incorrect status messages.

Also, we should not add an extra eraseblock for the final status
message; this gives misleading output when, for example, the
following statement is executed:

$ flash_erase /dev/mtd0 0 1
Erasing 512 Kibyte @ 80000 -- 100 % complete

We aren't erasing at offset 0x80000; it should display offset 0.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nandwrite: Large page+oob support
Brian Norris [Sat, 16 Oct 2010 02:12:25 +0000 (19:12 -0700)]
mtd-utils: nandwrite: Large page+oob support

Dynamic allocation of the oob buffer provides the necessary
support for removing the oob size check. Now, new unknown OOB
sizes can be handled correctly (for example, 8KB page + 448B
OOB).

Included common.h for the use of xmalloc.

Memory freeing should occur on "restoreoob" as well as on
"closeall."

[Conflicts resolved by Artem]

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: nanddump: Dynamic buffer, increase pagesize/oobsize
Brian Norris [Sat, 16 Oct 2010 00:35:31 +0000 (17:35 -0700)]
mtd-utils: nanddump: Dynamic buffer, increase pagesize/oobsize

The buffers used for dumping page and OOB data needed dynamic
allocation to help eliminate burdens for updating (i.e., every
time there's a new OOB size we don't have to increase the sizes).

Also, there is no need to check flash chips for "standard sizes."
With recent changes to the printing codebase, we should be able to
handle arbitrary sizes with no problem.

More exit operations are now necessary on program failure, so
"goto closeall" is used more liberally.

Also, common.h is included for the use of xmalloc.

[conflicts fixed by Artem]

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: always check the first erase block
Baruch Siach [Tue, 12 Oct 2010 08:23:55 +0000 (10:23 +0200)]
nanddump: always check the first erase block

Check the first block even when start_addr is not eraseblock aligned.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoAdd --squash-rino-perm removal plan
Artem Bityutskiy [Sat, 16 Oct 2010 18:53:39 +0000 (21:53 +0300)]
Add --squash-rino-perm removal plan

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: fix initialization of bad blocks oob data buffer
Baruch Siach [Mon, 11 Oct 2010 09:19:38 +0000 (11:19 +0200)]
nanddump: fix initialization of bad blocks oob data buffer

When dumping oob data of a bad block, initialize oobbuf with 0xff, instead of
readbuf.  This avoids bogus oob data on output.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agojffs2reader: convert to common.h helpers
Mike Frysinger [Sat, 2 Oct 2010 18:58:09 +0000 (14:58 -0400)]
jffs2reader: convert to common.h helpers

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: make malloc failures fatal
Mike Frysinger [Fri, 1 Oct 2010 17:13:10 +0000 (13:13 -0400)]
libmtd: make malloc failures fatal

This converts libmtd to the common xalloc helpers and in doing so, makes
memory allocation failures fatal rather than returning an error to the
caller.  I think this is acceptable behavior.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agosumtool/libfec: convert "()" to "(void)" in func defs
Mike Frysinger [Fri, 1 Oct 2010 17:11:28 +0000 (13:11 -0400)]
sumtool/libfec: convert "()" to "(void)" in func defs

Since these functions take no parameters, declare them as such.  The
subtle difference here is that gcc allows (without warning) people to
accidentally call funcs declared with "()" with arguments.  Using void
makes sure that gcc will reject such typos at compile time.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agosumtool: convert to common.h helpers
Mike Frysinger [Fri, 1 Oct 2010 17:11:27 +0000 (13:11 -0400)]
sumtool: convert to common.h helpers

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: convert to xalloc.h helpers
Mike Frysinger [Fri, 1 Oct 2010 17:10:30 +0000 (13:10 -0400)]
mkfs.jffs2: convert to xalloc.h helpers

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>