diff options
author | Baeuerle, Florian <Florian.Baeuerle@allegion.com> | 2018-12-19 14:02:03 +0000 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-01-08 16:37:40 +0100 |
commit | 99c1263dce3902a8961bcdcac9398bce51fccd1b (patch) | |
tree | 0e014ee901e55dad8c2cd74d074622baea4d0be1 /scripts | |
parent | baf8fc002ce67ca80f3bd7456b52a9bd2f10402d (diff) | |
download | barebox-99c1263dce3902a8961bcdcac9398bce51fccd1b.tar.gz barebox-99c1263dce3902a8961bcdcac9398bce51fccd1b.tar.xz |
recursive_action: add ACTION_SORT flag
Add a flag to sort directory entries before recursing into them.
Since this part of lib/ is used inside barebox as well as in
scripts/bareboxenv.c, we cannot easily use stringlists from lib/, which
would have made the code a bit nicer.
Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bareboxenv.c | 15 | ||||
-rw-r--r-- | scripts/include/linux/list_sort.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c index 249e65b251..e95bdeaa5e 100644 --- a/scripts/bareboxenv.c +++ b/scripts/bareboxenv.c @@ -34,6 +34,7 @@ #include "compiler.h" #define debug(...) +#define printk_once(...) /* Find out if the last character of a string matches the one given. * Don't underrun the buffer if the string length is 0. @@ -54,6 +55,7 @@ enum { ACTION_FOLLOWLINKS = (1 << 1), ACTION_DEPTHFIRST = (1 << 2), /*ACTION_REVERSE = (1 << 3), - unused */ + ACTION_SORT = (1 << 4), }; int recursive_action(const char *fileName, unsigned flags, @@ -95,6 +97,19 @@ static char *concat_subpath_file(const char *path, const char *f) return concat_path_file(path, f); } +static char *xstrdup(const char *s) +{ + int len = strlen(s) + 1; + char *d = xmalloc(len); + + memcpy(d, s, len); + + return d; +} + +#include <linux/list.h> +#include <linux/list_sort.h> +#include "../lib/list_sort.c" #include "../lib/recursive_action.c" #include "../include/envfs.h" #include "../crypto/crc32.c" diff --git a/scripts/include/linux/list_sort.h b/scripts/include/linux/list_sort.h new file mode 100644 index 0000000000..be889c9ae5 --- /dev/null +++ b/scripts/include/linux/list_sort.h @@ -0,0 +1 @@ +#include <../../include/linux/list_sort.h> |