summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* readline: Fix history prev when history is emptySascha Hauer2014-09-011-1/+5
| | | | | | | | | | | | | | | | We cannot use list_entry() on an empty list. Without history we have to return an empty line. This fixes a crash when the cursor up button is pressed and no command has been entered previously. Broken since: commit ada160a34a1ec8421d5bb7b9dd746294668a5130 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Tue Jul 29 11:54:26 2014 +0200 readline: reimplement history functions Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Teresa Gamez <t.gamez@phytec.de>
* Merge branch 'for-next/usb-gadget'Sascha Hauer2014-08-071-0/+76
|\ | | | | | | | | | | | | | | Conflicts: commands/Makefile common/Kconfig common/Makefile drivers/usb/gadget/dfu.c
| * param: Add dev_add_param_stringSascha Hauer2014-07-221-0/+76
| | | | | | | | | | | | | | | | This function allows drivers to create a string parameter and provides access to it via a pointer. Using regular dev_add_param only allows access via dev_get_param(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/rtc'Sascha Hauer2014-08-072-0/+15
|\ \ | | | | | | | | | | | | | | | Conflicts: arch/mips/dts/jz4755.dtsi commands/Makefile
| * | lib: import 'bcd' from linux-3.15Antony Pavlov2014-07-312-0/+15
| | | | | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2014-08-073-68/+894
|\ \ \ | | | | | | | | | | | | | | | | Conflicts: lib/Makefile
| * | | readline: reimplement history functionsSascha Hauer2014-07-291-68/+54
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reimplements the history functions in readline. - Use regular lists instead of homegrown list implementation - Allocate history strings dynamically instead of copying strings to fixed buffers without checking the size - saves us an initcall - slightly smaller - no longer add duplicates to the history - when moving past the last history entry print an empty line Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | lib: Add bitmap functions from kernelSascha Hauer2014-07-172-0/+840
| |/ | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/metadata'Sascha Hauer2014-08-076-180/+334
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: arch/arm/dts/Makefile common/Makefile lib/Makefile
| * | read_file: introduce read_file_2Sascha Hauer2014-08-071-14/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | read_file has some limitations: - It is not possible to check the error code since read_file returns NULL for failure - It is not possible to limit the buffer size to sensible limits. This patch introduces read_file_2 which doesn't have these limitations. read_file becomes a wrapper around read_file_2. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | move file helper functions to separate fileSascha Hauer2014-08-076-180/+291
| |/ | | | | | | | | | | | | | | | | | | We have our file helper functions in several places. Move them all to lib/libfile.c. With this we no longer have file helpers in fs/fs.c which contains the core fs functions and no functions in lib/libbb.c which are not from busybox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add beginning wchar supportSascha Hauer2014-07-143-0/+82
| | | | | | | | | | | | | | | | EFI uses 16 bit character strings. Add beginning support for this. Since barebox uses 8 bit strings internally we need conversion functions to convert between 16 bit and 8 bit strings. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | vsprintf: Support pU for printing UUIDsSascha Hauer2014-07-112-0/+65
| | | | | | | | | | | | | | | | With EFI 16byte UUIDs/GUIDs are common. Add support for printing them. This needs to be selected via Kconfig since most architectures have no use for this functionality. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add hex_byte_pack and hex_byte_pack_upper from kernelSascha Hauer2014-07-111-0/+2
| | | | | | | | | | | | Utility functions needed by the UUID/GUID printf support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | readkey: keys are unsigned charSascha Hauer2014-07-111-1/+1
|/ | | | | | We have keys with values > 127, so it must be an unsigned char. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string_list: Add string_list_for_each_entry macroSascha Hauer2014-07-031-3/+3
| | | | | | To ease iterating over a string_list. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lz4: fix another possible overrunHolger Schurig2014-07-021-1/+3
| | | | | | | | | | | | | | | | | | | | Note: this is the same as 4148c1f67abf823099b2d7db6851e4aea407f5ee in linux-git. There is one other possible overrun in the lz4 code as implemented by Linux at this point in time (which differs from the upstream lz4 codebase, but will get synced at in a future kernel release.) As pointed out by Don, we also need to check the overflow in the data itself. While we are at it, replace the odd error return value with just a "simple" -1 value as the return value is never used for anything other than a basic "did this work or not" check. Reported-by: "Don A. Bailey" <donb@securitymouse.com> Reported-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Holger Schurig <holgerschurig@gmail.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lz4: ensure length does not wrapHolger Schurig2014-07-021-0/+2
| | | | | | | | | | | | | Note: this is the same as 206204a1162b995e2185275167b22468c00d6b36 in linux-git. Given some pathologically compressed data, lz4 could possibly decide to wrap a few internal variables, causing unknown things to happen. Catch this before the wrapping happens and abort the decompression. Reported-by: "Don A. Bailey" <donb@securitymouse.com> Signed-off-by: Holger Schurig <holgerschurig@gmail.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lzo: properly check for overrunsHolger Schurig2014-07-021-22/+42
| | | | | | | | | | | | | | Note: this is the same as 206a81c18401c0cde6e579164f752c4b147324ce in linux-git. The lzo decompressor can, if given some really crazy data, possibly overrun some variable types. Modify the checking logic to properly detect overruns before they happen. Reported-by: "Don A. Bailey" <donb@securitymouse.com> Tested-by: "Don A. Bailey" <donb@securitymouse.com> Signed-off-by: Holger Schurig <holgerschurig@gmail.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* param: Add support for long long read only dev paramHerve Codina2014-06-131-0/+26
| | | | | Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gui: IMAGE_RENDERER does not depend on VIDEOSascha Hauer2014-06-051-1/+0
| | | | | | | | | Image renderer may not be particularly useful without framebuffer support, but technically it does not depend on VIDEO. Fixes: warning: (CMD_SPLASH) selects IMAGE_RENDERER which has unmet direct dependencies (VIDEO) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-06-041-5/+6
|\ | | | | | | | | Conflicts: commands/devinfo.c
| * vsprintf: fix formattingAntony Pavlov2014-05-221-5/+6
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | misc: upper-case some abbreviationsHolger Schurig2014-06-021-1/+1
| | | | | | | | | | Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | parameters: only show possible enumerations if there are anyHolger Schurig2014-06-021-0/+3
|/ | | | | | | | | Enumeration values will only be shown if there are at least two of them. With only one enumeration, it was just repeating what was previously printed anyway. Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lzo: Remove unused variableAlexander Shiyan2014-04-231-2/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gui: Fix resource leakAlexander Shiyan2014-04-231-0/+4
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix signedness mixups in printf format specifiersLucas Stach2014-04-232-2/+2
| | | | | | | | | This most likely doesn't fix any real bugs, but it's the right thing to do and reduces the noise level with static checkers. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* unlink_recursive: return negative error valueSascha Hauer2014-04-091-1/+1
| | | | | | | In case of an error unlink_recursive returns errno which is positive. Return -errno instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2014-04-041-5/+5
|\
| * mtd: Update internal API to support 64-bit device sizeDmitry Lavnikevich2014-03-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats; - division and modulus of 64-bit values (mtd_div_by_wb, mtd_div_by_eb may be used in some of such cases). Was tested on phyFLEX i.MX6. Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com> Signed-off-by: Grigory Milev <g.milev@sam-solutions.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2014-04-041-0/+87
|\ \
| * | param: Add dev_add_param_macSascha Hauer2014-04-041-0/+87
| | | | | | | | | | | | | | | | | | | | | This adds a convenience function to register a MAC address device parameter. The only current user is converted to use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | string.c: Fix includeSascha Hauer2014-03-291-1/+1
|/ / | | | | | | | | | | | | | | string.c needs string.h, otherwise we get: lib/string.c:730: warning: no previous prototype for 'memdup' Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / splash: Print error message when no renderer is foundSascha Hauer2014-03-171-0/+2
|/ | | | | | | the splash command silently fails when no renderer is found for an image type. Print an error message in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubi'Sascha Hauer2014-03-071-1/+1
|\ | | | | | | | | Conflicts: drivers/mtd/ubi/cdev.c
| * param: dev_add_param_fixed: constify argumentSascha Hauer2014-02-281-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/nfs'Sascha Hauer2014-03-071-1/+1
|\ \ | | | | | | | | | | | | Conflicts: defaultenv/defaultenv-2-base/bin/ifup
| * | mount: support filesystem options passed via -oUwe Kleine-König2014-02-101-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | Similar to mount(8) the barebox command mount now supports passing a string to the file system driver via -o. This is used in the next commit to let the user specify port numbers for nfs mounts. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2014-03-073-6/+5
|\ \ | | | | | | | | | | | | Conflicts: common/environment.c
| * | lib: math: Return NULL pointerFabio Estevam2014-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following sparse warning: lib/math.c:309:16: warning: Using plain integer as NULL pointer Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | lib: libbb: f should never be NULLLucas Stach2014-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We assume it to be non NULL in other places, so we are in much greater trouble if it actually is. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | lib: math: fix return path (numstack may be NULL)Lucas Stach2014-02-101-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | remove redundant NULL check on freeLucas Stach2014-02-101-2/+1
| |/ | | | | | | | | | | | | | | free() already checks the pointer to be non NULL. No need to do it again. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / input: Add BB_ prefix to KEY_ definesSascha Hauer2014-02-172-31/+31
|/ | | | | | | Our KEY_ defines conflict with the standard Linux KEY_ defines, so add a BB_ prefix to them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-01-076-6/+1
|\
| * lib: fix whitespace, drop blank lines at EOFAntony Pavlov2014-01-066-6/+1
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: libubigen math compile error fixRobert Jarzmik2014-01-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | A compile error appears in libubigen on PXA architecture, because of a division of an long long by a int : /home/rj/mio_linux/barebox/lib/libubigen.c:105: undefined reference to `__aeabi_ldivmod' arm-linux-gnueabi-ld: BFD (GNU Binutils for Debian) 2.20.1.20100303 assertion fail ../../bfd/elf32-arm.c:12497 Fix it by using div_u64 instead. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: Add subpagesize to mtd_info_userSascha Hauer2013-12-201-1/+1
|/ | | | | | | | | ubiformat needs the subpagesize to work correctly. The kernel uses sysfs to pass the subpagesize, but in barebox we have the possibility to extend struct mtd_info_user. Add a corresponding field and use it in ubiformat. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/omap-drivers'Sascha Hauer2013-12-062-0/+24
|\