diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-01-02 04:04:14 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-02-03 09:48:18 -0500 |
commit | ac483c446b67870444c9eeaf8325d3d2af9b91bc (patch) | |
tree | e2765af4acf86ce986856b2963036138ae077d58 /kernel/trace/ftrace.c | |
parent | 623ec991ce0e8cd5791bad656c162fa837635907 (diff) |
ftrace: Change filter/notrace set functions to return exit code
Currently the ftrace_set_filter and ftrace_set_notrace functions
do not return any return code. So there's no way for ftrace_ops
user to tell wether the filter was correctly applied.
The set_ftrace_filter interface returns error in case the filter
did not match:
# echo krava > set_ftrace_filter
bash: echo: write error: Invalid argument
Changing both ftrace_set_filter and ftrace_set_notrace functions
to return zero if the filter was applied correctly or -E* values
in case of error.
Link: http://lkml.kernel.org/r/1325495060-6402-2-git-send-email-jolsa@redhat.com
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 683d559a0eef..e2e0597c0845 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3146,8 +3146,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3146 | mutex_lock(&ftrace_regex_lock); | 3146 | mutex_lock(&ftrace_regex_lock); |
3147 | if (reset) | 3147 | if (reset) |
3148 | ftrace_filter_reset(hash); | 3148 | ftrace_filter_reset(hash); |
3149 | if (buf) | 3149 | if (buf && !ftrace_match_records(hash, buf, len)) { |
3150 | ftrace_match_records(hash, buf, len); | 3150 | ret = -EINVAL; |
3151 | goto out_regex_unlock; | ||
3152 | } | ||
3151 | 3153 | ||
3152 | mutex_lock(&ftrace_lock); | 3154 | mutex_lock(&ftrace_lock); |
3153 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3155 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
@@ -3157,6 +3159,7 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3157 | 3159 | ||
3158 | mutex_unlock(&ftrace_lock); | 3160 | mutex_unlock(&ftrace_lock); |
3159 | 3161 | ||
3162 | out_regex_unlock: | ||
3160 | mutex_unlock(&ftrace_regex_lock); | 3163 | mutex_unlock(&ftrace_regex_lock); |
3161 | 3164 | ||
3162 | free_ftrace_hash(hash); | 3165 | free_ftrace_hash(hash); |
@@ -3173,10 +3176,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3173 | * Filters denote which functions should be enabled when tracing is enabled. | 3176 | * Filters denote which functions should be enabled when tracing is enabled. |
3174 | * If @buf is NULL and reset is set, all functions will be enabled for tracing. | 3177 | * If @buf is NULL and reset is set, all functions will be enabled for tracing. |
3175 | */ | 3178 | */ |
3176 | void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, | 3179 | int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, |
3177 | int len, int reset) | 3180 | int len, int reset) |
3178 | { | 3181 | { |
3179 | ftrace_set_regex(ops, buf, len, reset, 1); | 3182 | return ftrace_set_regex(ops, buf, len, reset, 1); |
3180 | } | 3183 | } |
3181 | EXPORT_SYMBOL_GPL(ftrace_set_filter); | 3184 | EXPORT_SYMBOL_GPL(ftrace_set_filter); |
3182 | 3185 | ||
@@ -3191,10 +3194,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter); | |||
3191 | * is enabled. If @buf is NULL and reset is set, all functions will be enabled | 3194 | * is enabled. If @buf is NULL and reset is set, all functions will be enabled |
3192 | * for tracing. | 3195 | * for tracing. |
3193 | */ | 3196 | */ |
3194 | void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, | 3197 | int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, |
3195 | int len, int reset) | 3198 | int len, int reset) |
3196 | { | 3199 | { |
3197 | ftrace_set_regex(ops, buf, len, reset, 0); | 3200 | return ftrace_set_regex(ops, buf, len, reset, 0); |
3198 | } | 3201 | } |
3199 | EXPORT_SYMBOL_GPL(ftrace_set_notrace); | 3202 | EXPORT_SYMBOL_GPL(ftrace_set_notrace); |
3200 | /** | 3203 | /** |