]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
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>
14 years agoignore (FLAT) gdb files
Mike Frysinger [Mon, 6 Jun 2011 17:15:01 +0000 (13:15 -0400)]
ignore (FLAT) gdb files

Linux FLAT toolchains produce .gdb files alongside the normal program
for debugging purposes (so linking to "foo" will also produce "foo.gdb").
Ignore these too.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_{lock, unlock}: fix off-by-one error for "entire device" length
Steven Miao [Mon, 6 Jun 2011 04:09:14 +0000 (00:09 -0400)]
flash_{lock, unlock}: fix off-by-one error for "entire device" length

This basically reverts commit 43feb39f35a9ee0ed3 which changed the full
length calculation to be one less than one sector.  I don't understand
the logic in the commit message where it states that the length should
be one sector smaller as this results in misbehavior at runtime.

For example, with a mtd device with total size 0x400000 and erase block
size of 0x20000 (which gives us a total of 32 sectors), this new logic
results in:
mtdLockInfo.start = 0;
mtdLockInfo.length = 0x3e0000; /* (32 - 1) * 0x20000 */

Calling MEMLOCK/MEMUNLOCK on the device with this range leaves the last
sector unchanged which is certainly not what we want.  So drop this -1
part of the calculation.

To look at it another way, if we only attempt to lock one sector, this
calculation would end up with the .length set to 0.  Calling MEMLOCK
with a length of 0 does not lock the sector as this simple code shows:
int main(int argc, char *argv[]) {
erase_info_t e0 = { 0, 0 }, e1 = { 0, 0x20000 };
int fd = open(argv[1], O_RDONLY);
ioctl(fd, MEMUNLOCK, &e1);
printf("%i\n", ioctl(fd, MEMISLOCKED, &e1));
ioctl(fd, MEMLOCK, &e0);
printf("%i\n", ioctl(fd, MEMISLOCKED, &e1));
}
MEMISLOCKED returns 0 both times.  If we change the argument to MEMLOCK
to e1, then MEMISLOCKED returns 1.

Signed-off-by: Steven Miao <realmz6@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_{lock,unlock}: convert to common code
Mike Frysinger [Mon, 6 Jun 2011 04:09:13 +0000 (00:09 -0400)]
flash_{lock,unlock}: convert to common code

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_{lock,unlock}: merge into one util
Mike Frysinger [Mon, 6 Jun 2011 04:09:12 +0000 (00:09 -0400)]
flash_{lock,unlock}: merge into one util

Now that the utils have equivalent functionality, merge the two source
code bases so they can't diverge in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_{lock,unlock}: merge functionality
Mike Frysinger [Mon, 6 Jun 2011 04:09:11 +0000 (00:09 -0400)]
flash_{lock,unlock}: merge functionality

The flash_lock util has a bit of extra argument checking, and it supports
a magic value of "-1" to mean "all blocks".

The flash_unlock util supports automatic 2nd/3rd arguments to unlock the
whole flash.  It also supports multiple bases (not just hex) for selecting
the range of the device to unlock.

So tweak both utilities so that they have equivalent functionality again
by adding the missing features to each.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_lock/flash_unlock/flash_info: clean up style
Mike Frysinger [Mon, 6 Jun 2011 04:09:10 +0000 (00:09 -0400)]
flash_lock/flash_unlock/flash_info: clean up style

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: sort options in help message alphabetically by shortname
Brian Norris [Fri, 3 Jun 2011 18:25:01 +0000 (11:25 -0700)]
nanddump: sort options in help message alphabetically by shortname

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: add --skipbad option for bad blocks
Brian Norris [Fri, 3 Jun 2011 18:25:00 +0000 (11:25 -0700)]
nanddump: add --skipbad option for bad blocks

This patch adds a new option "--skipbad" to nanddump. It is subtly
different than "--omitbad". The following description was included in
the help message to attempt to clarify the differences.

 Notes on --omitbad and --skipbad:
   With either option, we stop dumping data when we encounter a bad block
   and resume dumping at the next good block. However, with --omitbad, we
   count the bad block as part of the total dump length, whereas with
   --skipbad, the bad block is 'skipped,' that is, not counted toward the
   total dump length.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: trivial: 2.6.40 -> 3.0
