]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
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>
14 years agolibmtd: unify some error messages
Mike Frysinger [Fri, 1 Oct 2010 05:46:34 +0000 (01:46 -0400)]
libmtd: unify some error messages

By using the same error message string, we only need one copy of it
in memory at runtime.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: xalloc: simplify/unify error messages
Mike Frysinger [Fri, 1 Oct 2010 05:45:06 +0000 (01:45 -0400)]
mtd-utils: xalloc: simplify/unify error messages

I'm not sure that if we actually are out of memory that declaring the
failing allocation size is useful in the output.  So use the same
simple string in every error message to cut down on size (there will
only be one copy of this at runtime).  Size is a much more common
concern than handling OOM issues which most likely aren't the fault
of mtd-utils in the first place.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: dont redefine MIN()
Mike Frysinger [Fri, 1 Oct 2010 05:44:21 +0000 (01:44 -0400)]
mtd-utils: dont redefine MIN()

Some C library headers will define MIN(), so add an #ifndef check.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: convert to common.h helpers
Mike Frysinger [Fri, 1 Oct 2010 05:43:30 +0000 (01:43 -0400)]
mkfs.jffs2: 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: fix "fount" typo
Mike Frysinger [Fri, 1 Oct 2010 05:40:33 +0000 (01:40 -0400)]
libmtd: fix "fount" typo

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: sys_errmsg: optimize indentation
Mike Frysinger [Fri, 1 Oct 2010 05:39:49 +0000 (01:39 -0400)]
mtd-utils: sys_errmsg: optimize indentation

Rather than do a for loop and output 1 space at a time, let the printf
code take care of indenting the string based on the constant length.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: introduce xzalloc() helper
Mike Frysinger [Fri, 1 Oct 2010 05:38:48 +0000 (01:38 -0400)]
mtd-utils: introduce xzalloc() helper

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: enable garbage collection of unused function/data sections
Mike Frysinger [Fri, 1 Oct 2010 05:37:14 +0000 (01:37 -0400)]
mtd-utils: enable garbage collection of unused function/data sections

On my default build, this cumulatively shaves off ~100KiB of unused
code and data from the mtd-utils programs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: use new xasprintf() helper
Mike Frysinger [Wed, 29 Sep 2010 23:30:24 +0000 (19:30 -0400)]
mkfs.jffs2: use new xasprintf() helper

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: add xasprintf() helper
Mike Frysinger [Thu, 30 Sep 2010 05:28:11 +0000 (01:28 -0400)]
mtd-utils: add xasprintf() helper

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: new memory wrappers
Mike Frysinger [Thu, 30 Sep 2010 05:27:38 +0000 (01:27 -0400)]
mtd-utils: new memory wrappers

The mkfs.jffs2 program has local wrappers for memory related functions
that are useful beyond mkfs.jffs2, so break them out into a common header.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: remove old ubi-utils
Artem Bityutskiy [Tue, 28 Sep 2010 07:47:06 +0000 (10:47 +0300)]
ubi-utils: remove old ubi-utils

The utilities are unmaintained for long time, and many of them
do not even work, just compile, and no on complains about this.
This suggests they are unused and we can now safely kill them.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: Use $(CURDIR) in place of $(PWD)
Kevin Cernekee [Tue, 28 Sep 2010 00:22:04 +0000 (17:22 -0700)]
mtd-utils: Use $(CURDIR) in place of $(PWD)

$(PWD) comes from the shell and may cause unexpected side effects when
using "make -C".

$(CURDIR) is defined internally by GNU make.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: unify flash_erase and flash_eraseall
Mike Frysinger [Mon, 27 Sep 2010 06:50:58 +0000 (02:50 -0400)]
mtd-utils: unify flash_erase and flash_eraseall

These have overlapping functionality, and while flash_eraseall supports
newer 64bit ioctls, flash_erase does not.  So rather than graft support
onto flash_erase, merge the functionality of two into flash_erase so we
only have to support one util from now on.

A simple wrapper is provided to ease old flash_eraseall users into the
new combined flash_erase util.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: new strtoX helpers
Mike Frysinger [Mon, 27 Sep 2010 06:42:28 +0000 (02:42 -0400)]
mtd-utils: new strtoX helpers

Simply usage of converting strings to numbers by adding some wrappers
around the standard strtoX functions.  These helpers simplify the api
of these functions a bit by providing an optional "error" pointer and
automatic error message.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: common.h: clean up PROGRAM_NAME usage
Mike Frysinger [Mon, 27 Sep 2010 06:40:26 +0000 (02:40 -0400)]
mtd-utils: common.h: clean up PROGRAM_NAME usage

Make PROGRAM_NAME required in order to include common.h so we can rely
on it existing.

Further, stop embedding PROGRAM_NAME in every error message so that we
can save string space with it being declare only once.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agorecv_image: fix __USE_GNU hack
Mike Frysinger [Sun, 26 Sep 2010 21:42:29 +0000 (17:42 -0400)]
recv_image: fix __USE_GNU hack

The __USE_GNU define is an internal define that source code should never
be touching.  So switch it to the proper exported _BSD_SOURCE define.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: tweak const strings decls
Mike Frysinger [Sun, 26 Sep 2010 21:41:55 +0000 (17:41 -0400)]
ubi-utils: tweak const strings decls

Shrink the data size a little by declaring addresses of constant strings
instead of pointers to it.

Also slip in static & const on long_options missing them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agocompr_rtime: fix unused warning
Mike Frysinger [Sun, 26 Sep 2010 21:29:47 +0000 (17:29 -0400)]
compr_rtime: fix unused warning

The rtime logic causes gcc to emit an unused warning about srclen, so
mark it with an unused attribute to shut it up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: standardize PROGRAM_NAME
Mike Frysinger [Sun, 26 Sep 2010 18:48:51 +0000 (14:48 -0400)]
mtd-utils: standardize PROGRAM_NAME

Make sure all the utils define PROGRAM_NAME and do so at the start of
the file so that sub-headers may assume it exists.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonandwrite: Remove redundant 'autoplace' check
Shinya Kuribayashi [Fri, 24 Sep 2010 09:22:53 +0000 (18:22 +0900)]
nandwrite: Remove redundant 'autoplace' check

We're already in 'if (autoplace) { }' block at ths moment.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: new bareverbose() helper
Mike Frysinger [Sat, 25 Sep 2010 06:05:25 +0000 (02:05 -0400)]
mtd-utils: new bareverbose() helper

Add a new helper that lets people do simple verbose output without any
implicit strings added around it.  Good for progress bars and such.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: add lock/unlock helpers
Mike Frysinger [Fri, 24 Sep 2010 01:53:38 +0000 (21:53 -0400)]
libmtd: add lock/unlock helpers

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: use common ARRAY_SIZE
Mike Frysinger [Fri, 24 Sep 2010 01:52:42 +0000 (21:52 -0400)]
mkfs.ubifs: use common ARRAY_SIZE

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: punt duplicate normsg_cont define
Mike Frysinger [Fri, 24 Sep 2010 01:52:38 +0000 (21:52 -0400)]
mtd-utils: punt duplicate normsg_cont define

Looks like someone copied & pasted it twice by accident.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: convert to common.h/min
Mike Frysinger [Fri, 24 Sep 2010 01:52:17 +0000 (21:52 -0400)]
mtd-utils: convert to common.h/min

Kill off duplicated min() defines and convert to the common.h one.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: unify erase block argument checking
Mike Frysinger [Fri, 24 Sep 2010 01:51:53 +0000 (21:51 -0400)]
libmtd: unify erase block argument checking

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