aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-04-11fs-tests: integck: remove unnecessary checkArtem Bityutskiy
The 'link_new()' function has only one user, and the user checks that the third 'file' argument is non NULL, so remove this check from 'link_new()'. Let's be consistent and assume the 3rd argument is never NULL, just like the first and the second ones. This is just a minor improvement. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: simplify dir_entry_info fieldsArtem Bityutskiy
Instead of using named union 'entry' in 'struct dir_entry_info' and having to type long 'entry->entry.file', 'entry->entry.symlink', etc, use anonymous union which makes the syntax simpler: 'entry->file', 'entry->symlink', etc. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: do not cast void pointersArtem Bityutskiy
The malloc function returns 'void *', so it is not necessary to cast it when assigning. This is just a small clean-up patch. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: introduce zallocArtem Bityutskiy
The integck test often allocates memory and fills it with zeroes. Introduce a helper function for this frequent operation. This is just a clean-up patch which makes the code 23 lines shorter. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-09mtd-utils: switch ubi and ubifs tools to use common strtoX funcsArtem Bityutskiy
Instead of using strtol and Co directly, use our share simple_strtoX() helpers. This is just a cleanup. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-09mtd-utils: improve simple_strtoX usage commentaryArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-09fs_tests: make the test-suite finish fasterArtem Bityutskiy
Currently the stress tests may run up to 1 hour, make the limit to be 6 minutes instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-08mtd-utils: Makefile: introduce cscope targetArtem Bityutskiy
Add a "cscope" target to make it easier to develop in the repository. Indeed, many people like me are accustomed to "make cscope" in the kernel, and it is very convenient to have this in mtd-utils as well. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-07Makefile: introduce new target tests in MakefileAndy Shevchenko
This patch appends Makefile to the tests subdirectory and introduces tests target in the root Makefile. Additionally the clean target removes temporary stuff under tests subdirectory as well. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: jittertest: fix set of compiler warningsAndy Shevchenko
- time() was used without prototype. - the return value of read() and write() wasn't checked - classificator in printf() was wrong for argument of size_t type Don't continue to read the /proc/profile in case when write was failed. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: ubi-tests: seed_random_generator() was used w/o prototypeAndy Shevchenko
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: fs-tests: check return value of functionsAndy Shevchenko
chdir() returns negative value in case of error. fscanf() returns amount of successfully parsed parameters. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: checkfs: fix linker warningsAndy Shevchenko
The sys_errlist[errno] is deprecated. We should use strerror(errno) instead. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: checkfs: fix compiler warningsAndy Shevchenko
There are two warnings: - strlen() is used without prototype - argument of printf() is unsigned long, but used specifier is for int This patch fixes them. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: make jittertest buildableAndy Shevchenko
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-04mkfs.ubifs: check output firstAndy Shevchenko
Artem: this is jut a clean-up, no functional changes. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-01libmtd: fix OOB read and write interfacev1.4.4Artem Bityutskiy
When reading and writing OOB we specify the address as absolute offset from the beginning of the MTD device. This offset is basically an absolute page offset plus the OOB offset. And it does not have to be aligned to the min. I/O unit size (NAND page size). So fix the 'do_oob_op()' function and remove incorrect checking that the offset is page-aligned. This check leads to the following errors: libmtd: error!: unaligned address 2, mtd0 page size is 2048 But obviously, the intent was to write to offset 2 of the OOB area of the very first NAND page. Instead of that incorrect check, we should check that the OOB offset we write to is within the OOB size and the length is withing the OOB size. This patch adds such check. Reported-by: Kelly Anderson <kelly@silka.with-linux.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Tested-by: Kelly Anderson <kelly@silka.with-linux.com>
2011-03-24fs-tests: integck: improve re-mounting test coverageArtem Bityutskiy
The integck tests re-mounts the file-system from time to time and checks the integrity afterwords. And it re-mounts always the same-way: unmount and then mount R/W back. However, it is better to do it differently some times, e.g.: * re-mount R/O then re-mount R/W * unmount then mount R/W * both of the above * unmount, mount R/O, then re-mount R/W * etc. This will give better test coverage. This patch does exactly that by improving the 'tests_remount()' function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-24fs-tests: perf: fix compilation warningArtem Bityutskiy
Fix the following compilation warning: perf.c: In function ‘perf’: perf.c:144: warning: format ‘%lld’ expects type ‘long long int’, but argument 2 has type ‘int64_t’ by adding a (long long int) cast. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-24fs-tests: test_1: fix compilation warningsArtem Bityutskiy
Fix the following compilation warnings: test_1.c: In function ‘test_1’: test_1.c:67:4: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ test_1.c:88:3: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ The fix is to cast the argument with (unsigned long long). Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-18nanddump: fail if -s parameter is unalignedArtem Bityutskiy
Implement the feature which we planned long time ago - make nanddump fail if the -s parameter is not NAND page-aligned. Also bump nanddump version. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-18mkfs.ubifs: deprecate squash-rino-perm optionsArtem Bityutskiy
As we have planned, make --nosquash-rino-perm option to be the default. Deprecate both options at the same time and print a warning if they are used. Later we can remove them Also, bump mkfs.ubifs version number. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-18flash_erase: increas version numberv1.4.3Artem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-18flash_erase: start position should be in bytesPeter Korsgaard
Commit a8801d8 (unify flash_erase and flash_eraseall) changed the flash_erase interface in a backwards incompatible way. Before that commit start position was given in bytes, and now it must be provided in blocks. While I agree the new interface is nicer, we shouldn't break the interface. I have scripts that expect the old behaviour, and I'm most likely not alone, so change the interface back to the old way. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-08nandwrite: add only write oob optionLei Wen
Write only oob part goes different path in nand_base.c, it is better to have userland program so that we could easy debug this path when the write only oob fail like the mtd_oobtest in mtd_test suit. Signed-off-by: Lei Wen <leiwen@marvell.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-02-25mtd-utils: common.h: simple_strtoll type usageBrian Norris
We must use "long long" and "unsigned long long" types when implementing the functions "simple_strtoll()" and "simple_strtoull()", respectively. This prevents casting/truncation errors on systems where "long" is not the same size as "long long" (that is, on most systems). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-01-16mkfs.jffs2: fix repeated dev nodesv1.4.2Thomas Chou
Fix the repeated nodes with the same primary name in device_table.txt. They were not generated correctly. /dev/tty c 666 0 0 5 0 0 0 - /dev/tty c 666 0 0 4 0 0 1 6 # IDE Devices /dev/hda b 640 0 0 3 0 0 0 - /dev/hda b 640 0 0 3 1 1 1 15 /dev/hdb b 640 0 0 3 64 0 0 - /dev/hdb b 640 0 0 3 65 1 1 15 Only created, /dev/tty /dev/hda /dev/hdb Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-01-16mkfs.jffs2: fix devtable count as mkfs.ubifs doesThomas Chou
The counting was incorrect. Follow that of mkfs.ubifs. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nandwrite: use common.h "errmsg_die"Brian Norris
errmsg_die() should be nearly the equivalent of the error message used here. This saves a few lines. Also edited the error message to include the offending option and got rid of the quotes. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nandwrite: add check for negative blockalignBrian Norris
Includes error messages for negative blockalign, telling the user what the offending option and value were. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nanddump: choose correct "printf" format-specifierBrian Norris
The mtd-descriptor attributes contain signed data, not unsigned. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nanddump: check for negative inputsBrian Norris
Includes error messages for negative device offsets and negative lengths, telling the user what the offending option and value were. Previous patch left out the "negative" in the error message. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nanddump: change "unsigned" to "signed"Brian Norris
For consistency between nanddump and nandwrite and in order to provide better means for checking for negative inputs, the "offset" and "length" types in nanddump should be changed to signed integer types. This also solves a signed/unsigned comparison warning. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nanddump: Refactor pretty print code into an sprintf()Brian Norris
A do-while loop in pretty_dump_to_buffer() can be refactored into a single sprintf() statement. MAX() and MIN() are used to ensure that: (1) We have at least a single space between hex and ASCII output (2) We don't overflow the line buffer This patch was suggested by Mike Frysinger. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02common.h: Add MAX() macro, fix MIN()Brian Norris
Add MAX() macro to common.h, to be used in future patches. Also a style change in comma location on MIN(). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-02nanddump/nandwrite: use "simple_" str functionsBrian Norris
Per Mike Frysinger's suggestion, we check for strtoll() and strtoull() errors by using the "common.h" helper functions simple_strtoll() and simple_strtoull(). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-29libmtd: fix OOB size initialization in legacy codeKetil Froyn
legacy_get_dev_info() forgot to set the OOB size Signed-off-by: Ketil Froyn <ketil@froyn.name> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: type consistencyBrian Norris
Change type off "offs" for type consistency of 64-bit data types. The "loff_t" type is no longer needed for the MEMGETBADBLOCK ioctl since it isn't called dirently anymore - this is handled by mtd_is_bad(). Also change an accompanying printf(). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: full 64-bit support w/ libmtdBrian Norris
Several ioctls are replaced with libmtd calls which should give us 64-bit support for large devices. libmtd mostly provides drop-in replacements for the functionality we need. However, when we require erasure of a badly-written block, mtd_erase() only erases a single block, whereas MEMERASE could erase a larger region. In nandwrite, we may have a "virtual blocksize" of more than one (when blockalign > 1). Thus, I added a loop for this case. The mtd_oob_buf struct is no longer needed, nor is "erase_info_t". Error messages for the new libmtd calls reflect the style found in flash_erase. Tested with nandsim and with NAND chips up to 4GB in size (I don't have a device that truly requires 64-bit addressing yet). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: prevent 32-bit overflowBrian Norris
For large block- and page-sizes, the multiplication of ebsize_aligned and pagelen can overflow a 32-bit integer. This overflow can be prevented by a simple change in order of operations (i.e., do division first). Since ebsize_aligned is always a multiple of mtd.min_io_size, this produces no change in results. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: avoid NULL buffer pointersBrian Norris
Commit 07005d915d6a79dbdee14b0c4360df5058c3a98b made changes to the buffer allocation in nandwrite and did not handle all affected code areas properly. In particular, we were assigning: oob.ptr = noecc ? oobreadbuf : oobbuf; However, since oobreadbuf and oobbuf are declared dynamically, they are NULL at this point. If they aren't properly assigned later, we unwittingly are passing a NULL pointer as oob buffer. This assignment line is best moved after the buffer allocations and pointer assignment. Effects of this problem can be seen when writing oob data with the "-o" flag and without the "-n" flag: $ ./nandwrite -o /dev/mtd0 img.bin Writing data to block 0 at offset 0x0 ioctl(MEMWRITEOOB): Bad address Data was only partially written due to error : Bad address Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: Use 64-bit offsetBrian Norris
To support large NAND devices, we need 64-bit data types for write offsets. This patch makes data type changes along with their corresponding printf() formats and the input conversion (i.e., use "strtoll()" instead of "strol()"). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: Use libmtd to get correct mtd parametersBrian Norris
Begin utilizing libmtd for MTD operations: use mtd_get_dev_info() to return a more detailed set of information about our MTD. Most importantly, libmtd will yield a 64-bit "size" parameter. This is necessary to properly detect devices larer than 4GB. printf() arguments needed reformatted for the new mtd_dev_info data types. In addition, the printf() was restructured to keep lines shorter. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: switch "oobsize" for "writesize"Brian Norris
The text of a printf() states that we're printing OOB area, but the corresponding argument passes writesize. That probably wasn't the intent. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: Clarify usage of aligned "erasesize"Brian Norris
Due to the presence of the "--block-align" flag, nandwrite uses a blocksize throughout that, depeding on the execution parameters, may not be the actual erasesize of the NAND flash. In order to clarify this situation for the untrained viewer of nandwrite's code, we should not change the value of "meminfo.erasesize" itself; rather, we can utilize a separate, calculated "ebsize_aligned". Then, when a user actually wants to refer to the physical erasesize, it's straightforward. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nandwrite: Comment, style fixupsBrian Norris
Comment on "blockalign" default value is incorrect; it only defaults to a 1x multiplier of the actual block size. Perhaps this is a relic of early NAND where all block sizes were 16KB? Reformatted a multi-line comment. Changed separete "if" statements to a combined "if-else-if" since they were logically combinable. Should have no effect on results with minor effect on efficiency. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-11-13mtd-utils: nanddump: Allow 64-bit lengthsBrian Norris
We should allow the dump length to be 64-bit, especially since the value was read in as a "long long" by strtoll(). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-27Fix make install errorsMike Frysinger
This patch heals 'make install' which tried to install the utilities to '/usr/local//usr/sbin'. Reported-by: Charles Manning <manningc2@actrix.gen.nz> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-25mkfs.ubifs: Fix typo in short options of mkfs.ubifsVivenzio Pagliari
The short option for specifying the count of erase blocks for orphans '-p' was not detected due to a typo. Signed-off-by: Vivenzio Pagliari <vivenzio.pagliari@gmx.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-25mtd-utils: nanddump: add 64-bit support, utilize libmtdBrian Norris
Adds support for 64-bit offsets (i.e., devices larger than 4GB). Utilizes the "unsigned long long" data type as the standard type for 64-bit offsets throughout. Reformats a few printf statements to avoid casting and to properly handle "long long." Calls to ioctls are mostly replaced by libmtd interfaces (which should choose the proper ioctls for us); however, a few remain and probably should be handled with more robust interfaces, as some of these ioctls are considered "legacy." Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>