[PATCH] i2c-tools: don't include linux/i2c-dev.h

2017-08-28 Thread Bartosz Golaszewski
e and simply re-implement the relevant defines from linux/i2c-dev.h in miscutils/i2c-tools.c. Tested by building on systems with and without i2c-tools headers. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff

[PATCH 0/2] i2c-tools fixes

2017-08-28 Thread Bartosz Golaszewski
Two patches for i2c-tools: one minor - just removing an unnecessary include - and one fixing a significant bug: building busybox' i2c-tools with upstream i2c-tools headers installed. Bartosz Golaszewski (2): i2c-tools: remove unneeded include i2c-tools: fix build with upstream i2c-

[PATCH 2/2] i2c-tools: fix build with upstream i2c-tools' headers

2017-08-28 Thread Bartosz Golaszewski
uding linux/i2c.h and defining the i2c access routines only if a well known symbol provided by linux uapi is not defined in linux/i2c-dev.h. Tested by building on systems with and without i2c-tools headers. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 16 +++- 1

[PATCH 1/2] i2c-tools: remove unneeded include

2017-08-28 Thread Bartosz Golaszewski
We no longer use common_bufsiz1 in i2c-tools. Don't include common_bufsiz.h. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 1 - 1 file changed, 1 deletion(-) diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 30f606e8e..03a09d519 100644 --- a/misc

[PATCH 2/3] libbb: add config_from_fp() and config_free() functions

2016-09-30 Thread Bartosz Golaszewski
The first function allows to create parser_t objects for files that are already open. The second frees the parser_t instance without closing the file. With these functions it is now possible to feed config files to applets via stdin. Signed-off-by: Bartosz Golaszewski --- include/libbb.h

[PATCH 0/3] readahead: applet extension

2016-09-30 Thread Bartosz Golaszewski
this branch. Resending just in case you changed your mind. Best regards, Bartosz Golaszewski Bartosz Golaszewski (3): libbb: add str_isblank() macro libbb: add config_from_fp() and config_free() functions readahead: applet extension docs/readahead.txt | 39 +++ include/li

[PATCH 3/3] readahead: applet extension

2016-09-30 Thread Bartosz Golaszewski
- 38 +38 tree_cmp - 11 +11 -- (add/remove: 4/0 grow/shrink: 3/0 up/down: 3126/0) Total: 3126 bytes Signed-off-by: Bartosz Golaszewski

[PATCH 1/3] libbb: add str_isblank() macro

2016-09-30 Thread Bartosz Golaszewski
Add a wrapper around skip_whitespace() which evaluates to true if given string contains only whitespace characters. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ libbb/skip_whitespace.c | 17 + 2 files changed, 19 insertions(+) diff --git a/include

[PATCH] i2cdump: don't use common_bufsiz1

2016-06-23 Thread Bartosz Golaszewski
ate the integer array required for block reads on the stack. Tested with i2c block read on a Lenovo Thinkpad laptop. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 5

[PATCH v7 5/7] nsenter: new applet

2016-03-20 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 351 + util-linux/unshare.c | 12 +- 3 files changed, 374 insertions(+), 9

[PATCH v6 4/7] libbb: xfchdir(): new function

2016-03-19 Thread Bartosz Golaszewski
Add a new xfunction that prints an error message and exits if the underlying fchdir() fails. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + libbb/xfuncs_printf.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 0713917

[PATCH v7 1/7] libbb: add BIT() macro

2016-03-19 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 8b226c0..64e8490 100644 --- a/include/libbb.h

[PATCH v7 3/7] unshare: new applet

2016-03-19 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 465 +++ 1 file changed, 465 insertions(+) create mode 100644 util-linux

[PATCH v7 4/7] libbb: xfchdir(): new function

2016-03-19 Thread Bartosz Golaszewski
Add a new xfunction that prints an error message and exits if the underlying fchdir() fails. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + libbb/xfuncs_printf.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 826804a

[PATCH v5 3/5] unshare: new applet

2016-03-19 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 464 +++ 1 file changed, 464 insertions(+) create mode 100644 util-linux

[PATCH v7 6/7] namespace utils: code shrink

