@@ -88,37 +88,32 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node)
8888}
8989
9090#ifdef CONFIG_KPROBE_EVENTS
91- extern int trace_kprobe_run_command (const char * command );
92-
9391static int __init
9492trace_boot_add_kprobe_event (struct xbc_node * node , const char * event )
9593{
94+ struct dynevent_cmd cmd ;
9695 struct xbc_node * anode ;
9796 char buf [MAX_BUF_LEN ];
9897 const char * val ;
99- char * p ;
100- int len ;
98+ int ret ;
10199
102- len = snprintf (buf , ARRAY_SIZE (buf ) - 1 , "p:kprobes/%s " , event );
103- if (len >= ARRAY_SIZE (buf )) {
104- pr_err ("Event name is too long: %s\n" , event );
105- return - E2BIG ;
106- }
107- p = buf + len ;
108- len = ARRAY_SIZE (buf ) - len ;
100+ kprobe_event_cmd_init (& cmd , buf , MAX_BUF_LEN );
101+
102+ ret = kprobe_event_gen_cmd_start (& cmd , event , NULL );
103+ if (ret )
104+ return ret ;
109105
110106 xbc_node_for_each_array_value (node , "probes" , anode , val ) {
111- if (strlcpy (p , val , len ) >= len ) {
112- pr_err ("Probe definition is too long: %s\n" , val );
113- return - E2BIG ;
114- }
115- if (trace_kprobe_run_command (buf ) < 0 ) {
116- pr_err ("Failed to add probe: %s\n" , buf );
117- return - EINVAL ;
118- }
107+ ret = kprobe_event_add_field (& cmd , val );
108+ if (ret )
109+ return ret ;
119110 }
120111
121- return 0 ;
112+ ret = kprobe_event_gen_cmd_end (& cmd );
113+ if (ret )
114+ pr_err ("Failed to add probe: %s\n" , buf );
115+
116+ return ret ;
122117}
123118#else
124119static inline int __init
0 commit comments