Ben Gardiner [Wed, 1 Jun 2011 13:49:36 +0000 (09:49 -0400)]
mkfs.ubifs: trivial: 2.6.40 -> 3.0

In commit 04665066ebedb0a31335b525fb5f19df32cb8cfe it was noted that the free
space fixup feature would be available in kernels 2.6.40 or greater. Since
then it has been decided that the release following 2.6.39 will be 3.0.

Replace the instances of 2.6.40 with 3.0.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: ubimkvol: fix parameters parsing regression
Artem Bityutskiy [Tue, 31 May 2011 05:07:41 +0000 (08:07 +0300)]
ubi-utils: ubimkvol: fix parameters parsing regression

Commit 924862c864da0b62cf93ba7abf2dc78a7e6ac48f broke ubimkvol parrameters
parsing by initializing the 'error' parameter of 'simple_strtoul()' to 1
instead of 0. This patch fixes the issue.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: add some more error messages
Artem Bityutskiy [Thu, 26 May 2011 13:04:20 +0000 (16:04 +0300)]
fs-tests: integck: add some more error messages

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: print error message on error
Artem Bityutskiy [Thu, 26 May 2011 11:58:26 +0000 (14:58 +0300)]
fs-tests: integck: print error message on error

Currently pcv macro print the error message only if we are not doing power cut
testing or if we have -v flag. But if we run without -v and an error happen
and the error code is not EROFS/EIO, pcv() does not print anything. This patch
makes it print the error message in that case as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: close files after creation
Artem Bityutskiy [Thu, 26 May 2011 10:43:13 +0000 (13:43 +0300)]
fs-tests: integck: close files after creation

The 'file_new()' function should create a file but should not keep it
open. There is a different path to open files and keep them open. This
patch makes 'file_new()' close newly created files.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: make directory checking work
Artem Bityutskiy [Wed, 25 May 2011 15:22:51 +0000 (18:22 +0300)]
fs-tests: integck: make directory checking work

This patch makes the directory checking in case of power cut emulation
actually work. There were many bugs. Basically, we cannot rely on anything
unless the directory is marked as clean.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: add verbose reporting
Artem Bityutskiy [Wed, 25 May 2011 14:27:49 +0000 (17:27 +0300)]
fs-tests: integck: add verbose reporting

Make -v switch control verbose integck output.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: always check clean data
Artem Bityutskiy [Tue, 24 May 2011 14:46:11 +0000 (17:46 +0300)]
fs-tests: integck: always check clean data

Check the clean data after every emulated power cut, not only when
'create_test_data()'/'update_test_data()' succeed. This required some minor
re-work.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: introduce a helper function for dir sync
Artem Bityutskiy [Tue, 24 May 2011 13:33:04 +0000 (16:33 +0300)]
fs-tests: integck: introduce a helper function for dir sync

Add a helper 'sync_directory()' function to synchronize directories.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: print name of directory which we cannot open
Artem Bityutskiy [Tue, 24 May 2011 13:31:30 +0000 (16:31 +0300)]
fs-tests: integck: print name of directory which we cannot open

In 'dir_check()' print name of the directory if we fail to open it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: EIO can also be return in power-cut testing
Artem Bityutskiy [Mon, 23 May 2011 11:30:01 +0000 (14:30 +0300)]
fs-tests: integck: EIO can also be return in power-cut testing

Currently when we are doing UBIFS power cut emulation testing we assume that
EROFS is returned in case of an emulated power cut event. However, this is
not true and sometimes Linux returns EIO to user-space instead. Namely, this
happens when we are waiting for write-back to finish. Here is a call trace
form kernel 2.6.39-rc7:

