summaryrefslogtreecommitdiff
path: root/ubi-utils/src/libmtd.c
AgeCommit message (Collapse)Author
2010-06-15ubi-utils: harmonize libmtd interface a bitArtem Bityutskiy
Let's consistently use 'mtd_num' name for MTD device number. At the moment some code uses 'mtd_num', other 'dev_num'. Harmonize that. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-06-14libmtd: add mtd_write_imgArtem Bityutskiy
Add another helper interface which can be used to write an image to an mtd device. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubiformat: torture eraseblocks on write errorsArtem Bityutskiy
When fail to write to PEBs, and the error is EIO, torture the PEB before marking it as bad. Basically, the code is copied from the kernel UBI. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-02libmts: recognize pre-MTD-sysfs kernels betterArtem Bityutskiy
Not-so-old linux kernel like 2.6.29 do already have "/sys/class/mtd/mtdX" directories, while very old kernels do not. But in 2.6.29 these directories do not contain any information. Anyway, the logic in libmtd which checked whether the system supports sysfs was broken, because it assumed that old systems do not even have "/sys/class/mtd/" directory. Fix this problem by checking for "/sys/class/mtd/mtdX/name". If this is present - the system really has sysfs support. This patch also adds an extra print to libmtd. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-11ubi-utils: fix memory corruptionsArtem Bityutskiy
This patch contains changes similar to the ones in the previous patch. Also, it changes all invocations of memset and makes sure the argument is 0, not '\0', because memset expects int, not char. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-11ubi-utils: add sysfs interface support and new toolArtem Bityutskiy
This large commit makes several things. 1. Switches libmtd to use the new sysfs interface 2. Implements new handy 'mtdinfo' utility 3. Does minore amendmends in libubi and some ubi-tools. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: make type_str to be an arrayArtem Bityutskiy
This is a prepearation to the coming sysfs interface support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: rename num fieldArtem Bityutskiy
This is a preparation for the coming sysfs support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: rename rdonly fieldArtem Bityutskiy
This is a preparation for the coming sysfs support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: rename allows_bb fieldArtem Bityutskiy
This is a preparation for the coming sysfs support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-20libmtd: rename mtd_infoArtem Bityutskiy
Rename 'struct mtd_info' to 'struct mtd_dev_info' to reflect the fact that it provides information about a specific MTD device. Also, this is more consistent with libubi. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-20libmtd: rename mtd_get_infoArtem Bityutskiy
Rename 'mtd_get_info()' into 'mtd_get_dev_info()' to be consistent to libubi. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libmtd: amend interfaceArtem Bityutskiy
Remove the fd field from the mtd information data structure, because libmtd does not really know the device node file name, and serves only as a place to save the descriptor. The callers should find a better place. This patch improves code readability and prepares for further changes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libmtd: move comments to headersArtem Bityutskiy
Just for the sake of being consistent with libubi, move the comments for API functions to the header file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-27libmtd: fix mtd_is_bad return codeRoger Quadros
Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-26ubiformat: mark faulty blocks as badRoger Quadros
Few minor amendments by Artem. And increase the utility version number. Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-17ubi-utils: re-arrange directory layoutArtem Bityutskiy
Move new-utils to ubi-utils and old ones to ubi-utils/old-utils. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>