tools/perf/util/strfilter.h
Source file repositories/reference/linux-study-clean/tools/perf/util/strfilter.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/strfilter.h- Extension
.h- Size
- 2591 bytes
- Lines
- 85
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hstdbool.h
Detected Declarations
struct strfilter_nodestruct strfilter
Annotated Snippet
struct strfilter_node {
struct strfilter_node *l; /* Tree left branch (for &,|) */
struct strfilter_node *r; /* Tree right branch (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__or - Append an additional rule by logical-or
* @filter: Original string filter
* @rules: Filter rule to be appended at left of the root of
* @filter by using logical-or.
* @err: Pointer which points an error detected on @rules
*
* Parse @rules and join it to the @filter by using logical-or.
* Return 0 if success, or return the error code.
*/
int strfilter__or(struct strfilter *filter,
const char *rules, const char **err);
/**
* strfilter__add - Append an additional rule by logical-and
* @filter: Original string filter
* @rules: Filter rule to be appended at left of the root of
* @filter by using logical-and.
* @err: Pointer which points an error detected on @rules
*
* Parse @rules and join it to the @filter by using logical-and.
* Return 0 if success, or return the error code.
*/
int strfilter__and(struct strfilter *filter,
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);
/**
* strfilter__string - Reconstruct a rule string from filter
* @filter: String filter to reconstruct
*
* Reconstruct a rule string from @filter. This will be good for
* debug messages. Note that returning string must be freed afterward.
*/
char *strfilter__string(struct strfilter *filter);
#endif
Annotation
- Immediate include surface: `linux/list.h`, `stdbool.h`.
- Detected declarations: `struct strfilter_node`, `struct strfilter`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.