2 Bacula® - The Network Backup Solution
4 Copyright (C) 2001-2010 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * File types as returned by find_files()
40 #include "../filed/fd_plugins.h"
44 #define NAMELEN(dirent) (strlen((dirent)->d_name))
48 #if !defined(HAVE_WIN32) || defined(HAVE_MINGW)
49 #include <sys/param.h>
60 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
62 #include "lib/fnmatch.h"
63 // #include "lib/enh_fnmatch.h"
66 #include "lib/bregex.h"
71 #ifndef HAVE_READDIR_R
72 int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
75 /* For options FO_xxx values see src/fileopts.h */
77 struct s_included_file {
78 struct s_included_file *next;
79 uint32_t options; /* backup options */
80 uint32_t algo; /* compression algorithm. 4 letters stored as an interger */
81 int level; /* compression level */
82 int len; /* length of fname */
83 int pattern; /* set if wild card pattern */
84 char VerifyOpts[20]; /* Options for verify */
88 struct s_excluded_file {
89 struct s_excluded_file *next;
94 /* FileSet definitions very similar to the resource
95 * contained in the Director because the components
96 * of the structure are passed by the Director to the
97 * File daemon and recompiled back into this structure
109 /* File options structure */
111 uint32_t flags; /* options in bits */
112 uint32_t Compress_algo; /* compression algorithm. 4 letters stored as an interger */
113 int Compress_level; /* compression level */
114 int strip_path; /* strip path count */
115 char VerifyOpts[MAX_FOPTS]; /* verify options */
116 char AccurateOpts[MAX_FOPTS]; /* accurate mode options */
117 char BaseJobOpts[MAX_FOPTS]; /* basejob mode options */
118 char *plugin; /* Plugin that handle this section */
119 alist regex; /* regex string(s) */
120 alist regexdir; /* regex string(s) for directories */
121 alist regexfile; /* regex string(s) for files */
122 alist wild; /* wild card strings */
123 alist wilddir; /* wild card strings for directories */
124 alist wildfile; /* wild card strings for files */
125 alist wildbase; /* wild card strings for basenames */
126 alist base; /* list of base names */
127 alist fstype; /* file system type limitation */
128 alist drivetype; /* drive type limitation */
132 /* This is either an include item or an exclude item */
134 findFOPTS *current_opts; /* points to current options structure */
135 alist opts_list; /* options list */
136 dlist name_list; /* filename list -- holds dlistString */
137 dlist plugin_list; /* plugin list -- holds dlistString */
138 char *ignoredir; /* ignore directories with this file */
147 findINCEXE *incexe; /* current item */
152 struct HFSPLUS_INFO {
153 unsigned long length; /* Mandatory field */
154 char fndrinfo[32]; /* Finder Info */
155 off_t rsrclength; /* Size of resource fork */
159 * Definition of the find_files packet passed as the
160 * first argument to the find_files callback subroutine.
163 char *top_fname; /* full filename before descending */
164 char *fname; /* full filename */
165 char *link; /* link if file linked */
166 char *object_name; /* Object name */
167 char *object; /* restore object */
168 char *plugin; /* Current Options{Plugin=} name */
169 POOLMEM *sys_fname; /* system filename */
170 POOLMEM *fname_save; /* save when stripping path */
171 POOLMEM *link_save; /* save when stripping path */
172 POOLMEM *ignoredir_fname; /* used to ignore directories */
173 char *digest; /* set to file digest when the file is a hardlink */
174 struct stat statp; /* stat packet */
175 uint32_t digest_len; /* set to the digest len when the file is a hardlink*/
176 int32_t digest_stream; /* set to digest type when the file is hardlink */
177 int32_t FileIndex; /* FileIndex of this file */
178 int32_t LinkFI; /* FileIndex of main hard linked file */
179 int32_t delta_seq; /* Delta Sequence number */
180 int32_t object_index; /* Object index */
181 int32_t object_len; /* Object length */
182 int32_t object_compression; /* Type of compression for object */
183 struct f_link *linked; /* Set if this file is hard linked */
184 int type; /* FT_ type from above */
185 int ff_errno; /* errno */
186 BFILE bfd; /* Bacula file descriptor */
187 time_t save_time; /* start of incremental time */
188 bool accurate_found; /* Found in the accurate hash (valid after check_changes()) */
189 bool dereference; /* follow links (not implemented) */
190 bool null_output_device; /* using null output device */
191 bool incremental; /* incremental save */
192 bool no_read; /* Do not read this file when using Plugin */
194 char AccurateOpts[20];
195 char BaseJobOpts[20];
196 struct s_included_file *included_files_list;
197 struct s_excluded_file *excluded_files_list;
198 struct s_excluded_file *excluded_paths_list;
199 findFILESET *fileset;
200 int (*file_save)(JCR *, FF_PKT *, bool); /* User's callback */
201 int (*plugin_save)(JCR *, FF_PKT *, bool); /* User's callback */
202 bool (*check_fct)(JCR *, FF_PKT *); /* optionnal user fct to check file changes */
204 /* Values set by accept_file while processing Options */
205 uint32_t flags; /* backup options */
206 uint32_t Compress_algo; /* compression algorithm. 4 letters stored as an interger */
207 int Compress_level; /* compression level */
208 int strip_path; /* strip path count */
209 bool cmd_plugin; /* set if we have a command plugin */
210 bool opt_plugin; /* set if we have an option plugin */
211 alist fstypes; /* allowed file system types */
212 alist drivetypes; /* allowed drive types */
214 /* List of all hard linked files found */
215 struct f_link **linkhash; /* hard linked files */
217 /* Darwin specific things.
218 * To avoid clutter, we always include rsrc_bfd and volhas_attrlist */
219 BFILE rsrc_bfd; /* fd for resource forks */
220 bool volhas_attrlist; /* Volume supports getattrlist() */
221 struct HFSPLUS_INFO hfsinfo; /* Finder Info and resource fork size */
227 #endif /* __FILES_H */