]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
13 years agomake_a_release.sh: remind about pushing the master branch
Artem Bityutskiy [Mon, 19 Dec 2011 20:37:28 +0000 (22:37 +0200)]
make_a_release.sh: remind about pushing the master branch

When we print about pushing the tag, also print about pushing the
master branch - I forgot to do this when releasing 1.4.9.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
13 years agoRelease mtd-utils-1.4.9 v1.4.9
Artem Bityutskiy [Sat, 17 Dec 2011 14:38:56 +0000 (16:38 +0200)]
Release mtd-utils-1.4.9

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: allow write operations when MEMWRITE is not supported
Brian Norris [Fri, 9 Dec 2011 19:45:14 +0000 (11:45 -0800)]
libmtd: allow write operations when MEMWRITE is not supported

MEMWRITE is a recently introduced write interface for MTD; however, it
is only supported on NAND flash. mtd-utils should fall back to
old write methods when either ENOTTY or EOPNOTSUPP are returned.

This is a showstopper when, for instance, using ubiformat on NOR, which
don't have a mtd->write_oob interface (and thus don't support MEMWRITE):

  ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
          error 122 (Operation not supported)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
13 years agoAdd a script to make releases
Artem Bityutskiy [Wed, 7 Dec 2011 07:09:22 +0000 (09:09 +0200)]
Add a script to make releases

Credits to Mike Frysinger <vapier.adi@gmail.com> for review and comments.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agonandtest: seed random generator with time
Brian Norris [Fri, 2 Dec 2011 17:46:12 +0000 (09:46 -0800)]
nandtest: seed random generator with time

If a seed is not provided via --seed, we use the default rand() values,
which produces the same sequence of values every run. Since this is
undesirable, we should choose a random seed via the current time().

Note that this patch moves the srand() until after all the initial
options processing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agonandtest: use seed argument
Jan Weitzel [Thu, 24 Nov 2011 10:57:34 +0000 (11:57 +0100)]
nandtest: use seed argument

if a seed is provided it is actually not used. First call is
"seed = rand()" killing the given seed.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Tested-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agonandtest: set oldstats.failed
Jan Weitzel [Thu, 24 Nov 2011 10:57:21 +0000 (11:57 +0100)]
nandtest: set oldstats.failed

if new ecc failed occures oldstats.corrected is updated not oldstats.failed

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoMakefile: separate man page install and compression steps
Mike Frysinger [Sat, 19 Nov 2011 21:02:03 +0000 (16:02 -0500)]
Makefile: separate man page install and compression steps

If the system doesn't have gzip installed, we should still be able
to install the man pages.  So install the file in one step, and then
compress it in another (and ignore failures from that).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoMakefile: fix install target with out-of-tree builds
Mike Frysinger [Sat, 19 Nov 2011 21:00:07 +0000 (16:00 -0500)]
Makefile: fix install target with out-of-tree builds

The install target always looks for the compiled binaries in the working
directory which breaks when doing something like `make CHOST=... install`.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years ago1.4.8 release v1.4.8
Artem Bityutskiy [Sat, 19 Nov 2011 20:38:50 +0000 (22:38 +0200)]
1.4.8 release

Unfortunately I forgot to update the version in Makefile and tagged v1.4.7.
To fix this, I could not invent anything better than cut a new release 1.4.8.

