static int ftrace_trace_onoff_callback(struct ftrace_hash *hash, char *glob, char *cmd, char *param, int enable) { struct ftrace_probe_ops *ops; void *count = (void *)-1; char *number; int ret; /* hash funcs only work with set_ftrace_filter */ if (!enable) return -EINVAL; if (glob[0] == '!') return ftrace_trace_onoff_unreg(glob+1, cmd, param); /* we register both traceon and traceoff to this callback */ if (strcmp(cmd, "traceon") == 0) ops = &traceon_probe_ops; else ops = &traceoff_probe_ops; if (!param) goto out_reg; number = strsep(¶m, ":"); if (!strlen(number)) goto out_reg; /* * We use the callback data field (which is a pointer) * as our counter. */ ret = strict_strtoul(number, 0, (unsigned long *)&count); if (ret) return ret; out_reg: ret = register_ftrace_function_probe(glob, ops, count); return ret < 0 ? ret : 0; }
static int ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable) { struct ftrace_probe_ops *ops; void *count = (void *)-1; char *number; int ret; if (!enable) return -EINVAL; if (glob[0] == '!') return ftrace_trace_onoff_unreg(glob+1, cmd, param); if (strcmp(cmd, "traceon") == 0) ops = &traceon_probe_ops; else ops = &traceoff_probe_ops; if (!param) goto out_reg; number = strsep(¶m, ":"); if (!strlen(number)) goto out_reg; ret = strict_strtoul(number, 0, (unsigned long *)&count); if (ret) return ret; out_reg: ret = register_ftrace_function_probe(glob, ops, count); return ret < 0 ? ret : 0; }