diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2020-01-11 01:03:56 +0900 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2020-01-13 13:19:39 -0500 |
commit | 950313ebf79c65702f4c15d29328147766d1f1fd (patch) | |
tree | 859764b9a481c2f383c07ac0f9c2b928fd0c18a5 /tools/bootconfig/include/linux/string.h | |
parent | bootconfig: Load boot config from the tail of initrd (diff) | |
download | linux-dev-950313ebf79c65702f4c15d29328147766d1f1fd.tar.xz linux-dev-950313ebf79c65702f4c15d29328147766d1f1fd.zip |
tools: bootconfig: Add bootconfig command
Add "bootconfig" command which operates the bootconfig
config-data on initrd image.
User can add/delete/verify the boot config on initrd
image using this command.
e.g.
Add a boot config to initrd image
# bootconfig -a myboot.conf /boot/initrd.img
Remove it.
# bootconfig -d /boot/initrd.img
Or verify (and show) it.
# bootconfig /boot/initrd.img
Link: http://lkml.kernel.org/r/157867223582.17873.14342161849213219982.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
[ Removed extra blank line at end of bootconfig.c ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools/bootconfig/include/linux/string.h')
-rw-r--r-- | tools/bootconfig/include/linux/string.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/bootconfig/include/linux/string.h b/tools/bootconfig/include/linux/string.h new file mode 100644 index 000000000000..8267af75153a --- /dev/null +++ b/tools/bootconfig/include/linux/string.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _SKC_LINUX_STRING_H +#define _SKC_LINUX_STRING_H + +#include <string.h> + +/* Copied from lib/string.c */ +static inline char *skip_spaces(const char *str) +{ + while (isspace(*str)) + ++str; + return (char *)str; +} + +static inline char *strim(char *s) +{ + size_t size; + char *end; + + size = strlen(s); + if (!size) + return s; + + end = s + size - 1; + while (end >= s && isspace(*end)) + end--; + *(end + 1) = '\0'; + + return skip_spaces(s); +} + +#endif |