}
}
+#ifdef CONFIG_KPROBE_EVENTS
+extern int trace_kprobe_run_command(const char *command);
+
+static int __init
+trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
+{
+ struct xbc_node *anode;
+ char buf[MAX_BUF_LEN];
+ const char *val;
+ char *p;
+ int len;
+
+ len = snprintf(buf, ARRAY_SIZE(buf) - 1, "p:kprobes/%s ", event);
+ if (len >= ARRAY_SIZE(buf)) {
+ pr_err("Event name is too long: %s\n", event);
+ return -E2BIG;
+ }
+ p = buf + len;
+ len = ARRAY_SIZE(buf) - len;
+
+ xbc_node_for_each_array_value(node, "probes", anode, val) {
+ if (strlcpy(p, val, len) >= len) {
+ pr_err("Probe definition is too long: %s\n", val);
+ return -E2BIG;
+ }
+ if (trace_kprobe_run_command(buf) < 0) {
+ pr_err("Failed to add probe: %s\n", buf);
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+#else
+static inline int __init
+trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
+{
+ pr_err("Kprobe event is not supported.\n");
+ return -ENOTSUPP;
+}
+#endif
+
static void __init
trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode,
struct xbc_node *enode)
group = xbc_node_get_data(gnode);
event = xbc_node_get_data(enode);
+ if (!strcmp(group, "kprobes"))
+ if (trace_boot_add_kprobe_event(enode, event) < 0)
+ return;
+
mutex_lock(&event_mutex);
file = find_event_file(tr, group, event);
if (!file) {
return ret == -ECANCELED ? -EINVAL : ret;
}
+int trace_kprobe_run_command(const char *command)
+{
+ return trace_run_command(command, create_or_delete_trace_kprobe);
+}
+
static int trace_kprobe_release(struct dyn_event *ev)
{
struct trace_kprobe *tk = to_trace_kprobe(ev);