~aleksey14/rhash/master

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
30
31
32
33
34
35
36
37
38
39
40
41
42
/* find_file.h - functions for recursive scan of directories. */
#ifndef FIND_FILE_H
#define FIND_FILE_H

#include "common_func.h"
#include "file.h"

#ifdef __cplusplus
extern "C" {
#endif

/* find_file options */
#define FIND_WALK_DEPTH_FIRST 1
#define FIND_FOLLOW_SYMLINKS 2
#define FIND_SKIP_DIRS 4
#define FIND_LOG_ERRORS 8
#define FIND_CANCEL 16

/**
 * Options for file search.
 */
typedef struct file_search_data
{
	int options;
	int max_depth;
	blocks_vector_t root_files;
	int (*callback)(file_t* file, int data);
	int callback_data;
	int errors_count;
} file_search_data;

file_search_data* file_search_data_new(void);
void file_search_add_file(file_search_data* data, tstr_t path, unsigned file_mode);
void file_search_data_free(file_search_data* data);

void scan_files(file_search_data* data);

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

#endif /* FIND_FILE_H */