Sorry for this :-(

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoMerge branch 'brian' v1.4.7
Artem Bityutskiy [Fri, 18 Nov 2011 21:53:11 +0000 (23:53 +0200)]
Merge branch 'brian'

13 years agomtdinfo: provide info when used without arguments
Brian Norris [Wed, 16 Nov 2011 20:03:57 +0000 (12:03 -0800)]
mtdinfo: provide info when used without arguments

If the user specifies neither a MTD argument nor the `-a' flag, we print
a cryptic message; i.e.,

    # mtdinfo
    libmtd: error!: cannot get information about "(null)"
            error 14 (Bad address)
    mtdinfo: error!: cannot get information about MTD device "(null)"
             error 14 (Bad address)

This is a regression; previously, mtdinfo would give some short info
about number of devices, etc. when used without arguments. To fix this,
we revert commit d53c03b0989f8354a7e4dbb947a150fc7fe3f6d1 and call
print_general_info() when no device is specified.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agomtd-utils: add jffs2reader to .gitignore
Brian Norris [Wed, 16 Nov 2011 20:03:56 +0000 (12:03 -0800)]
mtd-utils: add jffs2reader to .gitignore

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agotests: checkfs: remove unused code
Andy Shevchenko [Mon, 10 Oct 2011 08:40:43 +0000 (11:40 +0300)]
tests: checkfs: remove unused code

There are two variables which are not used anymore. Thos patch removes useless
lines and suppresses gcc warnings.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomkfs_jffs2: fix typo for word unknown
Andy Shevchenko [Mon, 10 Oct 2011 08:40:42 +0000 (11:40 +0300)]
mkfs_jffs2: fix typo for word unknown

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: use major() and minor() helpers
Andy Shevchenko [Mon, 19 Sep 2011 11:25:24 +0000 (14:25 +0300)]
jffs2reader: use major() and minor() helpers

There are major() and minor() helpers in the standard library. We can use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: print ctime only by user's request
Andy Shevchenko [Mon, 19 Sep 2011 11:25:23 +0000 (14:25 +0300)]
jffs2reader: print ctime only by user's request

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: use const char * for path variables
Andy Shevchenko [Mon, 19 Sep 2011 11:25:22 +0000 (14:25 +0300)]
jffs2reader: use const char * for path variables

This patch brings const char * type for path variables. It allows to eliminate
compiler warning.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: get rid of linker error
Andy Shevchenko [Mon, 19 Sep 2011 11:25:21 +0000 (14:25 +0300)]
jffs2reader: get rid of linker error

There is a linker errors:
undefined reference to `target_endian'

This patch fixes the issue and turns on the jffs2reader build in the Makefile.

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: introduce ADD_BYTES macro
Andy Shevchenko [Mon, 19 Sep 2011 11:25:20 +0000 (14:25 +0300)]
jffs2reader: introduce ADD_BYTES macro

This macro is dedicated to get rid of the compiler errors:
lvalue required as left operand of assignment

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
13 years agojffs2reader: eliminate compiler errors
Andy Shevchenko [Mon, 19 Sep 2011 11:25:19 +0000 (14:25 +0300)]
jffs2reader: eliminate compiler errors

There are many errors like "error: invalid operands to binary". This patch
converts the values to the proper types.

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
13 years agojffs2reader: update the header inclusion block
Andy Shevchenko [Mon, 19 Sep 2011 11:25:18 +0000 (14:25 +0300)]
jffs2reader: update the header inclusion block

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agoubiformat: handle write errors correctly
Artem Bityutskiy [Sun, 11 Sep 2011 10:52:08 +0000 (13:52 +0300)]
ubiformat: handle write errors correctly

This issue was reported and analyzed by
Anton Olofsson <anol.martinsson@gmail.com>:

when ubiformat encounters a write error while flashing the UBI image (which may
come from a file of from stdout), it correctly marks the faulty eraseblock as
bad and skips it. However, it also incorrectly drops the data buffer which was
supposed to be written, and reads next block of data.

This patch fixes this issue - in case of a write error, we preserve the current
data and write it to the next eraseblock, instead of dropping it.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: use common.h "errmsg" functions
Brian Norris [Wed, 31 Aug 2011 20:00:39 +0000 (13:00 -0700)]
nandwrite: use common.h "errmsg" functions

Convert several forms of exit(), perror(), etc. to use common.h helper
functions.

Also, move one of our parameter checks inside the process_options()
function for consistency.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: re-implement `--autoplace' option
Brian Norris [Wed, 31 Aug 2011 20:00:38 +0000 (13:00 -0700)]
nandwrite: re-implement `--autoplace' option

The restructuring of mtd_write() has allowed us to use `--autoplace'
somewhat successfully; it is supported by the new ioctl(MEMWRITE) as
well as some legacy code utilizing the deprecated ioctl(MEMGETOOBSEL).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: kill `--raw' option
Brian Norris [Wed, 31 Aug 2011 20:00:37 +0000 (13:00 -0700)]
nandwrite: kill `--raw' option

The `--raw' option has lost all usefulness as it overlapped with several
other OOB modes. I cannot even figure out what it was actually intended
to do, but I'm sure its functionality fits somewhere in the
MTD_OPS_{AUTO_OOB,PLACE_OOB,RAW} options, which are mostly implemented
in libmtd's mtd_write().

I don't think users need a warning for this one, unless someone can tell
me what it actually was supposed to have done in the first place.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdutils: move OOB auto-layout into libmtd's mtd_write
Brian Norris [Wed, 31 Aug 2011 20:00:36 +0000 (13:00 -0700)]
mtdutils: move OOB auto-layout into libmtd's mtd_write

With the addition of the the new ioctl(MEMWRITE), we can use the
kernel's internal OOB autoplacement option. It's a cleaner interface and
avoids too much duplication of coding effort.

This patch moves any legacy code (using MEMGETOOBSEL) into a legacy
function in libmtd.c. It's not exactly a "pre-2.6.30" feature, so I'm not
moving it to libmtd_legacy.c.

Now, autoplacement features are only activated if we call mtd_write with
mode == MTD_OPS_AUTO_OOB. This should fix some discrepancies for
nandwrite, where we weren't handling OOB consistently (i.e., we had
different functionality when the kernel did/didn't support MEMWRITE).
But that also means that we now default to using MTD_OPS_PLACE_OOB
instead of AUTO layout. To re-enable autoplacement, we can re-implement
the `--autoplace' option that had previously rotted.

This patch also cleans up a need for an extra OOB buffer in nandwrite.

This has been tested a little in nandsim as well as on SLC NAND flash.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: merge `mtd_write_oob' and `mtd_write' calls
Brian Norris [Wed, 31 Aug 2011 20:00:35 +0000 (13:00 -0700)]
nandwrite: merge `mtd_write_oob' and `mtd_write' calls

Now that `mtd_write' can write to both OOB and data regions, we need to
perform our `mtd_write' call only once.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agolibmtd: support MEMWRITE ioctl
Brian Norris [Wed, 31 Aug 2011 20:00:34 +0000 (13:00 -0700)]
libmtd: support MEMWRITE ioctl

`mtd_write()' now will first attempt to use MEMWRITE. Then, if that
doesn't exist, it will attempt to fall back to old methods for writing
OOB and/or page data.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agolibmtd: modify `mtd_write' to cover OOB writes
Brian Norris [Wed, 31 Aug 2011 20:00:33 +0000 (13:00 -0700)]
libmtd: modify `mtd_write' to cover OOB writes

To support the MEMWRITE ioctl, we will need a different sort of libmtd
interface for writing to flash. We will expand mtd_write to include more
functionality; for now, we just change the function definition and
description as we begin to add the actual functionality.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd-utils: update mtd-abi.h
Brian Norris [Fri, 9 Sep 2011 17:11:49 +0000 (10:11 -0700)]
mtd-utils: update mtd-abi.h

Kernel ABI header added a new ioctl, killed an old one, and exposed OOB
modes to user-space. Plus, it added a lot of documentation.

We have some trivial name changes for some MTD mode constants as well.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: consolidate buffer usage
Brian Norris [Wed, 31 Aug 2011 20:00:32 +0000 (13:00 -0700)]
nandwrite: consolidate buffer usage

Instead of using two different output buffers for OOB data, let's just
use the same one for all output. This adds an extra memcpy, but it
simplifies some future work, so it's worth it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: trivial variable move
Brian Norris [Wed, 31 Aug 2011 20:00:30 +0000 (13:00 -0700)]
nandwrite: trivial variable move

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandtest: print number of bits corrected during test
Ben Gardiner [Tue, 9 Aug 2011 20:57:28 +0000 (16:57 -0400)]
nandtest: print number of bits corrected during test

The nandtest program monitors the corrected ecc stat to determine if an
ECC correction has taken place during the last write-read. If so, it
prints "ECC corrected".

The mtd subsytem will store the number of bits corrected in the corrected
ecc stat so update the nandtest output to print also the number of bits
corrected when performing the test.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonanddump: kill usages of MEMSETOOBSEL ioctl
Brian Norris [Fri, 19 Aug 2011 17:07:56 +0000 (10:07 -0700)]
nanddump: kill usages of MEMSETOOBSEL ioctl

The ioctl MEMSETOOBSEL hasn't existed for a long time. Using it as a
backup to MTDFILEMODE is pointless, so just remove every time it is
used.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: refactor "old_oobinfo" code
Brian Norris [Fri, 19 Aug 2011 17:07:55 +0000 (10:07 -0700)]
nandwrite: refactor "old_oobinfo" code

Move variable within conditional and remove duplicated code.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: cleanup "oobinfochanged" leftovers
Brian Norris [Fri, 19 Aug 2011 17:07:54 +0000 (10:07 -0700)]
nandwrite: cleanup "oobinfochanged" leftovers

We don't really use oobinfochanged anymore, since all the calls to the
MEMSETOOBSEL ioctls are gone. The remaining usage of it is superfluous
now, as the only case where it is changed is under the "noecc" condition
and the only case where it is tested is under the "!noecc" condition.

We also no longer need the "restoreoob" label and can instead simply
close everything done with the single remaining label, "closeall". Note
that `close(-1)' is legal, although useless.

Finally, we move `old_oobinfo' into the only block of code in which it's
used now.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: kill -j, -y, and -f options
Brian Norris [Fri, 19 Aug 2011 17:07:53 +0000 (10:07 -0700)]
nandwrite: kill -j, -y, and -f options

The legacy -j (--jffs2) and -y (--yaffs) options haven't been
operational for a long time, since MEMSETOOBSEL was killed. I don't
think anybody will miss these options (correct me if I'm wrong). They
can be replaced by proper usage of MTD_OOB_AUTO modes.

The -f (--forcelegacy) option went hand in hand with -j and -y. Now that
-j and -y are gone, there's no use for -f. Kill it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: kill more MEMSETOOBSEL
Brian Norris [Fri, 19 Aug 2011 17:07:52 +0000 (10:07 -0700)]
nandwrite: kill more MEMSETOOBSEL

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: remove `autoplace' features
Brian Norris [Fri, 19 Aug 2011 17:07:51 +0000 (10:07 -0700)]
nandwrite: remove `autoplace' features

The `autoplace' option was meant to force an MTD_OOB_AUTO layout while
writing to flash. This option has not been properly supported for a very
long time, as the necessary ioctl, MEMSETOOBSEL, has been removed.
Apparently nobody uses this option. Kill it.

Other code depends on the availability of the `old_oobinfo' data, so we
move some code within a block that handles autoplacement if it's
*already* enabled. This, however, is inconsistent and should be cleaned
up shortly.

Note: this option may be re-implemented in the near future with the
addition of a new ioctl that allows on-the-fly chaning of MTD OOB modes.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: remove C99 comment style
Brian Norris [Fri, 19 Aug 2011 17:07:50 +0000 (10:07 -0700)]
nandwrite: remove C99 comment style

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd-utils: use __func__ instead of __FUNCTION__
Brian Norris [Fri, 19 Aug 2011 17:07:49 +0000 (10:07 -0700)]
mtd-utils: use __func__ instead of __FUNCTION__

__func__ is more portable

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd_debug: replace #defines with enum
Brian Norris [Fri, 19 Aug 2011 17:07:48 +0000 (10:07 -0700)]
mtd_debug: replace #defines with enum

enum provides a cleaner mechanism that creating single-purpose `#define`s.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd_debug: fixup style
Brian Norris [Fri, 19 Aug 2011 17:07:47 +0000 (10:07 -0700)]
mtd_debug: fixup style

Remove extraneous spaces.
Put braces on same line as "if", "for", "switch", etc. statements.
No parentheses around return values.
Use "errmsg_die" from common.h.
Replace "exit (1)" with "exit(EXIT_FAILURE)".

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomkfs.ubifs/ubinize: increase PEB size limit to 2MiB
Viktar Palstsiuk [Sat, 20 Aug 2011 04:07:37 +0000 (07:07 +0300)]
mkfs.ubifs/ubinize: increase PEB size limit to 2MiB

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoBumb version number
Artem Bityutskiy [Sat, 20 Aug 2011 03:47:50 +0000 (06:47 +0300)]
Bumb version number

We released mtd-utils 1.4.6 as a bug-fix release. Bump the version number
in Makefile.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years ago nandwrite: invalid erase after page write failure
Fryar, Jeff [Thu, 11 Aug 2011 15:30:33 +0000 (16:30 +0100)]
 nandwrite: invalid erase after page write failure

mtd-utils nandwrite.c: After a page write failure, the calculation
of the block number to erase is incorrect.  The erase block size is
being passed as the erase block number in the call to mtd_erase().

Signed-off-by: Jeff Fryar <jeff.fryar@hp.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: consolidate help as display_help()
Brian Norris [Mon, 15 Aug 2011 20:17:05 +0000 (13:17 -0700)]
mtdinfo: consolidate help as display_help()

The help message for mtdinfo is unnecessarily disjointed. It is split
into three strings which reuse the PROGRAM_NAME string inefficiently and
don't have a consistent style.

This fixup should provide a cleaner look with aligned columns and
easier-to-read source code.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: fixup "example usage" help section
Brian Norris [Tue, 9 Aug 2011 21:36:45 +0000 (14:36 -0700)]
mtdinfo: fixup "example usage" help section

Line up columns better so that everything is more readable.

Remove "Example 1" since `mtdinfo' does not print information when not
given any arguments.

Remove "...UBI layout information" from description of Example 4, since
Example 4 (now 3) doesn't include the `-u' flag.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: restructure help message
Brian Norris [Tue, 9 Aug 2011 21:36:44 +0000 (14:36 -0700)]
mtdinfo: restructure help message

We weren't very consistent in how we listed our options in the mtdinfo
help string (listing short options, long options, or both). Plus, not all
options are inter-operable, so we should distinguish this somewhat.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: refactor code to remove "args.all" dependency
Brian Norris [Tue, 9 Aug 2011 21:36:43 +0000 (14:36 -0700)]
mtdinfo: refactor code to remove "args.all" dependency

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: don't open NULL pointer when getting region_info with `-a'
Brian Norris [Tue, 9 Aug 2011 21:36:42 +0000 (14:36 -0700)]
mtdinfo: don't open NULL pointer when getting region_info with `-a'

This "fixes" a regression found in:
  commit 266061ebd5d72391f0a0e831b018e8fc7fea68a1
  mtdinfo: add regioninfo/eraseblock map display

On certain flash (NOR flash that have eraseblock region info),
`mtdinfo -a' tries to open the MTD node file, for use with the ioctl
MEMGETREGIONINFO; however, we didn't supply a device node path to
`mtdinfo -a', so it's using NULL, resulting in errors like:

  mtdinfo: error!: couldn't open MTD dev: (null)
           error 14 (Bad address)

For now, we can just skip dumping region_info with the `-a' flag. If we
find a better way to do this (e.g., export via sysfs, find device nodes
via automatic routines, etc.), then we can kill the workaround and this
FIXME should be removed.

The regression was first reported at:

  http://lists.infradead.org/pipermail/linux-mtd/2011-July/037232.html

The result of recent changes is that we cannot get region_info for devices
via the `--all' option. We add a note in the help message warning that
mtdinfo may find more info when given a device patch, e.g., /dev/mtdX.

Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agoMakefile: show nice message when checking version.h
Brian Norris [Thu, 7 Jul 2011 20:44:27 +0000 (13:44 -0700)]
Makefile: show nice message when checking version.h

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agoMakefile: fix "make clean" for cross-compile
Brian Norris [Thu, 7 Jul 2011 20:44:26 +0000 (13:44 -0700)]
Makefile: fix "make clean" for cross-compile

When cross-compiling (make CROSS=mipsel-linux-), I get this error:

rm -rf /home/norris/git/mtd-utils/mipsel-linux
find /home/norris/git/mtd-utils/mipsel-linux/ -xdev \
'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
-exec rm -f {} +
find: `/home/norris/git/mtd-utils/mipsel-linux/': No such file or directory
make: *** [clean] Error 1

Now, for cross-compiling, we've already deleted the $(BUILDDIR), so we
should check this before cleaning individual objects with "find."

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agoMakefile: fix "version.h" build for cross-compiling
Brian Norris [Thu, 7 Jul 2011 22:16:17 +0000 (15:16 -0700)]
Makefile: fix "version.h" build for cross-compiling

When using "make CROSS=mipsel-linux-", I get the following errors:

/bin/sh: /home/norris/git/mtd-utils/mipsel-linux/include/version.h.tmp: No such file or directory
make: *** [/home/norris/git/mtd-utils/mipsel-linux/include/version.h.tmp] Error 1

Fix (suggested by Mike Frysinger): create the directory if it doesn't
exist. Also, $(CC) needs to be able to find the generated header in
$(BUILDDIR)/include.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agomkfs.ubifs: fix a gcc warning
Artem Bityutskiy [Mon, 4 Jul 2011 06:53:04 +0000 (09:53 +0300)]
mkfs.ubifs: fix a gcc warning

This patch "fixes" the following gcc warning:

mkfs.ubifs/mkfs.ubifs.c: In function ‘main’:
mkfs.ubifs/ubifs.h:420:2: warning: ‘child_cnt’ may be used uninitialized in this function [-Wuninitialized]
mkfs.ubifs/mkfs.ubifs.c:1735:6: note: ‘child_cnt’ was declared here

by initializing the ‘child_cnt’ to zero.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomkfs.ubifs: remove root inode squash feature
Artem Bityutskiy [Mon, 4 Jul 2011 06:48:37 +0000 (09:48 +0300)]
mkfs.ubifs: remove root inode squash feature

Remove the -squash-rino-perm mkfs.ubifs option as this was planned. Remove
the corresponding record from the feature-removal-schedule.txt file.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agoflash_erase: fix incorrect help message
Brian Norris [Wed, 29 Jun 2011 18:14:18 +0000 (11:14 -0700)]
flash_erase: fix incorrect help message

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtdinfo: remove -m leftovers
Artem Bityutskiy [Wed, 29 Jun 2011 16:09:29 +0000 (09:09 -0700)]
mtdinfo: remove -m leftovers

We have removed the -m option, but did not remove args.mtdn which represents
the -m parameters. Kill args.mtdn as well.

Tweaked by Brian Norris.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 years agomtdinfo: kill -m option
Brian Norris [Mon, 27 Jun 2011 18:27:26 +0000 (11:27 -0700)]
mtdinfo: kill -m option

According to feature-removal-schedule, we shouldn't use `-m', since
it relies on a specific device-naming pattern.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-utils: kill flash_info
Brian Norris [Mon, 27 Jun 2011 18:27:25 +0000 (11:27 -0700)]
mtd-utils: kill flash_info

According to "feature-removal-schedule," we kill flash_info in favor of
mtdinfo.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-utils: switch more utils to unified versioning
Brian Norris [Mon, 27 Jun 2011 18:27:24 +0000 (11:27 -0700)]
mtd-utils: switch more utils to unified versioning

More utilities now use the common VERSION system.

For utils that printed a very simple message, we use the new
common_print_version() "function."

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-utils: add common version printing function
Brian Norris [Tue, 28 Jun 2011 00:00:29 +0000 (17:00 -0700)]
mtd-utils: add common version printing function

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomkfs.ubifs: use common.h
Brian Norris [Mon, 27 Jun 2011 18:27:22 +0000 (11:27 -0700)]
mkfs.ubifs: use common.h

To use more unified versioning and to re-use other existing code,
switch to common.h.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-utils: update .gitignore files
Brian Norris [Mon, 27 Jun 2011 18:27:21 +0000 (11:27 -0700)]
mtd-utils: update .gitignore files

First, the top-level Makefile should not tell git to ignore sub-level
.gitignore files.

Second, add simple .gitignores to ignore the executables generated under
the various `tests' subdirectories.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-utils: remove whitespace at end of lines
Brian Norris [Mon, 27 Jun 2011 18:27:20 +0000 (11:27 -0700)]
mtd-utils: remove whitespace at end of lines

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-tests: io_paral: build error, "variable length strings"
Brian Norris [Mon, 27 Jun 2011 18:27:19 +0000 (11:27 -0700)]
mtd-tests: io_paral: build error, "variable length strings"

Some compilers will complain about use of strlen() within a static array
size declaration. For this type of string, "sizeof() - 1" is equivalent
and prevents the build error.

Error:

   io_paral.c:48:13: error: variably modified 'vol_nodes' at file scope

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtd-tests: checkfs: fix size_t related warning
Brian Norris [Mon, 27 Jun 2011 18:27:18 +0000 (11:27 -0700)]
mtd-tests: checkfs: fix size_t related warning

Depending on your compiler, size_t may or may not be long unsigned int.
Use printf's %zu format to clarify.

Warning message:

   checkfs.c:524:28: warning: format '%lu' expects type
   'long unsigned int', but argument 2 has type 'unsigned int'

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agonanddump: remove unused variable
Brian Norris [Mon, 27 Jun 2011 18:27:27 +0000 (11:27 -0700)]
nanddump: remove unused variable

The "bb_default" bool was temporarily being used to straighten out
potential issues with the changing --bb=METHOD options and to warn
users properly. Now, it's unnecessary.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agoautogenerate version.h from build system
Mike Frysinger [Sat, 25 Jun 2011 17:20:38 +0000 (13:20 -0400)]
autogenerate version.h from build system

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agorewrite build system to avoid recursion
Mike Frysinger [Sat, 25 Jun 2011 17:20:37 +0000 (13:20 -0400)]
rewrite build system to avoid recursion

The ubi-utils/src/ subdir is tossed as it just complicates things for no
real gain.  The dictionary.h header is relocated to the ubi-utils/include/
since other headers in there need it.

The top level clean is replaced with a `find -delete` on objects, so it
might prune more than necessary, but many projects now do this sort of
thing and no one complained there.

A "mkdep" helper generates the actual rule, and the variables are used
with "foreach" to expand these automatically.

The tests subdir is updated only to reflect the ubi-utils source move.
Otherwise, it is left untouched as making that non-recursive isn't really
worth the effort.

While we're gutting things, also through in kbuild style output while
building to make things more legible.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agobuild: remove old SYMLINKS variable
Mike Frysinger [Sat, 25 Jun 2011 06:30:01 +0000 (02:30 -0400)]
build: remove old SYMLINKS variable

This is only used to create symlinks to out of tree files.  I doubt it
has any relevance anymore now that jffs2 has been merged into mainline.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agointegck: fix build error (MS_DIRSYNC, MS_RELATIME)
Brian Norris [Fri, 24 Jun 2011 18:03:14 +0000 (11:03 -0700)]
integck: fix build error (MS_DIRSYNC, MS_RELATIME)

Need to include <linux/fs.h>, at least for my build system. Otherwise,
you can't build the 'tests'.

integck.c: In function ‘parse_mount_options’:
integck.c:2862: error: ‘MS_DIRSYNC’ undeclared (first use in this
function)
integck.c:2862: error: (Each undeclared identifier is reported only once
integck.c:2862: error: for each function it appears in.)
integck.c:2872: error: ‘MS_RELATIME’ undeclared (first use in this
function)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofeature-removal: remove completed tasks
Brian Norris [Fri, 24 Jun 2011 18:03:13 +0000 (11:03 -0700)]
feature-removal: remove completed tasks

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: default to NOT dumping OOB data
Brian Norris [Fri, 24 Jun 2011 18:03:12 +0000 (11:03 -0700)]
nanddump: default to NOT dumping OOB data

Since nandwrite doesn't write OOB data by default, we don't dump OOB data
by default, in order to be a more proper inverse function.

Remove the warnings and change the default.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: change -o to mean --oob, not --omitoob
Brian Norris [Fri, 24 Jun 2011 18:03:11 +0000 (11:03 -0700)]
nanddump: change -o to mean --oob, not --omitoob

As warned earlier, we are changing the meaning of `nanddump -o' to
mirror the usage in nandwrite, where -o means to include OOB (i.e.,
`nandwrite -o' writes data to both in-band and out-of-band areas, so
`nanddump -o' should dump data from both in-band and out-of-band areas).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: change default to --bb=skipbad
Brian Norris [Fri, 24 Jun 2011 18:03:10 +0000 (11:03 -0700)]
nanddump: change default to --bb=skipbad

As promised, we change the default bad block handling method to
--bb=skipbad. This works as a better inverse to nandwrite, since
nandwrite skips bad blocks when writing data.

And of course, we remove the warning messages.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: kill --omitbad, --noskipbad
Brian Norris [Fri, 24 Jun 2011 18:03:09 +0000 (11:03 -0700)]
nanddump: kill --omitbad, --noskipbad

As mentioned previously, we are killing --omitbad in favor of the new
--bb=skipbad option, which functions fairly similarly. Also, --noskipbad
has become --bb=dumpbad, so remove the old `-N' and `--noskipbad' flags.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agopunt redundant libcrc32 v1.4.5
Mike Frysinger [Sat, 25 Jun 2011 04:57:37 +0000 (00:57 -0400)]
punt redundant libcrc32

The libcrc32.a is only used in one place: mkfs.ubifs.  But this also
uses libmtd.a, and the only file in libcrc32.a is also in libmtd.a.
So libcrc32.a itself is completely redundant.  Punt!

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: bump nanddump, mtdinfo version numbers
Brian Norris [Thu, 23 Jun 2011 23:09:47 +0000 (16:09 -0700)]
mtd-utils: bump nanddump, mtdinfo version numbers

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: document, warn about future default --omitoob
Brian Norris [Wed, 22 Jun 2011 16:49:23 +0000 (09:49 -0700)]
nanddump: document, warn about future default --omitoob

To work as a proper inverse to nandwrite, nanddump must not dump OOB data by
default. This patch prints a warning regarding the future change. We also
suggest using the new flag, `--oob', for transitioning to the next release
with new default behavior.

Note that we are changing `-o' to mean `--oob' in the next release,
similar to `nandwrite -o'.  This is a break from previous behavior.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agonanddump: add --oob option
Brian Norris [Wed, 22 Jun 2011 16:49:22 +0000 (09:49 -0700)]
nanddump: add --oob option

Adds an explicit option for including OOB data in our data dump.
Currently, this is the default behavior, but in the next release, the
default will be to exclude OOB data. This is done to mirror the '-o'
option in nandwrite.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agofeature-removal-schedule: describe nanddump changes
Brian Norris [Wed, 22 Jun 2011 16:49:21 +0000 (09:49 -0700)]
feature-removal-schedule: describe nanddump changes

Include a few notes about the edited options and new defaults for bad
block handling in nanddump.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agonanddump: warn about new default BB handling
Brian Norris [Wed, 22 Jun 2011 16:49:20 +0000 (09:49 -0700)]
nanddump: warn about new default BB handling

In an upcoming release, we will no longer default to --bb=padbad. Instead,
the default will be --bb=skipbad. This makes nanddump a better inverse
operation to nandwrite.

This patch prints warnings for users so that they get a chance to update
their scripts before the default changes officially.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agonanddump: update help message for BB method changes
Brian Norris [Wed, 22 Jun 2011 16:49:19 +0000 (09:49 -0700)]
nanddump: update help message for BB method changes

--noskipbad will soon be replaced by --bb=dumpbad, and --omitbad is being
removed entirely in favor of --bb=skipbad.

This patch adds warnings when using inappropriate configurations and adds
info to the help message. Please plan to migrate to the new usages shortly.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agonanddump: remove --skipbad, leaving --bb=skipbad
Brian Norris [Wed, 22 Jun 2011 16:49:18 +0000 (09:49 -0700)]
nanddump: remove --skipbad, leaving --bb=skipbad

We are moving to unify bad block handling methods under the --bb=METHOD
option. Since --skipbad has not been included in a mtd-utils release yet,
we can safely replace it without a deprecation and phase-out period.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agonanddump: add --bb=METHOD option
Brian Norris [Wed, 22 Jun 2011 16:49:17 +0000 (09:49 -0700)]
nanddump: add --bb=METHOD option

We have too many separate bad block handling methods:
 --omitbad
 --noskipbad
 --skipbad
On top of these, we have the default option: that bad blocks are
replaced with 0xFF.

These options will be unified under --bb=METHOD. The end goal will be
something like:

----------------------------------------------------------------------------------------------
Old option     New option     Comment
----------------------------------------------------------------------------------------------
<default>      --bb=padbad    dump flash data, substituting 0xFF for any bad blocks
--noskipbad    --bb=dumpbad   dump flash data, including any bad blocks
--skipbad      --bb=skipbad   dump good data, completely skipping any bad blocks (new default)
--omitbad      N/A            very similar to `skipbad' (DEPRECTATED)

The BB options are all mutually exclusive, so we check that we do not
have more than one BB option explicitly enabled on the command line by
tracking whether or not a BB method has been set by the user.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtdinfo: add regioninfo/eraseblock map display
Mike Frysinger [Wed, 8 Jun 2011 19:11:32 +0000 (15:11 -0400)]
mtdinfo: add regioninfo/eraseblock map display

This brings the mtdinfo utility in line with the functionality
of the flash_info utility.  It dumps the erase regioninfo (if
the devices has it) as well as showing a handy eraseblock map
(if the user has requested it).  The eraseblock map also shows
which blocks are locked and which ones are bad.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtdinfo: remove now unused ubigen info
Mike Frysinger [Wed, 8 Jun 2011 18:52:28 +0000 (14:52 -0400)]
mtdinfo: remove now unused ubigen info

A previous commit moved the code using this var into a diff func.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtdinfo: separate out ubi information printing
Artem Bityutskiy [Wed, 8 Jun 2011 13:21:40 +0000 (16:21 +0300)]
mtdinfo: separate out ubi information printing

We are going to add some more code which prints eraseblocks map, so we need to
make 'print_dev_info()' a bit smaller to keep the code readable.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: improve mtd_islocked interface
Artem Bityutskiy [Wed, 8 Jun 2011 12:30:14 +0000 (15:30 +0300)]
libmtd: improve mtd_islocked interface

This patch first of all, re-names 'mtd_islocked()' into 'mtd_is_locked()' since
this seems to be the name Mike wanted, and it looks a bit nicer.

This patch also makes 'mtd_is_locked()' print an error message if it fails. I'm
not sure if it is good idea for a library to do so, but all functions do this,
so it certainly _not_ a good idea to be inconsistent.

However, for the special case, when the the "is locked" ioctl is not supported
or is not valid for this device, we do not print an error message and return
ENOTSUPP error code.

Thus, the user can distinguish between real errors and non-fatal "not
supported" cases.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: add helper funcs for getting regioninfo and locked info
Mike Frysinger [Tue, 7 Jun 2011 15:28:02 +0000 (11:28 -0400)]
libmtd: add helper funcs for getting regioninfo and locked info

This extends the libmtd with the helper functions:
mtd_regioninfo: interface to MEMGETREGIONINFO
mtd_islocked: interface to MEMISLOCKED

Users of these functions will follow shortly ...

Artem: do not print error message in mtd_islocked()

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agojffs2: make lzo optional at build time
Mike Frysinger [Tue, 7 Jun 2011 06:19:03 +0000 (02:19 -0400)]
jffs2: make lzo optional at build time

The external lzo dep can be a pain to deal with when cross-compiling,
so make it optional for jffs2.  This is useful if people aren't even
using the functionality, or for quicker development.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_info: deprecate
Mike Frysinger [Tue, 7 Jun 2011 15:11:37 +0000 (11:11 -0400)]
flash_info: deprecate

Artem: tweak the warning message

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: send help/version info to stdout
Mike Frysinger [Tue, 7 Jun 2011 15:02:02 +0000 (11:02 -0400)]
ubi-utils: send help/version info to stdout

Usage/version information should go to stdout when it is expected behavior
(i.e. the user requested it explicitly).  This info should go to stderr
only when the usage info is being shown as a result of incorrect options.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtdinfo: deprecate the -m option
Artem Bityutskiy [Tue, 7 Jun 2011 07:36:26 +0000 (10:36 +0300)]
mtdinfo: deprecate the -m option

... because mtd device node name do not have to follow the "/dev/mtd%d"
pattern.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: use O_CLOEXEC
Mike Frysinger [Tue, 7 Jun 2011 06:19:05 +0000 (02:19 -0400)]
libmtd: use O_CLOEXEC

Not strictly necessary, but this is good library behavior and
should carry no runtime overhead.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoinclude/mtd: sync with kernel
Mike Frysinger [Mon, 6 Jun 2011 18:22:16 +0000 (14:22 -0400)]
include/mtd: sync with kernel

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_info: allow people to get info on multiple devices
Mike Frysinger [Mon, 6 Jun 2011 18:22:15 +0000 (14:22 -0400)]
flash_info: allow people to get info on multiple devices

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_info: convert to common.h
Mike Frysinger [Mon, 6 Jun 2011 18:22:14 +0000 (14:22 -0400)]
flash_info: convert to common.h

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