2016-03-19 Thread Bartosz Golaszewski
textdata bss dec hex filename 82955244869120 843158 cdd96 busybox_old 82949844869120 843104 cdd60 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH v6 2/7] libbb: INT_BUF_MAX(): new macro

2016-03-19 Thread Bartosz Golaszewski
Add a simple macro calculating the size needed to store the string representation of an integer type (both signed and unsigned) together with the terminating NUL-character. Suggested-by: Michael Conrad Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + 1 file changed, 1 insertion

[PATCH v7 7/7] runit: use xfchdir()

2016-03-19 Thread Bartosz Golaszewski
Replace a call to fchdir() and the subsequent bail-out in case of an error with a call to xfchdir(). Signed-off-by: Bartosz Golaszewski --- runit/chpst.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runit/chpst.c b/runit/chpst.c index 301cdd0..7fe5151 100644 --- a/runit

[PATCH v6 6/7] namespace utils: code shrink

2016-03-19 Thread Bartosz Golaszewski
textdata bss dec hex filename 82955244869120 843158 cdd96 busybox_old 82949844869120 843104 cdd60 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH v7 0/7] util-linux: namespace utils

2016-03-19 Thread Bartosz Golaszewski
patch 3/4 v1: http://lists.busybox.net/pipermail/busybox/2016-March/083957.html Bartosz Golaszewski (7): libbb: add BIT() macro libbb: INT_BUF_MAX(): new macro unshare: new applet libbb: xfchdir(): new function nsenter: new applet namespace utils: code shrink runit: use xfchdir()

[PATCH v5 0/5] util-linux: namespace utils

2016-03-19 Thread Bartosz Golaszewski
ed it - added some parenthesis for better readability in patch 3/4 v1: http://lists.busybox.net/pipermail/busybox/2016-March/083957.html Bartosz Golaszewski (5): libbb: add BIT() macro libbb: INT_BUF_MAX(): new macro unshare: new applet nsenter: new applet namespace utils: code shrink in

[PATCH v6 5/7] nsenter: new applet

2016-03-19 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 351 + util-linux/unshare.c | 12 +- 3 files changed, 374 insertions(+), 9

[PATCH v5 4/5] nsenter: new applet

2016-03-19 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 367 + util-linux/unshare.c | 12 +- 3 files changed, 390 insertions(+), 9

[PATCH v6 3/7] unshare: new applet

2016-03-19 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 464 +++ 1 file changed, 464 insertions(+) create mode 100644 util-linux

[PATCH v5 1/5] libbb: add BIT() macro

2016-03-19 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 8b226c0..64e8490 100644 --- a/include/libbb.h

[PATCH v5 2/5] libbb: INT_BUF_MAX(): new macro

2016-03-19 Thread Bartosz Golaszewski
Add a simple macro calculating the size needed to store the string representation of an integer type (both signed and unsigned) together with the terminating NUL-character. Suggested-by: Michael Conrad Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + 1 file changed, 1 insertion

[PATCH v7 2/7] libbb: INT_BUF_MAX(): new macro

2016-03-19 Thread Bartosz Golaszewski
Add a simple macro calculating the size needed to store the string representation of an integer type (both signed and unsigned) together with the terminating NUL-character. Suggested-by: Michael Conrad Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 17 + 1 file

[PATCH v6 0/7] util-linux: namespace utils

2016-03-19 Thread Bartosz Golaszewski
it - added some parenthesis for better readability in patch 3/4 v1: http://lists.busybox.net/pipermail/busybox/2016-March/083957.html Bartosz Golaszewski (7): libbb: add BIT() macro libbb: INT_BUF_MAX(): new macro unshare: new applet libbb: xfchdir(): new function nsenter: new applet

[PATCH v5 5/5] namespace utils: code shrink

2016-03-19 Thread Bartosz Golaszewski
textdata bss dec hex filename 82955244869120 843158 cdd96 busybox_old 82949844869120 843104 cdd60 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH v6 7/7] runit: use xfchdir()

2016-03-18 Thread Bartosz Golaszewski
Replace a call to fchdir() and the subsequent bail-out in case of an error with a call to xfchdir(). Signed-off-by: Bartosz Golaszewski --- runit/chpst.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runit/chpst.c b/runit/chpst.c index 301cdd0..7fe5151 100644 --- a/runit

