alistair23-linux/tools/perf/util/strfilter.h
Arnaldo Carvalho de Melo 316c7136f8 perf tools: Finish the removal of 'self' arguments
They convey no information, perhaps I was bitten by some snake at some
point, complete the detox by naming the last of those arguments more
sensibly.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-u1r0dnjoro08dgztiy2g3t2q@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-11-05 15:32:36 -03:00

49 lines
1.3 KiB
C

#ifndef __PERF_STRFILTER_H
#define __PERF_STRFILTER_H
/* General purpose glob matching filter */
#include <linux/list.h>
#include <stdbool.h>
/* A node of string filter */
struct strfilter_node {
struct strfilter_node *l; /* Tree left branche (for &,|) */
struct strfilter_node *r; /* Tree right branche (for !,&,|) */
const char *p; /* Operator or rule */
};
/* String filter */
struct strfilter {
struct strfilter_node *root;
};
/**
* strfilter__new - Create a new string filter
* @rules: Filter rule, which is a combination of glob expressions.
* @err: Pointer which points an error detected on @rules
*
* Parse @rules and return new strfilter. Return NULL if an error detected.
* In that case, *@err will indicate where it is detected, and *@err is NULL
* if a memory allocation is failed.
*/
struct strfilter *strfilter__new(const char *rules, const char **err);
/**
* strfilter__compare - compare given string and a string filter
* @filter: String filter
* @str: target string
*
* Compare @str and @filter. Return true if the str match the rule
*/
bool strfilter__compare(struct strfilter *filter, const char *str);
/**
* strfilter__delete - delete a string filter
* @filter: String filter to delete
*
* Delete @filter.
*/
void strfilter__delete(struct strfilter *filter);
#endif