@@ -219,13 +219,12 @@ static int __init
219
219
trace_boot_hist_add_array (struct xbc_node * hnode , char * * bufp ,
220
220
char * end , const char * key )
221
221
{
222
- struct xbc_node * knode , * anode ;
222
+ struct xbc_node * anode ;
223
223
const char * p ;
224
224
char sep ;
225
225
226
- knode = xbc_node_find_child (hnode , key );
227
- if (knode ) {
228
- anode = xbc_node_get_child (knode );
226
+ p = xbc_node_find_value (hnode , key , & anode );
227
+ if (p ) {
229
228
if (!anode ) {
230
229
pr_err ("hist.%s requires value(s).\n" , key );
231
230
return - EINVAL ;
@@ -263,9 +262,9 @@ trace_boot_hist_add_one_handler(struct xbc_node *hnode, char **bufp,
263
262
append_printf (bufp , end , ":%s(%s)" , handler , p );
264
263
265
264
/* Compose 'action' parameter */
266
- knode = xbc_node_find_child (hnode , "trace" );
265
+ knode = xbc_node_find_subkey (hnode , "trace" );
267
266
if (!knode )
268
- knode = xbc_node_find_child (hnode , "save" );
267
+ knode = xbc_node_find_subkey (hnode , "save" );
269
268
270
269
if (knode ) {
271
270
anode = xbc_node_get_child (knode );
@@ -284,7 +283,7 @@ trace_boot_hist_add_one_handler(struct xbc_node *hnode, char **bufp,
284
283
sep = ',' ;
285
284
}
286
285
append_printf (bufp , end , ")" );
287
- } else if (xbc_node_find_child (hnode , "snapshot" )) {
286
+ } else if (xbc_node_find_subkey (hnode , "snapshot" )) {
288
287
append_printf (bufp , end , ".snapshot()" );
289
288
} else {
290
289
pr_err ("hist.%s requires an action.\n" ,
@@ -315,7 +314,7 @@ trace_boot_hist_add_handlers(struct xbc_node *hnode, char **bufp,
315
314
break ;
316
315
}
317
316
318
- if (xbc_node_find_child (hnode , param ))
317
+ if (xbc_node_find_subkey (hnode , param ))
319
318
ret = trace_boot_hist_add_one_handler (hnode , bufp , end , handler , param );
320
319
321
320
return ret ;
@@ -375,7 +374,7 @@ trace_boot_compose_hist_cmd(struct xbc_node *hnode, char *buf, size_t size)
375
374
if (p )
376
375
append_printf (& buf , end , ":name=%s" , p );
377
376
378
- node = xbc_node_find_child (hnode , "var" );
377
+ node = xbc_node_find_subkey (hnode , "var" );
379
378
if (node ) {
380
379
xbc_node_for_each_key_value (node , knode , p ) {
381
380
/* Expression must not include spaces. */
@@ -386,21 +385,21 @@ trace_boot_compose_hist_cmd(struct xbc_node *hnode, char *buf, size_t size)
386
385
}
387
386
388
387
/* Histogram control attributes (mutual exclusive) */
389
- if (xbc_node_find_child (hnode , "pause" ))
388
+ if (xbc_node_find_value (hnode , "pause" , NULL ))
390
389
append_printf (& buf , end , ":pause" );
391
- else if (xbc_node_find_child (hnode , "continue" ))
390
+ else if (xbc_node_find_value (hnode , "continue" , NULL ))
392
391
append_printf (& buf , end , ":continue" );
393
- else if (xbc_node_find_child (hnode , "clear" ))
392
+ else if (xbc_node_find_value (hnode , "clear" , NULL ))
394
393
append_printf (& buf , end , ":clear" );
395
394
396
395
/* Histogram handler and actions */
397
- node = xbc_node_find_child (hnode , "onmax" );
396
+ node = xbc_node_find_subkey (hnode , "onmax" );
398
397
if (node && trace_boot_hist_add_handlers (node , & buf , end , "var" ) < 0 )
399
398
return - EINVAL ;
400
- node = xbc_node_find_child (hnode , "onchange" );
399
+ node = xbc_node_find_subkey (hnode , "onchange" );
401
400
if (node && trace_boot_hist_add_handlers (node , & buf , end , "var" ) < 0 )
402
401
return - EINVAL ;
403
- node = xbc_node_find_child (hnode , "onmatch" );
402
+ node = xbc_node_find_subkey (hnode , "onmatch" );
404
403
if (node && trace_boot_hist_add_handlers (node , & buf , end , "event" ) < 0 )
405
404
return - EINVAL ;
406
405
@@ -437,7 +436,7 @@ trace_boot_init_histograms(struct trace_event_file *file,
437
436
}
438
437
}
439
438
440
- if (xbc_node_find_child (hnode , "keys" )) {
439
+ if (xbc_node_find_subkey (hnode , "keys" )) {
441
440
if (trace_boot_compose_hist_cmd (hnode , buf , size ) == 0 ) {
442
441
tmp = kstrdup (buf , GFP_KERNEL );
443
442
if (trigger_process_regex (file , buf ) < 0 )
@@ -496,7 +495,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode,
496
495
else if (trigger_process_regex (file , buf ) < 0 )
497
496
pr_err ("Failed to apply an action: %s\n" , p );
498
497
}
499
- anode = xbc_node_find_child (enode , "hist" );
498
+ anode = xbc_node_find_subkey (enode , "hist" );
500
499
if (anode )
501
500
trace_boot_init_histograms (file , anode , buf , ARRAY_SIZE (buf ));
502
501
} else if (xbc_node_find_value (enode , "actions" , NULL ))
@@ -518,7 +517,7 @@ trace_boot_init_events(struct trace_array *tr, struct xbc_node *node)
518
517
bool enable , enable_all = false;
519
518
const char * data ;
520
519
521
- node = xbc_node_find_child (node , "event" );
520
+ node = xbc_node_find_subkey (node , "event" );
522
521
if (!node )
523
522
return ;
524
523
/* per-event key starts with "event.GROUP.EVENT" */
@@ -621,7 +620,7 @@ trace_boot_init_instances(struct xbc_node *node)
621
620
struct trace_array * tr ;
622
621
const char * p ;
623
622
624
- node = xbc_node_find_child (node , "instance" );
623
+ node = xbc_node_find_subkey (node , "instance" );
625
624
if (!node )
626
625
return ;
627
626
0 commit comments