[PATCH v6 1/7] libbb: add BIT() macro

2016-03-18 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 8b226c0..64e8490 100644 --- a/include/libbb.h

[PATCH v4 4/4] namespace utils: code shrink

2016-03-14 Thread Bartosz Golaszewski
textdata bss dec hex filename 82955244869120 843158 cdd96 busybox_old 82949844869120 843104 cdd60 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH v4 0/4] util-linux: namespace utils

2016-03-14 Thread Bartosz Golaszewski
rebased and patch 3/4 didn't compile - fixed it - added some parenthesis for better readability in patch 3/4 v1: http://lists.busybox.net/pipermail/busybox/2016-March/083957.html Bartosz Golaszewski (4): libbb: add BIT() macro unshare: new applet nsenter: new applet namespace utils:

[PATCH v4 3/4] nsenter: new applet

2016-03-14 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 367 + util-linux/unshare.c | 12 +- 3 files changed, 390 insertions(+), 9

[PATCH v4 2/4] unshare: new applet

2016-03-14 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 464 +++ 1 file changed, 464 insertions(+) create mode 100644 util-linux

[PATCH v4 1/4] libbb: add BIT() macro

2016-03-14 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index d05ac29..fcad060 100644 --- a/include/libbb.h

[PATCH v3 4/4] namespace utils: code shrink

2016-03-14 Thread Bartosz Golaszewski
textdata bss dec hex filename 82955244869120 843158 cdd96 busybox_old 82949844869120 843104 cdd60 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH v3 0/4] util-linux: namespace utils

2016-03-14 Thread Bartosz Golaszewski
x27;t compile - fixed it - added some parenthesis for better readability in patch 3/4 v1: http://lists.busybox.net/pipermail/busybox/2016-March/083957.html Bartosz Golaszewski (4): libbb: add BIT() macro unshare: new applet nsenter: new applet namespace utils: code shrink include/li

[PATCH v3 2/4] unshare: new applet

2016-03-14 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 453 +++ 1 file changed, 453 insertions(+) create mode 100644 util-linux

[PATCH v3 1/4] libbb: add BIT() macro

2016-03-14 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index d05ac29..fcad060 100644 --- a/include/libbb.h

[PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 362 + util-linux/unshare.c | 12 +- 3 files changed, 385 insertions(+), 9

[PATCH v2 4/4] namespace utils: code shrink

2016-03-11 Thread Bartosz Golaszewski
textdata bss dec hex filename 82955244869120 843158 cdd96 busybox_old 82949844869120 843104 cdd60 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH v2 2/4] unshare: new applet

2016-03-11 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 450 +++ 1 file changed, 450 insertions(+) create mode 100644 util-linux

[PATCH v2 3/4] nsenter: new applet

2016-03-11 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 359 + util-linux/unshare.c | 12 +- 3 files changed, 382 insertions(+), 9

[PATCH v2 1/4] libbb: add BIT() macro

2016-03-11 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index d05ac29..fcad060 100644 --- a/include/libbb.h

[PATCH v2 0/4] util-linux: namespace utils

2016-03-11 Thread Bartosz Golaszewski
ty in patch 3/4 v1: http://lists.busybox.net/pipermail/busybox/2016-March/083957.html Bartosz Golaszewski (4): libbb: add BIT() macro unshare: new applet nsenter: new applet namespace utils: code shrink include/libbb.h| 2 + util-linux/namespace.c | 34 util-linux/namesp

[PATCH 2/4] unshare: new applet

2016-03-11 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 450 +++ 1 file changed, 450 insertions(+) create mode 100644 util-linux

[PATCH 4/4] namespace utils: code shrink

2016-03-11 Thread Bartosz Golaszewski
textdata bss dec hex filename 82945644869120 843062 cdd36 busybox_old 82939944869120 843005 cdcfd busybox_unstripped Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.c | 34 ++ util-linux/namespace.h | 7 +++

[PATCH 3/4] nsenter: new applet

2016-03-11 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 340 + util-linux/unshare.c | 12 +- 3 files changed, 363 insertions(+), 9