Call Trace:
 [<ffffffff810aaa77>] filemap_write_and_wait_range+0x78/0xb1
 [<ffffffff8110f34d>] vfs_fsync_range+0x38/0xd3
 [<ffffffff8110f42b>] generic_write_sync+0x43/0x65
 [<ffffffff810ab0c9>] generic_file_aio_write+0xaa/0xf2
 [<ffffffffa02224c9>] ubifs_aio_write+0x13a/0x1a1 [ubifs]
 [<ffffffff810ed71f>] do_sync_write+0xcb/0x141
 [<ffffffff810ee016>] vfs_write+0xb0/0x150
 [<ffffffff810ee175>] sys_write+0x48/0x72
 [<ffffffff813e0692>] system_call_fastpath+0x16/0x1b

'filemap_fdatawait_range()' returns hard-coded -EIO if a page write-back
happens with whatever error code.

Thus, this patch teaches integck to handle EIO when doing power cut emulation
testing.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: implement MTD reattaching
Artem Bityutskiy [Fri, 20 May 2011 15:27:36 +0000 (18:27 +0300)]
fs-tests: integck: implement MTD reattaching

This patch adds -m <mtdnum> option to integck and teaches integck to re-attach
the MTD device to UBI in case of an emulated power cut event. This is needed
for the new UBI power cut and unstable bits emulation infrastructure: when UBI
emulates a power cut the only way to recover form this is to re-attach the MTD
device.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: add "-F" option for "free-space fixup"
Matthew L. Creech [Wed, 11 May 2011 21:02:28 +0000 (17:02 -0400)]
mkfs.ubifs: add "-F" option for "free-space fixup"

This adds a superblock flag indicating that "free-space fixup" is needed, and
allows it to be set by the user via the "-F" command-line option.  The first
time the filesystem is mounted, this flag will trigger a one-time re-mapping of
all LEBs containing free space.  This fixes problems seen on some NAND flashes
when a non-UBIFS-aware flash programmer is used.

Artem: add a bit more help text, tweaked the patch a bit.

Thanks to Ben Gardiner <bengardiner@nanometrics.ca> for help.

Signed-off-by: Matthew L. Creech <mlcreech@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: read all files in power cut mode
Artem Bityutskiy [Tue, 17 May 2011 07:28:00 +0000 (10:28 +0300)]
fs-tests: integck: read all files in power cut mode

When we are in power cut mode read all files after re-mounting. This will
check that FS recovery worked well and all files are readable after recovery.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: verify truncation only if -v option was given
Artem Bityutskiy [Tue, 17 May 2011 04:46:25 +0000 (07:46 +0300)]
fs-tests: integck: verify truncation only if -v option was given

Currently we always verify holes when truncating, but we have -v switch for
this and should do this only if -v was given.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: fsync directories as well
Artem Bityutskiy [Tue, 17 May 2011 03:51:46 +0000 (06:51 +0300)]
fs-tests: integck: fsync directories as well

Call 'fsync()' for directories sometimes as well, and check synchronized
directories after re-mount - cound of directory entries has to be correct.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: return error if fsync fails
Artem Bityutskiy [Tue, 17 May 2011 03:26:45 +0000 (06:26 +0300)]
fs-tests: integck: return error if fsync fails

If 'fsync()' or 'fdatasync()' fail we have to return an error, but we by
mistake were returning 0 (success).

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: fsync more often
Artem Bityutskiy [Tue, 17 May 2011 03:25:32 +0000 (06:25 +0300)]
fs-tests: integck: fsync more often

Currently integck calls 'fsync()' very rarely - with 0.1% probability. Make
this happen more often - with 1% probability.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: verify clean files
Artem Bityutskiy [Tue, 17 May 2011 03:19:38 +0000 (06:19 +0300)]
fs-tests: integck: verify clean files

Allow verification for clean files, i.e. the files which had been fsync()'ed
before the emulated power cut happened.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: make -v work -e
Artem Bityutskiy [Mon, 16 May 2011 14:04:49 +0000 (17:04 +0300)]
fs-tests: integck: make -v work -e

Make the verify option -v work with power cut emulation option -e. We can
verify all operations except of writing to the file, because of write-back.
Indeed, even if we write successfully, the pages may still be in the page-cache
and if an emulated power cut happens they will be dropped, and our verification
will fail.

