aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2014-04-21include/common.h: fix build against recent 0.9.33 uClibcBaruch Siach
An implementation of rpmatch() was backported to the 0.9.33 branch of uClibc. So the uClibc version check introduced in commit 50c9e11f7e (include/common.h: fix build against current uClibc) is not enough. Rename the local rpmatch() implementation to avoid collision. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-04-15include/common.h: fix build against current uClibcBaruch Siach
Commit dbe0fd17f2 (mtd-utils: new prompt() helper for talking to the user) introduced a rpmatch() call. However, uClibc versions older than (not yet released) 0.9.34 don't have rpmatch() implementation. Add one. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
2014-03-25ubi-utils: Add ubiblock toolEzequiel Garcia
With the addition of block device access to UBI volumes, we now add a simple userspace tool to access the new ioctls. Usage of this tool is as simple as it gets: $ ubiblock --create /dev/ubi0_0 will create a new block device /dev/ubiblock0_0, and $ ubiblock --remove /dev/ubi0_0 will remove the device. Artem: slightly changed the header comment. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-10-22mtd: mtd-abi: add a helper to detect the nand typeHuang Shijie
The helper is for user applications, and it is just a copy of the kernel helper: mtd_type_is_nand(); Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-07-01mtd-utils: new prompt() helper for talking to the userMike Frysinger
We've got a few tools that prompt the user for "yes/no" questions. Add a common helper to simplify the various implementations. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-07-01move _GNU_SOURCE to the main makefileMike Frysinger
A bunch of utils are relying on _GNU_SOURCE already. The new prompt code uses getline() which is now part of POSIX, but in older versions of glibc, it was behind _GNU_SOURCE as it was a GNU extension. This change doesn't actually tie us to glibc. Only code that uses GNU extensions does that. It just kills warning when using older versions of glibc. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-09-25introduce PRIxoff_t and PRIdoff_t printf helpersRichard Genoud
They will be usefull when printing offsets. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-22ubi-user.h: add max_beb_per1024 parameterRichard Genoud
Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-22UBI: sync ubi-user.h with kernel v3.6-rc1Richard Genoud
Also remove the eraseblock type support, because kernel commit a65a0eb6d198e058687a9214683bd1c418f20d39 set the dtype parameter as obsolete. Also adjust to some renames: * 'UBI_PROP_DIRECT_WRITE' -> 'UBI_VOL_PROP_DIRECT_WRITE' * 'struct ubi_set_prop_req' -> 'struct ubi_set_vol_prop_req'. * 'UBI_IOCSETPROP' -> 'UBI_IOCSETVOLPROP' Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-02-02libmtd: add `mtd_dev_present()' library functionBrian Norris
Will be used for `mtdinfo --all' Artem: add a temporary stub for pre-2.6.30 kernels. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2011-09-11libmtd: modify `mtd_write' to cover OOB writesBrian Norris
To support the MEMWRITE ioctl, we will need a different sort of libmtd interface for writing to flash. We will expand mtd_write to include more functionality; for now, we just change the function definition and description as we begin to add the actual functionality. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd-utils: update mtd-abi.hBrian Norris
Kernel ABI header added a new ioctl, killed an old one, and exposed OOB modes to user-space. Plus, it added a lot of documentation. We have some trivial name changes for some MTD mode constants as well. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-06-29mtd-utils: add common version printing functionBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-06-29mtd-utils: remove whitespace at end of linesBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-06-27autogenerate version.h from build systemMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-08libmtd: improve mtd_islocked interfaceArtem Bityutskiy
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>
2011-06-08libmtd: add helper funcs for getting regioninfo and locked infoMike Frysinger
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>
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-04-09mtd-utils: improve simple_strtoX usage commentaryArtem Bityutskiy
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>
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-10-01mtd-utils: xalloc: simplify/unify error messagesMike Frysinger
I'm not sure that if we actually are out of memory that declaring the failing allocation size is useful in the output. So use the same simple string in every error message to cut down on size (there will only be one copy of this at runtime). Size is a much more common concern than handling OOM issues which most likely aren't the fault of mtd-utils in the first place. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: dont redefine MIN()Mike Frysinger
Some C library headers will define MIN(), so add an #ifndef check. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: sys_errmsg: optimize indentationMike Frysinger
Rather than do a for loop and output 1 space at a time, let the printf code take care of indenting the string based on the constant length. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: introduce xzalloc() helperMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-30mtd-utils: add xasprintf() helperMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-30mtd-utils: new memory wrappersMike Frysinger
The mkfs.jffs2 program has local wrappers for memory related functions that are useful beyond mkfs.jffs2, so break them out into a common header. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-27mtd-utils: new strtoX helpersMike Frysinger
Simply usage of converting strings to numbers by adding some wrappers around the standard strtoX functions. These helpers simplify the api of these functions a bit by providing an optional "error" pointer and automatic error message. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-27mtd-utils: common.h: clean up PROGRAM_NAME usageMike Frysinger
Make PROGRAM_NAME required in order to include common.h so we can rely on it existing. Further, stop embedding PROGRAM_NAME in every error message so that we can save string space with it being declare only once. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-25mtd-utils: new bareverbose() helperMike Frysinger
Add a new helper that lets people do simple verbose output without any implicit strings added around it. Good for progress bars and such. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-25libmtd: add lock/unlock helpersMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24mtd-utils: punt duplicate normsg_cont defineMike Frysinger
Looks like someone copied & pasted it twice by accident. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24mtd-utils: convert to common.h/minMike Frysinger
Kill off duplicated min() defines and convert to the common.h one. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-01rename crc32 to mtd_crc32Artem Bityutskiy
Because of namespace collisions mkfs.ubifs uses crc32() implementation from /lib/libz.so.1, which generates incompatible CRC and later on the kernel reports many CRC errors. Fix this by re-naming mtd-utils' crc32 function to mtd_crc32. Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-07-26libmtd: add OOB read and write interfacesArtem Bityutskiy
This patch is based on Kevin Cernekee's patch posted to the MTD mailing list. It adds 'mtd_read_oob()' and 'mtd_write_oob()' interfaces support. The interfaces use MEMREADOOB64/MEMWRITEOOB64 MTD ioctls if possible, and fall-back to MEMREADOOB/MEMWRITEOOB if the 64-bit versions are not supported. The information about ioctls support is then cashed in 'offs64_ioctls' libmtd flag. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-07-26libmtd: support MEMERASE64Artem Bityutskiy
This patch is base on Kevin Cernekee's patch posted to the MTD mailing list. It adds MEMERASE64 support to the 'mtd_erase()' call. Now it first tries to use MEMERASE64, and if that is not supported, falls back to the old MEMERASE ioctl. This patch also introduces an 'offs64_ioctl' flag to the libmtd descriptor. However, we cannot initialize it in 'libmtd_open()', because we need an MTD device node, which we do not have in 'libmtd_open()'. Thus, we firs mark this flag as "uninitialized", and at the first invocation of 'mtd_erase()' we initialize it. This also means that we have to pass the limbtd descriptor to 'mtd_erase()', to save the flag value. This, in turn, requires tweaking 'mtd_erase()' users. This is not very nice, but good enough so far. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-07-17libs: remove ubiutils-specific stuff from common.hArtem Bityutskiy
Now include/common.h contains things that really everyone can use. And all the stuff specific to ubi-utils is in ubi-utils/include/ubiutils-common.h Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-07-17libs: make crc32 and fec to be librariesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-07-13mtd-utils: update to latest mtd-abi.h from kernel.orgKevin Cernekee
Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-07-13mtd-utils: move libmtd source files to lib/ subdirectoryKevin Cernekee
Source files for libmtd, crc32, and fec are scattered throughout the tree. Move them to a central location so they can be built into a common "libmtd.a" library used by all mtd-utils programs. This patch only renames/deletes files and does not change the content. Also modify the build system and source code so that libmtd.a can be built from a "common" location (lib/). Statically link all utilities at the top level with libmtd.a . Minor changes to mkfs.ubifs to allow using the common crc32 implementation. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubi-utils: update ubi-media.hArtem Bityutskiy
Update the ubi-media.h file in order to add UBI sequence number support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: add forgotten ubi-media.hArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: update ubi-header.hArtem Bityutskiy
Take the latest version from the kernel, where it was renamed to ubi-media.h. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: update ubi-user.hArtem Bityutskiy
Just take the latest version from the kernel. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-02-04mtd_debug: support new flagsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25ubi-utils: use mtd_swab.hArtem Bityutskiy
Do not relay on asm/byteorder and use mtd_swab.h instead Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25ubi-tools: fix compilation problemsArtem Bityutskiy
It appears that older system do not expose __be32 and friends to userspace, so use uint32_t and friends. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-17ubi-utils: update headersArtem Bityutskiy
Update UBI headers which requires some renameing changes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26ubi-utils: add ubiattach and ubidetachArtem Bityutskiy
Add 2 new utilities to attach and detach UBI devices. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>