[PATCH 0/4] util-linux: namespace utils

2016-03-11 Thread Bartosz Golaszewski
This series adds two namespaces-related applets reimplementing most arguments supported by their upstream util-linux counterparts. The fourth patch is an optional code shrink. Bartosz Golaszewski (4): libbb: add BIT() macro unshare: new applet nsenter: new applet namespace utils: code

[PATCH 1/4] libbb: add BIT() macro

2016-03-11 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index d05ac29..fcad060 100644 --- a/include/libbb.h

[PATCH 5/6] i2cdump: bail-out if block read fails

2015-10-27 Thread Bartosz Golaszewski
We should bail-out if i2c_smbus_read_block_data() or i2c_smbus_read_i2c_block_data() return 0 or less. Add the missing check for the former and fix the existing for the latter. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 13 - 1 file changed, 8 insertions(+), 5

[PATCH 4/6] i2cdump: use I2C block mode for the 'i' mode parameter

2015-10-27 Thread Bartosz Golaszewski
for I2C block. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 094bf9e..6d221e9 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c @@ -723,7 +723,7 @@

[PATCH 1/6] i2cdetect: fix address skipping in auto mode

2015-10-27 Thread Bartosz Golaszewski
d an additional variable to hold the temporary state. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index d77e6ba..c5baaa7 100644 --- a/miscutils/i2

[PATCH 0/6] i2c-tools: bugfixes

2015-10-27 Thread Bartosz Golaszewski
This series contains a couple of bugfixes and tweaks for i2cdetect and i2cdump. Bartosz Golaszewski (6): i2cdetect: fix address skipping in auto mode i2cdetect: coding style: add a space after 'for' i2cdump: don't read block data in non-block modes i2cdump: use I2C block

[PATCH 6/6] i2cdump: display the numeric value for block read ioctl() errors

2015-10-27 Thread Bartosz Golaszewski
This makes busybox i2cdump compatible with the upstream version, which also displays the numeric error value in case of a block read failure. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/miscutils

[PATCH 3/6] i2cdump: don't read block data in non-block modes

2015-10-27 Thread Bartosz Golaszewski
We currently read data twice in byte mode. Add a check to avoid calling i2c_smbus_read_i2c_block_data() if we're not in I2C or SMBus block mode. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc

[PATCH 2/6] i2cdetect: coding style: add a space after 'for'

2015-10-27 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index c5baaa7..907d738 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c @@ -1270,7 +1270,7 @@ int

[PATCH v2] i2c-tools: code cleanup: remove unused parts of kernel UAPI

2015-09-02 Thread Bartosz Golaszewski
The implementation is more or less feature complete. Remove the parts of kernel UAPI copied from include/uapi/linux/i2c.h that aren't used. Signed-off-by: Bartosz Golaszewski --- v2: - update comments as well v1: http://lists.busybox.net/pipermail/busybox/2015-September/083345.html misc

[PATCH] i2c-tools: code cleanup: remove unused parts of kernel UAPI

2015-09-01 Thread Bartosz Golaszewski
The implementation is more or less feature complete. Remove the parts of kernel UAPI copied from include/uapi/linux/i2c.h that aren't used. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 13 - 1 file changed, 13 deletions(-) diff --git a/miscutils/i2c_tool

[PATCH v2] inotifyd: -x: new option

2015-08-25 Thread Bartosz Golaszewski
usage 30460 30516 +56 -- (add/remove: 0/0 grow/shrink: 3/0 up/down: 209/0) Total: 209 bytes Signed-off-by: Bartosz Golaszewski --- v2: - don't call xstrtol_range() if -x is not specified

[RFC/PATCH v3 8/8] readahead: applet extension

2015-08-25 Thread Bartosz Golaszewski
- 38 +38 tree_cmp - 11 +11 -- (add/remove: 4/0 grow/shrink: 3/0 up/down: 3126/0) Total: 3126 bytes Signed-off-by: Bartosz Golaszewski

[RFC/PATCH v3 7/8] libbb: add config_from_fp() and config_free() functions

