aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-06-08flash_info: deprecateMike Frysinger
Artem: tweak the warning message Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-08ubi-utils: send help/version info to stdoutMike Frysinger
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>
2011-06-07mtdinfo: deprecate the -m optionArtem Bityutskiy
... because mtd device node name do not have to follow the "/dev/mtd%d" pattern. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-07libmtd: use O_CLOEXECMike Frysinger
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>
2011-06-07include/mtd: sync with kernelMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-07flash_info: allow people to get info on multiple devicesMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-07flash_info: convert to common.hMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-07ignore (FLAT) gdb filesMike Frysinger
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>
2011-06-06flash_{lock, unlock}: fix off-by-one error for "entire device" lengthSteven Miao
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>
2011-06-06flash_{lock,unlock}: convert to common codeMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-06flash_{lock,unlock}: merge into one utilMike Frysinger
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>
2011-06-06flash_{lock,unlock}: merge functionalityMike Frysinger
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>
2011-06-06flash_lock/flash_unlock/flash_info: clean up styleMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-06nanddump: sort options in help message alphabetically by shortnameBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-06nanddump: add --skipbad option for bad blocksBrian Norris
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>
2011-06-03mkfs.ubifs: trivial: 2.6.40 -> 3.0Ben Gardiner
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>
2011-05-31ubi-utils: ubimkvol: fix parameters parsing regressionArtem Bityutskiy
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>
2011-05-27fs-tests: integck: add some more error messagesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: print error message on errorArtem Bityutskiy
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>
2011-05-27fs-tests: integck: close files after creationArtem Bityutskiy
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>
2011-05-27fs-tests: integck: make directory checking workArtem Bityutskiy
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>
2011-05-27fs-tests: integck: add verbose reportingArtem Bityutskiy
Make -v switch control verbose integck output. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: always check clean dataArtem Bityutskiy
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>
2011-05-27fs-tests: integck: introduce a helper function for dir syncArtem Bityutskiy
Add a helper 'sync_directory()' function to synchronize directories. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: print name of directory which we cannot openArtem Bityutskiy
In 'dir_check()' print name of the directory if we fail to open it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: EIO can also be return in power-cut testingArtem Bityutskiy
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>
2011-05-27fs-tests: integck: implement MTD reattachingArtem Bityutskiy
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>
2011-05-20mkfs.ubifs: add "-F" option for "free-space fixup"Matthew L. Creech
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>
2011-05-20fs-tests: integck: read all files in power cut modeArtem Bityutskiy
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>
2011-05-20fs-tests: integck: verify truncation only if -v option was givenArtem Bityutskiy
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>
2011-05-20fs-tests: integck: fsync directories as wellArtem Bityutskiy
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>
2011-05-20fs-tests: integck: return error if fsync failsArtem Bityutskiy
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>
2011-05-20fs-tests: integck: fsync more oftenArtem Bityutskiy
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>
2011-05-20fs-tests: integck: verify clean filesArtem Bityutskiy
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>
2011-05-20fs-tests: integck: make -v work -eArtem Bityutskiy
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>
2011-05-20fs-tests: integck: check direntries in power cut modeArtem Bityutskiy
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>
2011-05-20fs-tests: integck: check errno in pvc macroArtem Bityutskiy
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>
2011-05-20fs-tests: integck: fix segfaultArtem Bityutskiy
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>
2011-05-20fs-tests: integck: introduce the clean flagArtem Bityutskiy
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>
2011-04-29fs-tests: integck: print error number in pcv messagesArtem Bityutskiy
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>
2011-04-29fs-tests: integck: re-structure file_write a littleArtem Bityutskiy
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>
2011-04-29fs-tests: integck: limit the recursion depthArtem Bityutskiy
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>
2011-04-29fs-tests: integck: fail loudly on unexpected EROFSArtem Bityutskiy
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>
2011-04-25fs-tests: integck: fix falures with SIGBUSArtem Bityutskiy
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>
2011-04-25fs-tests: integck: ignore -e if in power cut modeArtem Bityutskiy
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>
2011-04-25fs-tests: integck: fix line number in CHECK() outputArtem Bityutskiy
In 'check_failed()' use the file and line number provided by the CHECK() macro via the function parameters, rather than using __LINE__ directly. Otherwise the funtion prints its own line, instead of the line where the CHECK() failed. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: do not run checking when in power cut modeArtem Bityutskiy
Do not check the file-system when we are in power cut mode. Currently we still check the FS if we did not encounter any error, and the test fails sometimes because meanwhile write-back encounters an error and drops pages. Disable the checking so far. It should be enabled when we implement the 'clean' flag for files. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: introduce a helper for checkingArtem Bityutskiy
Introduce a 'check_tested_fs()' helper function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: print a bit less if in power cut modeArtem Bityutskiy
Do not print extra messages when unable to re-mount - they are already printed by the recover function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: improve remountability logicArtem Bityutskiy
The integck test assumes that if the FS is rootfs then it cannot re-mount it, otherwise it can. However, this is not true because the tested FS can be not remountable even if it is not rootfs, e.g., if 'integck' lives on this FS and is executed from it. This patch improves the integck logic and actually checks wheter it is possible to re-mount the FS before starting the test. Also, it makes sure that power cut testing is run only on re-mountable FS, because we have to be able to clean the "corrupted" state of the file-system. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>