ftwin 0.8.10
ft_types.h
1#ifndef FT_TYPES_H
2#define FT_TYPES_H
3
4#include <pcre.h>
5#include <sys/types.h>
6
7#include <apr_file_info.h>
8#include <apr_getopt.h>
9#include <apr_pools.h>
10#include <apr_thread_mutex.h>
11#include <apr_time.h>
12#include <napr_hash.h>
13
14#include "config.h"
15#include "checksum.h"
16#include "ft_ignore.h"
17#include "napr_heap.h"
18
19#include <puzzle.h>
20
21#if HAVE_JANSSON
22#include <jansson.h>
23#endif
24
25/* Option flags */
26#define is_option_set(mask, option) ((mask & option) == option)
27
28#define set_option(mask, option, on) \
29 do { \
30 if (on) \
31 *mask |= option; \
32 else \
33 *mask &= ~option; \
34 } while (0)
35
36#define OPTION_ICASE 0x0001
37#define OPTION_FSYML 0x0002
38#define OPTION_RECSD 0x0004
39#define OPTION_VERBO 0x0008
40#define OPTION_OPMEM 0x0010
41#define OPTION_REGEX 0x0020
42#define OPTION_SIZED 0x0040
43#define OPTION_SHOW_HIDDEN 0x0080
44#define OPTION_PUZZL 0x0100
45#define OPTION_UNTAR 0x0200
46#define OPTION_DRY_RUN 0x0400
47#define OPTION_JSON 0x0800
48
49/* ANSI Color Codes */
50#define ANSI_COLOR_CYAN "\x1b[36m"
51#define ANSI_COLOR_BLUE "\x1b[34m"
52#define ANSI_COLOR_BOLD "\x1b[1m"
53#define ANSI_COLOR_RESET "\x1b[0m"
54
55/* Type Definitions */
56
57typedef struct ft_file_t
58{
59 apr_off_t size;
60 apr_time_t mtime;
61 char *path;
62 char *subpath;
63 PuzzleCvec cvec;
64 int cvec_ok:1;
65 int prioritized:1;
66} ft_file_t;
67
68typedef struct ft_chksum_t
69{
70 ft_hash_t hash_value;
71 ft_file_t *file;
72} ft_chksum_t;
73
74typedef struct ft_fsize_t
75{
76 apr_off_t val;
77 ft_chksum_t *chksum_array;
78 apr_uint32_t nb_files;
79 apr_uint32_t nb_checksumed;
80} ft_fsize_t;
81
82typedef struct ft_gid_t
83{
84 gid_t val;
85} ft_gid_t;
86
91typedef struct ft_conf_t ft_conf_t;
92
93struct stats
94{
95 struct stats const *parent;
96 apr_finfo_t stat;
97};
98
99/* Parallel hashing data structures */
100
104typedef struct hashing_task_t
105{
106 ft_fsize_t *fsize;
107 apr_uint32_t index;
109
114typedef struct hashing_context_t
115{
116 ft_conf_t *conf;
117 apr_thread_mutex_t *stats_mutex;
118 apr_pool_t *pool;
119
120 /* Statistics (protected by stats_mutex) */
121 apr_size_t files_processed;
122 apr_size_t total_files;
124
125#endif /* FT_TYPES_H */
Defines the core checksum type used throughout the application.
Interface for handling hierarchical ignore patterns, similar to .gitignore.
A high-performance hash table implementation built on APR.
A generic binary heap implementation (min-heap or max-heap).
The return value from 128-bit hashes.
Definition xxhash.h:1239
Main configuration structure for the ftwin application.
Definition ft_config.h:94
Shared context for parallel hashing operations.
Definition ft_types.h:115
Task structure passed to worker threads for hashing individual files.
Definition ft_types.h:105