2015-08-25 Thread Bartosz Golaszewski
The first function allows to create parser_t objects for files that are already open. The second frees the parser_t instance without closing the file. With these functions it is now possible to feed config files to applets via stdin. Signed-off-by: Bartosz Golaszewski --- include/libbb.h

[RFC/PATCH v3 6/8] libbb: add is_suffixed_with() function

2015-08-25 Thread Bartosz Golaszewski
This function checks if given key can be found at the end of the string. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + libbb/compare_string_array.c | 32 2 files changed, 33 insertions(+) diff --git a/include/libbb.h b/include

[RFC/PATCH v3 5/8] libbb: add a comment describing the way is_prefixed_with() works

2015-08-25 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski --- libbb/compare_string_array.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index eb754af..901e61a 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c @@ -5,6

[RFC/PATCH v3 2/8] libbb: add DECIMAL_STR_MAX macro

2015-08-25 Thread Bartosz Golaszewski
Add a macro returning the maximum required buffer size for given integer type. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 6d7b128..abbd2c7 100644 --- a/include/libbb.h +++ b/include

[RFC/PATCH v3 4/8] libbb: add unit tests for is_prefixed_with()

2015-08-25 Thread Bartosz Golaszewski
Test corner cases too like looking for an empty prefix etc. Signed-off-by: Bartosz Golaszewski --- libbb/compare_string_array.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index fe6d4a5..eb754af 100644

[RFC/PATCH v3 1/8] libbb: add str_isblank() macro

2015-08-25 Thread Bartosz Golaszewski
Add a wrapper around skip_whitespace() which evaluates to true if given string contains only whitespace characters. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ libbb/skip_whitespace.c | 17 + 2 files changed, 19 insertions(+) diff --git a/include

[RFC/PATCH v3 3/8] libbb: remove unused code from is_prefixed_with()

2015-08-25 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski --- libbb/compare_string_array.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index e24815a..fe6d4a5 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c @@ -7,12

[RFC/PATCH v3 0/8] readahead: daemon mode

2015-08-25 Thread Bartosz Golaszewski
ses - updated unit tests for is_suffixed_with() - added detailed comments for both functions - removed unused code from is_prefixed_with() (any reason to keep it?) - removed global stopped condition from readahead since signals are handled by signalfd, not signal handlers Bartosz Golaszewski

[RFC/PATCH v2 1/5] libbb: add str_isblank() macro

2015-08-21 Thread Bartosz Golaszewski
Add a wrapper around skip_whitespace() which evaluates to true if given string contains only whitespace characters. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ libbb/skip_whitespace.c | 17 + 2 files changed, 19 insertions(+) diff --git a/include

[RFC/PATCH v2 0/5] readahead: daemon mode

2015-08-21 Thread Bartosz Golaszewski
and disabled by default - removed patches implementing system calls in busybox Bartosz Golaszewski (5): libbb: add str_isblank() macro libbb: add DECIMAL_STR_MAX macro libbb: add ends_with() function libbb: add config_from_fp() and config_free() functions readahead: applet extension d

[RFC/PATCH v2 4/5] libbb: add config_from_fp() and config_free() functions

2015-08-21 Thread Bartosz Golaszewski
The first function allows to create parser_t objects for files that are already open. The second frees the parser_t instance without closing the file. With these functions it is now possible to feed config files to applets via stdin. Signed-off-by: Bartosz Golaszewski --- include/libbb.h

[RFC/PATCH v2 2/5] libbb: add DECIMAL_STR_MAX macro

2015-08-21 Thread Bartosz Golaszewski
Add a macro returning the maximum required buffer size for given integer type. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 478c030..a56b684 100644 --- a/include/libbb.h +++ b/include

[RFC/PATCH v2 5/5] readahead: applet extension

2015-08-21 Thread Bartosz Golaszewski
- 38 +38 tree_cmp - 11 +11 -- (add/remove: 4/0 grow/shrink: 3/0 up/down: 3111/0) Total: 3111 bytes Signed-off-by: Bartosz Golaszewski

[RFC/PATCH v2 3/5] libbb: add ends_with() function

2015-08-21 Thread Bartosz Golaszewski
This function checks if given key can be found at the end of the string. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + libbb/compare_string_array.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/include/libbb.h b/include

[PATCH] Makefile: add missing libraries to LDLIBS

2015-08-13 Thread Bartosz Golaszewski
. Signed-off-by: Bartosz Golaszewski --- Makefile.flags | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile.flags b/Makefile.flags index a1ed148..bb90a08 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -121,20 +121,20 @@ endif # fall back to using a

[RFC/PATCH 09/10] readahead: applet extension

2015-08-13 Thread Bartosz Golaszewski
- 11 +11 -- (add/remove: 4/0 grow/shrink: 3/0 up/down: 3091/0) Total: 3091 bytes Signed-off-by: Bartosz Golaszewski --- docs/readahead.txt| 36 +++ miscutils/Config.src | 4 +- miscutils

[RFC/PATCH 08/10] libbb: add config_from_fp() and config_free() functions

2015-08-13 Thread Bartosz Golaszewski
The first function allows to create parser_t objects for files that are already open. The second frees the parser_t instance without closing the file. With these functions it is now possible to feed config files to applets via stdin. Signed-off-by: Bartosz Golaszewski --- include/libbb.h

[RFC/PATCH 06/10] libbb: add fanotify support on uClibc

2015-08-13 Thread Bartosz Golaszewski
Fanotify syscalls are not supported in uClibc. Add a new include file - missing_syscalls.h - implementing the syscalls directly in busybox. Signed-off-by: Bartosz Golaszewski --- include/missing_syscalls.h | 47 ++ 1 file changed, 47 insertions

[RFC/PATCH 10/10] config: remove readahead from defconfig

2015-08-13 Thread Bartosz Golaszewski
Readahead isn't a commonly used applet and since the addition of the daemon mode its size increased significantly. Change the default value in Config.src to 'n'. Signed-off-by: Bartosz Golaszewski --- miscutils/Config.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-

[RFC/PATCH 07/10] libbb: add syncfs() support for uClibc

2015-08-13 Thread Bartosz Golaszewski
Currently uClibc declares but doesn't define syncfs(). In versions <= 0.9.33 it's not even declared in unistd.h. This makes it impossible to compile sync with CONFIG_FEATURE_SYNC_FANCY on uClibc. Add support for this system call to missing_syscalls.h. Signed-off-by: Bartos

[RFC/PATCH 02/10] unit-tests: remove code depending on WANT_TIMING

2015-08-13 Thread Bartosz Golaszewski
Since there is no interest in merging a config option for WANT_TIMING, remove the parts of code depending on it altogether. While we're at it: add some newlines to improve readability. Signed-off-by: Bartosz Golaszewski --- libbb/bbunit.c | 30 +++--- 1 file chang

[RFC/PATCH 00/10] readahead: daemon mode

2015-08-13 Thread Bartosz Golaszewski
ead, remove unneeded code or fix compilation issues in different parts of code. This series is also available at: https://github.com/brgl/busybox readahead Bartosz Golaszewski (10): unit-tests: remove unnecesary field from struct bbunit_listelem unit-tests: remove code depending on WANT_TIM

[RFC/PATCH 01/10] unit-tests: remove unnecesary field from struct bbunit_listelem

2015-08-13 Thread Bartosz Golaszewski
_elem 24 16 -8 -- (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-25) Total: -25 bytes Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 - libbb/bbunit.c | 1 - 2

[RFC/PATCH 03/10] libbb: add str_isblank() macro

2015-08-13 Thread Bartosz Golaszewski
Add a wrapper around skip_whitespace() which evaluates to true if given string contains only whitespace characters. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ libbb/skip_whitespace.c | 17 + 2 files changed, 19 insertions(+) diff --git a/include

[RFC/PATCH 05/10] libbb: add ends_with() function

2015-08-13 Thread Bartosz Golaszewski
This function checks if given key can be found at the end of the string. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 1 + libbb/compare_string_array.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/include/libbb.h b/include

[RFC/PATCH 04/10] libbb: add DECIMAL_STR_MAX macro

2015-08-13 Thread Bartosz Golaszewski
Add a macro returning the maximum required buffer size for given integer type. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 478c030..a56b684 100644 --- a/include/libbb.h +++ b/include

