aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-04-18fs-tests: integck: clean-up copy_stringArtem Bityutskiy
This is a clean-up patch which: 1. Simplifies copy_string by useng strdup instead of malloc 2. Adds an assertion which checks the input parameter agains NULL, instead of checking it. 3. Re-names it to dup_string which looks more readable to me. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: implement own parameters parsingArtem Bityutskiy
Instead of using shared command line arguments parsing routine implement own. The reason is that I want to add more parameters, which are integck-specific. Also, longer-term plan is to make integck independent of the common tests.c file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: change tests defaultsArtem Bityutskiy
Currently integck assumes that by default the file-system cannot do shared writable mmap-ing and does not preserve accurate file size after ENOSPC errors. And then it overrides these default settings if this is UBIFS. But it seems that only JFFS2 has those limitations. So make the defaults to be the opposite and override them for JFFS2 only. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: shrink write_info even moreArtem Bityutskiy
The 'struct write_info' data strucutre records information about truncation, and has a separate integer field to specify if this is a truncation or not. But it is too wasteful because we have huge amount of these objects. But it is easy to notice that the 'random_seed' field is not used for truncation records, so we can use that as the truncation flag. This patch introduces MAX_RANDOM_SEED macro and when the 'random_seed' field is greater than that, we treat it as the truncation flag. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: abuse random_offset field nicerArtem Bityutskiy
Currently integck uses the 'random_offset' filed to store the new file length sometimes, thus abusing this field. But we can do this nicer - introduce an anonymous union and add 'new_length' filed which will be used instead of 'random_offset' to make the code look nicer. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: srink file_info structure even moreArtem Bityutskiy
The 'check_run_no' field does not have to be 64-bit, it can be 32-bit instead and we can save 4 bytes per object. Actually, it could also be 16-bit, and we could make link_count 16-bit as well, but that would need a bit more work. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: shrink file_info structure sizeArtem Bityutskiy
We do not have to store boolean flags in 'int' variables which consume 4 bytes each, we can store those in bit-fields instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: shrink dir_entry_info structure sizeArtem Bityutskiy
Turn "int checked" flag into 'char' flag to lessen memory consumption a bit. Indeed, the test allocates a lot of these data objects, so the size decrease from 36 to 32 bytes on 32-bit platforms is good to have. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14tests: ubi-tests: clean libubi.a and *.oAndy Shevchenko
The common.mk contains clean target that removes *.o and $(TARGETS). Thus, make custom clean target only for libubi.a Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14tests: checkfs: adjust MakefileAndy Shevchenko
This patch brings common Makefile (in terms of mtd-utils project) to the checkfs test suite. Additionally it fixes a build error related to usage of open(). Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14tests: fs-tests: read() returns ssize_t valueAndy Shevchenko
Use ssize_t instead of size_t. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14mkfs.jffs2: fix casting of printf argumentAndy Shevchenko
The compiler warns us about cast mismatch for %9lu specifier. In original code the argument has __off64_t type. Here is a simple type casting fix. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: use common printing macrosArtem Bityutskiy
Instead of using printf() directly, use the shared mtd-utils printing macros. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: include the common mtd-utils headerArtem Bityutskiy
Include the commong mtd-utils "common.h" header in integck test to make it possible to use shared macros. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
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>