bootconfig: Clean up bootconfig
Subsystems (2)
Masami Hiramatsu
maintainercover bootconfig: Clean up bootconfig
Hi,
Here is a bootconfig cleanup series which includes a previous xbc_destroy_all() renaming patch. Basically this tries to remove all dummy patched in tools/bootconfig, except include/linux/bootconfig.
This series can be applied on top of 1-3rd patch of this series.
https://lore.kernel.org/all/163177338366.682366.5998343833719057348.stgit@devnote2/T/#u
As I added a NOTE in the bootconfig files, those are not intended to be used from user application, except for tools/bootconfig. Because tools/bootconfig runs parser tests, it must use the same code of lib/bootconfig.
However, I don't want to keep the dummy headers for that. This series minimize the differences and consolidate it to the one wrapper header.
I hope this eases the current situation so that the future change will not (or hard to) break tools/bootconfig build.
Thank you,
---
Masami Hiramatsu (7):
tools/bootconfig: Run test script when build all
bootconfig: Rename xbc_destroy_all() to xbc_exit()
bootconfig: Split parse-tree part from xbc_init
bootconfig: Remove unused debug function tools/bootconfig: Print all error message in stderr
bootconfig: Replace u16 and u32 with uint16_t and uint32_t
bootconfig: Cleanup dummy headers in tools/bootconfig
include/linux/bootconfig.h | 27 ++-- init/main.c | 2 lib/bootconfig.c | 187 +++++++++++++++------------ tools/bootconfig/Makefile | 4 - tools/bootconfig/include/linux/bootconfig.h | 45 ++++++ tools/bootconfig/include/linux/bug.h | 12 -- tools/bootconfig/include/linux/ctype.h | 7 - tools/bootconfig/include/linux/errno.h | 7 - tools/bootconfig/include/linux/kernel.h | 18 --- tools/bootconfig/include/linux/memblock.h | 11 -- tools/bootconfig/include/linux/printk.h | 14 -- tools/bootconfig/include/linux/string.h | 32 ----- tools/bootconfig/main.c | 25 ++-- 13 files changed, 181 insertions(+), 210 deletions(-) delete mode 100644 tools/bootconfig/include/linux/bug.h delete mode 100644 tools/bootconfig/include/linux/ctype.h delete mode 100644 tools/bootconfig/include/linux/errno.h delete mode 100644 tools/bootconfig/include/linux/kernel.h delete mode 100644 tools/bootconfig/include/linux/memblock.h delete mode 100644 tools/bootconfig/include/linux/printk.h delete mode 100644 tools/bootconfig/include/linux/string.h
Signature · 1 line
Masami Hiramatsu (Linaro) <[email protected]>
Masami Hiramatsu
maintainerPATCH 1/7 tools/bootconfig: Run test script when build all
Run the bootconfig test script when build all target so that user can notice any issue when build it.
--- tools/bootconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/Makefile +1 -1
@@ -15,7 +15,7 @@ CFLAGS = -Wall -g -I$(CURDIR)/include ALL_TARGETS := bootconfig ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) -all: $(ALL_PROGRAMS) +all: $(ALL_PROGRAMS) test $(OUTPUT)bootconfig: main.c $(LIBSRC) $(CC) $(filter %.c,$^) $(CFLAGS) -o $@
Masami Hiramatsu
maintainerPATCH 2/7 bootconfig: Rename xbc_destroy_all() to xbc_exit()
In reply to Masami HiramatsuAvoid using this noisy name and use more calm one. This is just a name change. No functional change.
---
Changes in v5:
- Use _exit suffix instead of _fini.
--- include/linux/bootconfig.h | 2 +- init/main.c | 2 +- lib/bootconfig.c | 8 ++++---- tools/bootconfig/main.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
include/linux/bootconfig.h +1 -1
@@ -277,7 +277,7 @@ int __init xbc_init(const char *buf, size_t size, const char **emsg, int *epos);int __init xbc_get_info (int *node_size,size_t *data_size);/* XBC cleanup data structures */ -void __init xbc_destroy_all (void ); +void __init xbc_exit (void );/* Debug dump functions */ void __init xbc_debug_dump (void );
init/main.c +1 -1
@@ -463,7 +463,7 @@ static void __init setup_boot_config(void)static void __init exit_boot_config (void ) { -xbc_destroy_all (); +xbc_exit (); }#else /* !CONFIG_BOOT_CONFIG */
lib/bootconfig.c +4 -4
@@ -802,13 +802,13 @@ static int __init xbc_verify_tree(void) }/** -* xbc_destroy_all() - Clean up all parsed bootconfig +* xbc_exit() - Clean up all parsed bootconfig * * This clears all data structures of parsed bootconfig on memory. * If you need to reuse xbc_init() with new boot config, you can * use this. */ -void __init xbc_destroy_all (void ) +void __init xbc_exit (void ) {memblock_free_ptr (xbc_data, xbc_data_size); xbc_data =NULL ;
@@ -869,7 +869,7 @@ int __init xbc_init(const char *data, size_t size, const char **emsg, int *epos)if (!xbc_nodes) {if (emsg) *emsg ="Failed to allocate bootconfig nodes" ; -xbc_destroy_all (); +xbc_exit ();return -ENOMEM ; }memset (xbc_nodes,0 ,sizeof (struct xbc_node ) *XBC_NODE_MAX );
@@ -925,7 +925,7 @@ int __init xbc_init(const char *data, size_t size, const char **emsg, int *epos) *epos = xbc_err_pos;if (emsg) *emsg = xbc_err_msg; -xbc_destroy_all (); +xbc_exit (); }else ret = xbc_node_num;
tools/bootconfig/main.c +1 -1
@@ -397,7 +397,7 @@ static int apply_xbc(const char *path, const char *xbc_path)printf ("\tChecksum: %d\n" , (unsigned int )csum);/* TODO: Check the options by schema */ -xbc_destroy_all (); +xbc_exit ();free (buf);/* Remove old boot config if exists */
Masami Hiramatsu
maintainerPATCH 3/7 bootconfig: Split parse-tree part from xbc_init
In reply to Masami HiramatsuSplit bootconfig data parser to build tree code from xbc_init(). This is an internal cosmetic change.
--- lib/bootconfig.c | 99 +++++++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 45 deletions(-)
lib/bootconfig.c +54 -45
@@ -801,6 +801,58 @@ static int __init xbc_verify_tree(void)return 0 ; } +/* Need to setup xbc_data and xbc_nodes before call this. */ +static int __init xbc_parse_tree (void ) +{ +char *p, *q; +int ret, c; + + last_parent =NULL ; + p = xbc_data; +do { + q =strpbrk (p,"{}=+;:\n#" ); +if (!q) { + p =skip_spaces (p); +if (*p !='\0' ) + ret =xbc_parse_error ("No delimiter" , p); +break ; + } + + c = *q; + *q++ ='\0' ; +switch (c) { +case ':' : +case '+' : +if (*q++ !='=' ) { + ret =xbc_parse_error (c =='+' ? +"Wrong '+' operator" : +"Wrong ':' operator" , + q -2 ); +break ; + } + fallthrough; +case '=' : + ret =xbc_parse_kv (&p, q, c); +break ; +case '{' : + ret =xbc_open_brace (&p, q); +break ; +case '#' : + q =skip_comment (q); + fallthrough; +case ';' : +case '\n' : + ret =xbc_parse_key (&p, q); +break ; +case '}' : + ret =xbc_close_brace (&p, q); +break ; + } + }while (!ret); + +return ret; +} +/** * xbc_exit() - Clean up all parsed bootconfig *
@@ -836,8 +888,7 @@ void __init xbc_exit(void)*/ int __init xbc_init (const char *data,size_t size,const char **emsg,int *epos) { -char *p, *q; -int ret, c; +int ret;if (epos) *epos =-1 ;
@@ -874,49 +925,7 @@ int __init xbc_init(const char *data, size_t size, const char **emsg, int *epos) }memset (xbc_nodes,0 ,sizeof (struct xbc_node ) *XBC_NODE_MAX ); - last_parent =NULL ; - p = xbc_data; -do { - q =strpbrk (p,"{}=+;:\n#" ); -if (!q) { - p =skip_spaces (p); -if (*p !='\0' ) - ret =xbc_parse_error ("No delimiter" , p); -break ; - } - - c = *q; - *q++ ='\0' ; -switch (c) { -case ':' : -case '+' : -if (*q++ !='=' ) { - ret =xbc_parse_error (c =='+' ? -"Wrong '+' operator" : -"Wrong ':' operator" , - q -2 ); -break ; - } - fallthrough; -case '=' : - ret =xbc_parse_kv (&p, q, c); -break ; -case '{' : - ret =xbc_open_brace (&p, q); -break ; -case '#' : - q =skip_comment (q); - fallthrough; -case ';' : -case '\n' : - ret =xbc_parse_key (&p, q); -break ; -case '}' : - ret =xbc_close_brace (&p, q); -break ; - } - }while (!ret); - + ret =xbc_parse_tree ();if (!ret) ret =xbc_verify_tree ();
Masami Hiramatsu
maintainerPATCH 4/7 bootconfig: Remove unused debug function
In reply to Masami HiramatsuRemove unused xbc_debug_dump() from bootconfig for clean up the code.
--- include/linux/bootconfig.h | 3 --- lib/bootconfig.c | 21 --------------------- 2 files changed, 24 deletions(-)
include/linux/bootconfig.h +0 -3
@@ -279,7 +279,4 @@ int __init xbc_get_info(int *node_size, size_t *data_size);/* XBC cleanup data structures */ void __init xbc_exit (void ); -/* Debug dump functions */ -void __init xbc_debug_dump (void ); -#endif
lib/bootconfig.c +0 -21
@@ -4,15 +4,12 @@* Masami Hiramatsu <[email protected]> */ -#define pr_fmt (fmt) "bootconfig: " fmt -#include <linux/bootconfig.h> #include <linux/bug.h> #include <linux/ctype.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/memblock.h> -#include <linux/printk.h> #include <linux/string.h> /*
@@ -940,21 +937,3 @@ int __init xbc_init(const char *data, size_t size, const char **emsg, int *epos)return ret; } - -/** -* xbc_debug_dump() - Dump current XBC node list -* -* Dump the current XBC node list on printk buffer for debug. -*/ -void __init xbc_debug_dump (void ) -{ -int i; - -for (i =0 ; i < xbc_node_num; i++) { -pr_debug ("[%d] %s (%s) .next=%d, .child=%d .parent=%d\n" , i, -xbc_node_get_data (xbc_nodes + i), -xbc_node_is_value (xbc_nodes + i) ?"value" :"key" , - xbc_nodes[i].next, xbc_nodes[i].child, - xbc_nodes[i].parent); - } -}
Masami Hiramatsu
maintainerPATCH 5/7 tools/bootconfig: Print all error message in stderr
In reply to Masami HiramatsuPrint all error message in stderr. This also removes unneeded tools/bootconfig/include/linux/printk.h.
--- tools/bootconfig/include/linux/kernel.h | 2 -- tools/bootconfig/include/linux/printk.h | 14 -------------- tools/bootconfig/main.c | 2 ++ 3 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 tools/bootconfig/include/linux/printk.h
tools/bootconfig/include/linux/kernel.h +0 -2
@@ -5,8 +5,6 @@#include <stdlib.h> #include <stdbool.h> -#include <linux/printk.h> -typedef unsigned short u16 ;typedef unsigned int u32 ;
tools/bootconfig/include/linux/printk.h deleted +0 -14
@@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SKC_LINUX_PRINTK_H -#define _SKC_LINUX_PRINTK_H - -#include <stdio.h> - -#define printk (fmt, ...) printf(fmt, ##__VA_ARGS__) - -#define pr_err printk -#define pr_warn printk -#define pr_info printk -#define pr_debug printk - -#endif
tools/bootconfig/main.c +2 -0
@@ -15,6 +15,8 @@#include <linux/kernel.h> #include <linux/bootconfig.h> +#define pr_err (fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) +static int xbc_show_value (struct xbc_node *node,bool semicolon) {const char *val, *eol;
Masami Hiramatsu
maintainerPATCH 6/7 bootconfig: Replace u16 and u32 with uint16_t and uint32_t
In reply to Masami HiramatsuReplace u16 and u32 with uint16_t and uint32_t so
that the tools/bootconfig only needs <stdint.h>.
--- include/linux/bootconfig.h | 12 ++++++------ lib/bootconfig.c | 16 ++++++++-------- tools/bootconfig/include/linux/kernel.h | 4 +--- tools/bootconfig/main.c | 20 ++++++++++---------- 4 files changed, 25 insertions(+), 27 deletions(-)
include/linux/bootconfig.h +6 -6
@@ -25,10 +25,10 @@* The checksum will be used with the BOOTCONFIG_MAGIC and the size for * embedding the bootconfig in the initrd image. */ -static inline __init u32 xbc_calc_checksum (void *data,u32 size) +static inline __init uint32_t xbc_calc_checksum (void *data,uint32_t size) {unsigned char *p = data; -u32 ret =0 ; +uint32_t ret =0 ;while (size--) ret += *p++;
@@ -38,10 +38,10 @@ static inline __init u32 xbc_calc_checksum(void *data, u32 size)/* XBC tree node */ struct xbc_node { -u16 next; -u16 child; -u16 parent; -u16 data; +uint16_t next; +uint16_t child; +uint16_t parent; +uint16_t data; } __attribute__ ((__packed__ ));#define XBC_KEY 0
lib/bootconfig.c +8 -8
@@ -244,7 +244,7 @@ int __init xbc_node_compose_key_after(struct xbc_node *root,struct xbc_node *node, char *buf, size_t size) { - u16 keys[XBC_DEPTH_MAX]; + uint16_t keys[XBC_DEPTH_MAX];int depth =0 , ret =0 , total =0 ;if (!node || node == root)
@@ -359,21 +359,21 @@ const char * __init xbc_node_find_next_key_value(struct xbc_node *root,/* XBC parse and tree build */ -static int __init xbc_init_node (struct xbc_node *node,char *data,u32 flag) +static int __init xbc_init_node (struct xbc_node *node,char *data,uint32_t flag) {unsigned long offset = data - xbc_data;if (WARN_ON (offset >=XBC_DATA_MAX ))return -EINVAL ; - node->data = (u16 )offset | flag; + node->data = (uint16_t )offset | flag; node->child =0 ; node->next =0 ;return 0 ; } -static struct xbc_node *__init xbc_add_node (char *data,u32 flag) +static struct xbc_node *__init xbc_add_node (char *data,uint32_t flag) {struct xbc_node *node;
@@ -403,7 +403,7 @@ static inline __init struct xbc_node *xbc_last_child(struct xbc_node *node)return node; } -static struct xbc_node *__init __xbc_add_sibling (char *data,u32 flag,bool head) +static struct xbc_node *__init __xbc_add_sibling (char *data,uint32_t flag,bool head) {struct xbc_node *sib, *node =xbc_add_node (data, flag);
@@ -430,17 +430,17 @@ static struct xbc_node * __init __xbc_add_sibling(char *data, u32 flag, bool heareturn node; } -static inline struct xbc_node *__init xbc_add_sibling (char *data,u32 flag) +static inline struct xbc_node *__init xbc_add_sibling (char *data,uint32_t flag) {return __xbc_add_sibling (data, flag, false); } -static inline struct xbc_node *__init xbc_add_head_sibling (char *data,u32 flag) +static inline struct xbc_node *__init xbc_add_head_sibling (char *data,uint32_t flag) {return __xbc_add_sibling (data, flag, true); } -static inline __init struct xbc_node *xbc_add_child (char *data,u32 flag) +static inline __init struct xbc_node *xbc_add_child (char *data,uint32_t flag) {struct xbc_node *node =xbc_add_sibling (data, flag);
tools/bootconfig/include/linux/kernel.h +1 -3
@@ -3,11 +3,9 @@#define _SKC_LINUX_KERNEL_H#include <stdlib.h> +#include <stdint.h> #include <stdbool.h> -typedef unsigned short u16 ; -typedef unsigned int u32 ; -#define unlikely (cond) (cond)#define __init
tools/bootconfig/main.c +10 -10
@@ -178,7 +178,7 @@ static int load_xbc_from_initrd(int fd, char **buf) {struct stat stat;int ret; -u32 size =0 , csum =0 , rcsum; +uint32_t size =0 , csum =0 , rcsum;char magic[BOOTCONFIG_MAGIC_LEN ];const char *msg;
@@ -202,11 +202,11 @@ static int load_xbc_from_initrd(int fd, char **buf)if (lseek (fd, -(8 +BOOTCONFIG_MAGIC_LEN ),SEEK_END ) <0 )return pr_errno ("Failed to lseek for size" , -errno); -if (read (fd, &size,sizeof (u32)) <0 ) +if (read (fd, &size,sizeof (uint32_t )) <0 )return pr_errno ("Failed to read size" , -errno); size =le32toh (size); -if (read (fd, &csum,sizeof (u32)) <0 ) +if (read (fd, &csum,sizeof (uint32_t )) <0 )return pr_errno ("Failed to read checksum" , -errno); csum =le32toh (csum);
@@ -364,7 +364,7 @@ static int apply_xbc(const char *path, const char *xbc_path)size_t total_size;struct stat stat;const char *msg; -u32 size, csum; +uint32_t size, csum;int pos, pad;int ret, fd;
@@ -378,7 +378,7 @@ static int apply_xbc(const char *path, const char *xbc_path)/* Backup the bootconfig data */ data =calloc (size +BOOTCONFIG_ALIGN + -sizeof (u32) +sizeof (u32) +BOOTCONFIG_MAGIC_LEN ,1 ); +sizeof (uint32_t ) +sizeof (uint32_t ) +BOOTCONFIG_MAGIC_LEN ,1 );if (!data)return -ENOMEM ;memcpy (data, buf, size);
@@ -426,17 +426,17 @@ static int apply_xbc(const char *path, const char *xbc_path) }/* To align up the total size to BOOTCONFIG_ALIGN, get padding size */ - total_size = stat.st_size + size +sizeof (u32) *2 +BOOTCONFIG_MAGIC_LEN ; + total_size = stat.st_size + size +sizeof (uint32_t ) *2 +BOOTCONFIG_MAGIC_LEN ; pad = ((total_size +BOOTCONFIG_ALIGN -1 ) & (~BOOTCONFIG_ALIGN_MASK )) - total_size; size += pad;/* Add a footer */ p = data + size; - *(u32 *)p =htole32 (size); - p +=sizeof (u32); + *(uint32_t *)p =htole32 (size); + p +=sizeof (uint32_t ); - *(u32 *)p =htole32 (csum); - p +=sizeof (u32); + *(uint32_t *)p =htole32 (csum); + p +=sizeof (uint32_t );memcpy (p,BOOTCONFIG_MAGIC ,BOOTCONFIG_MAGIC_LEN ); p +=BOOTCONFIG_MAGIC_LEN ;
Masami Hiramatsu
maintainerPATCH 7/7 bootconfig: Cleanup dummy headers in tools/bootconfig
In reply to Masami HiramatsuCleanup dummy headers in tools/bootconfig/include except for tools/bootconfig/include/linux/bootconfig.h. For this change, I uses __KERNEL__ macro to split kernel header #include and introduce xbc_alloc_mem() and xbc_free_mem().
--- include/linux/bootconfig.h | 10 ++++++ lib/bootconfig.c | 43 +++++++++++++++++++++++--- tools/bootconfig/Makefile | 2 + tools/bootconfig/include/linux/bootconfig.h | 45 ++++++++++++++++++++++++++- tools/bootconfig/include/linux/bug.h | 12 ------- tools/bootconfig/include/linux/ctype.h | 7 ---- tools/bootconfig/include/linux/errno.h | 7 ---- tools/bootconfig/include/linux/kernel.h | 14 -------- tools/bootconfig/include/linux/memblock.h | 11 ------- tools/bootconfig/include/linux/string.h | 32 ------------------- tools/bootconfig/main.c | 1 - 11 files changed, 93 insertions(+), 91 deletions(-) delete mode 100644 tools/bootconfig/include/linux/bug.h delete mode 100644 tools/bootconfig/include/linux/ctype.h delete mode 100644 tools/bootconfig/include/linux/errno.h delete mode 100644 tools/bootconfig/include/linux/kernel.h delete mode 100644 tools/bootconfig/include/linux/memblock.h delete mode 100644 tools/bootconfig/include/linux/string.h
include/linux/bootconfig.h +10 -0
@@ -7,8 +7,18 @@* Author: Masami Hiramatsu <[email protected]> */ +#ifdef __KERNEL__#include <linux/kernel.h> #include <linux/types.h> +#else /* !__KERNEL__ */ +/* +* NOTE: This is only for tools/bootconfig, because tools/bootconfig will +* run the parser sanity test. +* This does NOT mean linux/bootconfig.h is available in the user space. +* However, if you change this file, please make sure the tools/bootconfig +* has no issue on building and running. +*/ +#endif #define BOOTCONFIG_MAGIC "#BOOTCONFIG\n"#define BOOTCONFIG_MAGIC_LEN 12
lib/bootconfig.c +38 -5
82 lines not on this page · raw message
tools/bootconfig/Makefile +1 -1
@@ -17,7 +17,7 @@ ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) all: $(ALL_PROGRAMS) test -$(OUTPUT)bootconfig: main.c $(LIBSRC) +$(OUTPUT)bootconfig: main.c include/linux/bootconfig.h $(LIBSRC) $(CC) $(filter %.c,$^) $(CFLAGS) -o $@ test: $(ALL_PROGRAMS) test-bootconfig.sh
tools/bootconfig/include/linux/bootconfig.h +44 -1
54 lines not on this page · raw message
tools/bootconfig/include/linux/bug.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SKC_LINUX_BUG_H -#define _SKC_LINUX_BUG_H - -#include <stdio.h> -#include <stdlib.h> - -#define WARN_ON (cond) \ - ((cond) ? printf("Internal warning(%s:%d, %s): %s\n", \ - __FILE__, __LINE__, __func__, #cond) : 0) - -#endif
tools/bootconfig/include/linux/ctype.h deleted +0 -7
@@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SKC_LINUX_CTYPE_H -#define _SKC_LINUX_CTYPE_H - -#include <ctype.h> - -#endif
tools/bootconfig/include/linux/errno.h deleted +0 -7
@@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SKC_LINUX_ERRNO_H -#define _SKC_LINUX_ERRNO_H - -#include <asm/errno.h> - -#endif
tools/bootconfig/include/linux/kernel.h deleted +0 -14
@@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SKC_LINUX_KERNEL_H -#define _SKC_LINUX_KERNEL_H - -#include <stdlib.h> -#include <stdint.h> -#include <stdbool.h> - -#define unlikely (cond) (cond) - -#define __init -#define __initdata - -#endif
tools/bootconfig/include/linux/memblock.h deleted +0 -11
@@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _XBC_LINUX_MEMBLOCK_H -#define _XBC_LINUX_MEMBLOCK_H - -#include <stdlib.h> - -#define SMP_CACHE_BYTES 0 -#define memblock_alloc (size, align) malloc(size) -#define memblock_free_ptr (paddr, size) free(paddr) - -#endif
tools/bootconfig/include/linux/string.h deleted +0 -32
@@ -1,32 +0,0 @@ -/* 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
tools/bootconfig/main.c +0 -1
@@ -12,7 +12,6 @@#include <errno.h> #include <endian.h> -#include <linux/kernel.h> #include <linux/bootconfig.h> #define pr_err (fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)