blob: 2bc41e1fff2f7b85492db97cdab0cfa5817f5863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#pragma once
enum filter_type {
// FILTER_INCLUDE, // unsupported for now
FILTER_EXCLUDE,
};
// A subset of borg patterns
enum pattern_type {
PATTERN_EQUAL, // /str
PATTERN_PREFIX, // /str/**
PATTERN_SUFFIX, // **/str
PATTERN_INFIX, // **/str/**
};
struct filter_rule {
enum filter_type ftype;
enum pattern_type ptype;
char *str;
size_t len; // length of str (strlen, but cached)
};
struct filter_rule parse_exclude_rule(const char *rule);
// The path must be relative to the tree root (and thus not start with a '/').
bool filter_rule_allows(const struct filter_rule rule, const char *path);
void filter_rule_debugdump(FILE *stream, const struct filter_rule rule);
|