I am not 100% sure it is save to verify non-write operation in other FSes, but
only UBIFS has power cut emulation mode now, so we do not really care about
other FSes at this point.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: check direntries in power cut mode
Artem Bityutskiy [Mon, 16 May 2011 13:57:05 +0000 (16:57 +0300)]
fs-tests: integck: check direntries in power cut mode

Enable directory entry checking in power cut mode. This means that with this
patch integck will check that all directory entries in the file-system were
created by integck.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: check errno in pvc macro
Artem Bityutskiy [Tue, 3 May 2011 12:02:58 +0000 (15:02 +0300)]
fs-tests: integck: check errno in pvc macro

All errors but write errors have corresponding CHECK(), so if something
gets wrong we fail. But in case of I/O errors we do not fail if an
unexpected error happens, which makes it difficult to trace issues.
Inject the errno checking to the pvc macro to make sure we fail if
errno is not EROFS.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: fix segfault
Artem Bityutskiy [Mon, 2 May 2011 15:19:47 +0000 (18:19 +0300)]
fs-tests: integck: fix segfault

Commit 1394a46213e8180e1233ca6d4811e7c77d49b1e0 was a good idea, but it
introduced a segfault - files can be unlinked and 'file->links' is NULL, it is
bad idea to unconditionally dereference it with 'file->links->name'. This patch
introduces a helper function which takes care of the situation with unlinked
files, plus it adds few assertions.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: introduce the clean flag
Artem Bityutskiy [Tue, 26 Apr 2011 10:16:25 +0000 (13:16 +0300)]
fs-tests: integck: introduce the clean flag

Introduce per-file "clean" flag which tells whether the file is synchronized or
not. This flag is not really used so far.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: print error number in pcv messages
Artem Bityutskiy [Tue, 26 Apr 2011 11:22:58 +0000 (14:22 +0300)]
fs-tests: integck: print error number in pcv messages

In pcv() messages also print the error number - this is useful when
an error happens and it is not because of EROFS.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: re-structure file_write a little
Artem Bityutskiy [Tue, 26 Apr 2011 10:26:43 +0000 (13:26 +0300)]
fs-tests: integck: re-structure file_write a little

This is just a preparation - re-structure 'file_write()' to make one "success"
return point - we'll add synchronization stuff there. Also, while on it, make
it delete the file errored in truncation, not only in write. Also, move
the fsync() call to this function because it is common to all write paths.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: limit the recursion depth
Artem Bityutskiy [Tue, 26 Apr 2011 09:47:48 +0000 (12:47 +0300)]
fs-tests: integck: limit the recursion depth

I observes segfaults in integck test, and unfortunately I do not have the core
file to investigate the problem. But I see one possibility for the test to
segfault - it has unbounded recursion. Limit the maximum recursion depth.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: fail loudly on unexpected EROFS
Artem Bityutskiy [Tue, 26 Apr 2011 06:59:56 +0000 (09:59 +0300)]
fs-tests: integck: fail loudly on unexpected EROFS

If we are not in power cut testing mode (-p was not used) and we get an
unexpected EROFS, we silently exit. This patch fixes this behavior and make
the test loudly fail instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: fix falures with SIGBUS
Artem Bityutskiy [Sun, 24 Apr 2011 11:12:13 +0000 (14:12 +0300)]
fs-tests: integck: fix falures with SIGBUS

The test sometimes dies due to SIGBUS because a power cut event happens when
we are writing to an mmap()'ed area. SIGBUS is very difficult to ignore, so
fix the issue simply by avoiding doing 'mmap()' operations when in power cut
testing mode.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agofs-tests: integck: ignore -e if in power cut mode
Artem Bityutskiy [Sun, 24 Apr 2011 07:08:41 +0000 (10:08 +0300)]
fs-tests: integck: ignore -e if in power cut mode

Similarly to the previous commit, do not verify operations when in
power-cut testing mode. Again, this is because write-back may fail
meanwhile.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>