[RESEND PATCH] inotifyd: -x: new option

2015-08-04 Thread Bartosz Golaszewski
41969584 841945 cd8d9 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- miscutils/inotifyd.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c index 7a1a6a2..97f67ab 100644 --- a/miscutils/inoti

[PATCH] inotifyd: -x: new option

2015-07-27 Thread Bartosz Golaszewski
41969584 841945 cd8d9 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- NOTE: I don't quite understand where the increase in size of .rodata comes from. Looking at objdump output I can see some strings generated for xstrtol_range() and then some additional non-readable bytes whi

[PATCH v2] i2cdetect: use break instead of goto in list_i2c_busses_and_exit()

2015-06-05 Thread Bartosz Golaszewski
Since there are no more statements in the if block after the while loop in list_i2c_busses_and_exit(), there's no need for a goto. Signed-off-by: Bartosz Golaszewski --- NOTES: fixed two typos in the commit message. miscutils/i2c_tools.c | 3 +-- 1 file changed, 1 insertion(+), 2 dele

[RESEND PATCH v3 2/5] i2cdetect: don't scan non-regular addresses without the '-a' option

2015-06-05 Thread Bartosz Golaszewski
Addresses 0x00-0x02 shouldn't be scanned by default. This patch makes 'first' default to 0x03 and only enables lower addresses if '-a' option is passed Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 6 -- 1 file changed, 4 insertions(+), 2 d

[RESEND PATCH v3 3/5] i2cdetect: add a check for (mode == DETECT_MODE_AUTO)

2015-06-05 Thread Bartosz Golaszewski
We should only warn the user about addresses to be skipped if (mode == DETECT_MODE_AUTO). Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 6f97872..16784e9

[RESEND PATCH v3 4/5] i2cdump: code rework

2015-06-05 Thread Bartosz Golaszewski
Split i2cdump_main() into shorter functions. Simplify the code a bit. Make block an array of ints so that we can store negative results of read functions (fixes a bug found by Denys Vlasenko). Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 316

[RESEND PATCH v3 1/5] i2cdetect: don't die on addresses already in use by drivers

2015-06-05 Thread Bartosz Golaszewski
dec hex filename 82609741649584 839845 cd0a5 busybox_old 82614541649584 839893 cd0d5 busybox_unstripped Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/mis

[PATCH 5/5] i2cdetect: use break instead of goto in list_i2c_busses_and_exit()

2015-06-05 Thread Bartosz Golaszewski
Since there are now more statements in the if block after the while loop in list_i2c_busses_and_exit(), there's no need for a label. Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/miscutils/i2c_tool

[RESEND PATCH v3 + one more 0/5] i2c-tools fixes

2015-06-05 Thread Bartosz Golaszewski
rework to the series - fixed an unneeded indentation in i2cdetect Bartosz Golaszewski (5): i2cdetect: don't die on addresses already in use by drivers i2cdetect: don't scan non-regular addresses without the '-a' option i2cdetect: add a check for (mode == DETECT_MODE_AUTO)

[PATCH v3 4/4] i2cdump: code rework

2015-05-29 Thread Bartosz Golaszewski
Split i2cdump_main() into shorter functions. Simplify the code a bit. Make block an array of ints so that we can store negative results of read functions (fixes a bug found by Denys Vlasenko). Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 316

[PATCH v3 2/4] i2cdetect: don't scan non-regular addresses without the '-a' option

2015-05-29 Thread Bartosz Golaszewski
Addresses 0x00-0x02 shouldn't be scanned by default. This patch makes 'first' default to 0x03 and only enables lower addresses if '-a' option is passed Signed-off-by: Bartosz Golaszewski --- miscutils/i2c_tools.c | 6 -- 1 file changed, 4 insertions(+), 2 d

[PATCH v3 0/4] i2c-tools fixes

2015-05-29 Thread Bartosz Golaszewski
This series fixes one major issue and two smaller bugs in i2cdetect and reworks i2cdump_main(). v3: - drop the check for COMMON_BUFSIZE < block buffer size as it's highly unlikely, isn't it? v2: - added i2cdump code rework to the series - fixed an unneeded indentation in i2cde

  1   2   >