Skip to content

Commit 5dfe50b

Browse files
mhiramatrostedt
authored andcommitted
bootconfig: Rename xbc_node_find_child() to xbc_node_find_subkey()
Rename xbc_node_find_child() to xbc_node_find_subkey() for clarifying that function returns a key node (no value node). Since there are xbc_node_for_each_child() (loop on all child nodes) and xbc_node_for_each_subkey() (loop on only subkey nodes), this name distinction is necessary to avoid confusing users. Link: https://lkml.kernel.org/r/163119459826.161018.11200274779483115300.stgit@devnote2 Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 5f8895b commit 5dfe50b

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

include/linux/bootconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static inline __init bool xbc_node_is_leaf(struct xbc_node *node)
110110
}
111111

112112
/* Tree-based key-value access APIs */
113-
struct xbc_node * __init xbc_node_find_child(struct xbc_node *parent,
113+
struct xbc_node * __init xbc_node_find_subkey(struct xbc_node *parent,
114114
const char *key);
115115

116116
const char * __init xbc_node_find_value(struct xbc_node *parent,
@@ -148,7 +148,7 @@ xbc_find_value(const char *key, struct xbc_node **vnode)
148148
*/
149149
static inline struct xbc_node * __init xbc_find_node(const char *key)
150150
{
151-
return xbc_node_find_child(NULL, key);
151+
return xbc_node_find_subkey(NULL, key);
152152
}
153153

154154
/**

kernel/trace/trace_boot.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ trace_boot_hist_add_one_handler(struct xbc_node *hnode, char **bufp,
262262
append_printf(bufp, end, ":%s(%s)", handler, p);
263263

264264
/* Compose 'action' parameter */
265-
knode = xbc_node_find_child(hnode, "trace");
265+
knode = xbc_node_find_subkey(hnode, "trace");
266266
if (!knode)
267-
knode = xbc_node_find_child(hnode, "save");
267+
knode = xbc_node_find_subkey(hnode, "save");
268268

269269
if (knode) {
270270
anode = xbc_node_get_child(knode);
@@ -283,7 +283,7 @@ trace_boot_hist_add_one_handler(struct xbc_node *hnode, char **bufp,
283283
sep = ',';
284284
}
285285
append_printf(bufp, end, ")");
286-
} else if (xbc_node_find_child(hnode, "snapshot")) {
286+
} else if (xbc_node_find_subkey(hnode, "snapshot")) {
287287
append_printf(bufp, end, ".snapshot()");
288288
} else {
289289
pr_err("hist.%s requires an action.\n",
@@ -314,7 +314,7 @@ trace_boot_hist_add_handlers(struct xbc_node *hnode, char **bufp,
314314
break;
315315
}
316316

317-
if (xbc_node_find_child(hnode, param))
317+
if (xbc_node_find_subkey(hnode, param))
318318
ret = trace_boot_hist_add_one_handler(hnode, bufp, end, handler, param);
319319

320320
return ret;
@@ -374,7 +374,7 @@ trace_boot_compose_hist_cmd(struct xbc_node *hnode, char *buf, size_t size)
374374
if (p)
375375
append_printf(&buf, end, ":name=%s", p);
376376

377-
node = xbc_node_find_child(hnode, "var");
377+
node = xbc_node_find_subkey(hnode, "var");
378378
if (node) {
379379
xbc_node_for_each_key_value(node, knode, p) {
380380
/* Expression must not include spaces. */
@@ -393,13 +393,13 @@ trace_boot_compose_hist_cmd(struct xbc_node *hnode, char *buf, size_t size)
393393
append_printf(&buf, end, ":clear");
394394

395395
/* Histogram handler and actions */
396-
node = xbc_node_find_child(hnode, "onmax");
396+
node = xbc_node_find_subkey(hnode, "onmax");
397397
if (node && trace_boot_hist_add_handlers(node, &buf, end, "var") < 0)
398398
return -EINVAL;
399-
node = xbc_node_find_child(hnode, "onchange");
399+
node = xbc_node_find_subkey(hnode, "onchange");
400400
if (node && trace_boot_hist_add_handlers(node, &buf, end, "var") < 0)
401401
return -EINVAL;
402-
node = xbc_node_find_child(hnode, "onmatch");
402+
node = xbc_node_find_subkey(hnode, "onmatch");
403403
if (node && trace_boot_hist_add_handlers(node, &buf, end, "event") < 0)
404404
return -EINVAL;
405405

@@ -436,7 +436,7 @@ trace_boot_init_histograms(struct trace_event_file *file,
436436
}
437437
}
438438

439-
if (xbc_node_find_child(hnode, "keys")) {
439+
if (xbc_node_find_subkey(hnode, "keys")) {
440440
if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) {
441441
tmp = kstrdup(buf, GFP_KERNEL);
442442
if (trigger_process_regex(file, buf) < 0)
@@ -495,7 +495,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode,
495495
else if (trigger_process_regex(file, buf) < 0)
496496
pr_err("Failed to apply an action: %s\n", p);
497497
}
498-
anode = xbc_node_find_child(enode, "hist");
498+
anode = xbc_node_find_subkey(enode, "hist");
499499
if (anode)
500500
trace_boot_init_histograms(file, anode, buf, ARRAY_SIZE(buf));
501501
} else if (xbc_node_find_value(enode, "actions", NULL))
@@ -517,7 +517,7 @@ trace_boot_init_events(struct trace_array *tr, struct xbc_node *node)
517517
bool enable, enable_all = false;
518518
const char *data;
519519

520-
node = xbc_node_find_child(node, "event");
520+
node = xbc_node_find_subkey(node, "event");
521521
if (!node)
522522
return;
523523
/* per-event key starts with "event.GROUP.EVENT" */
@@ -620,7 +620,7 @@ trace_boot_init_instances(struct xbc_node *node)
620620
struct trace_array *tr;
621621
const char *p;
622622

623-
node = xbc_node_find_child(node, "instance");
623+
node = xbc_node_find_subkey(node, "instance");
624624
if (!node)
625625
return;
626626

lib/bootconfig.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ xbc_node_match_prefix(struct xbc_node *node, const char **prefix)
142142
}
143143

144144
/**
145-
* xbc_node_find_child() - Find a child node which matches given key
145+
* xbc_node_find_subkey() - Find a subkey node which matches given key
146146
* @parent: An XBC node.
147147
* @key: A key string.
148148
*
149-
* Search a node under @parent which matches @key. The @key can contain
149+
* Search a key node under @parent which matches @key. The @key can contain
150150
* several words jointed with '.'. If @parent is NULL, this searches the
151151
* node from whole tree. Return NULL if no node is matched.
152152
*/
153153
struct xbc_node * __init
154-
xbc_node_find_child(struct xbc_node *parent, const char *key)
154+
xbc_node_find_subkey(struct xbc_node *parent, const char *key)
155155
{
156156
struct xbc_node *node;
157157

@@ -191,7 +191,7 @@ const char * __init
191191
xbc_node_find_value(struct xbc_node *parent, const char *key,
192192
struct xbc_node **vnode)
193193
{
194-
struct xbc_node *node = xbc_node_find_child(parent, key);
194+
struct xbc_node *node = xbc_node_find_subkey(parent, key);
195195

196196
if (!node || !xbc_node_is_key(node))
197197
return NULL;

0 commit comments

Comments
 (0)