mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Adds include logic in filtering.
This commit is contained in:
parent
99420cffab
commit
cb4a72afca
11 changed files with 248 additions and 92 deletions
20
scan.c
20
scan.c
|
|
@ -186,22 +186,6 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state,
|
|||
scan_file_insert(state, disk, file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified path/file should be listet.
|
||||
*/
|
||||
static int scan_filter(struct snapraid_state* state, const char* path, const char* file, int is_dir)
|
||||
{
|
||||
tommy_node* node = tommy_list_head(&state->excludelist);
|
||||
while (node) {
|
||||
struct snapraid_filter* filter = node->data;
|
||||
if (filter_path(filter, path, file, is_dir) == 0)
|
||||
return -1;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a directory.
|
||||
*/
|
||||
|
|
@ -241,7 +225,7 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, s
|
|||
}
|
||||
|
||||
if (S_ISREG(st.st_mode)) {
|
||||
if (scan_filter(state, sub_next, name, 0) == 0) {
|
||||
if (filter_path(&state->filterlist, sub_next, 0) == 0) {
|
||||
scan_file(scan, state, disk, sub_next, &st);
|
||||
} else {
|
||||
if (state->verbose) {
|
||||
|
|
@ -249,7 +233,7 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, s
|
|||
}
|
||||
}
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
if (scan_filter(state, sub_next, name, 1) == 0) {
|
||||
if (filter_path(&state->filterlist, sub_next, 1) == 0) {
|
||||
pathslash(path_next, sizeof(path_next));
|
||||
pathslash(sub_next, sizeof(sub_next));
|
||||
scan_dir(scan, state, disk, path_next, sub_next);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue