mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-05 00:07:48 -04:00
bootconfig: Change array value to use child node
It is not possible to put an array value with subkeys under a key node, because both of subkeys and the array elements are using "next" field of the xbc_node. Thus this changes the array values to use "child" field in the array case. The reason why split this change is to test it easily. Link: https://lkml.kernel.org/r/162262193838.264090.16044473274501498656.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
committed by
Steven Rostedt (VMware)
parent
ee0a07017a
commit
ca24306d83
@@ -367,6 +367,14 @@ static inline __init struct xbc_node *xbc_last_sibling(struct xbc_node *node)
|
||||
return node;
|
||||
}
|
||||
|
||||
static inline __init struct xbc_node *xbc_last_child(struct xbc_node *node)
|
||||
{
|
||||
while (node->child)
|
||||
node = xbc_node_get_child(node);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct xbc_node * __init xbc_add_sibling(char *data, u32 flag)
|
||||
{
|
||||
struct xbc_node *sib, *node = xbc_add_node(data, flag);
|
||||
@@ -517,17 +525,20 @@ static int __init xbc_parse_array(char **__v)
|
||||
char *next;
|
||||
int c = 0;
|
||||
|
||||
if (last_parent->child)
|
||||
last_parent = xbc_node_get_child(last_parent);
|
||||
|
||||
do {
|
||||
c = __xbc_parse_value(__v, &next);
|
||||
if (c < 0)
|
||||
return c;
|
||||
|
||||
node = xbc_add_sibling(*__v, XBC_VALUE);
|
||||
node = xbc_add_child(*__v, XBC_VALUE);
|
||||
if (!node)
|
||||
return -ENOMEM;
|
||||
*__v = next;
|
||||
} while (c == ',');
|
||||
node->next = 0;
|
||||
node->child = 0;
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -615,8 +626,12 @@ static int __init xbc_parse_kv(char **k, char *v, int op)
|
||||
|
||||
if (op == ':' && child) {
|
||||
xbc_init_node(child, v, XBC_VALUE);
|
||||
} else if (!xbc_add_sibling(v, XBC_VALUE))
|
||||
return -ENOMEM;
|
||||
} else {
|
||||
if (op == '+' && child)
|
||||
last_parent = xbc_last_child(child);
|
||||
if (!xbc_add_sibling(v, XBC_VALUE))
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (c == ',') { /* Array */
|
||||
c = xbc_parse_array(&next);
|
||||
|
||||
Reference in New Issue
Block a user