2 * File types as returned by find_files()
7 Copyright (C) 2001-2006 Kern Sibbald
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 version 2 as amended with additional clauses defined in the
12 file LICENSE in the main source directory.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 the file LICENSE for additional details.
29 #define NAMELEN(dirent) (strlen((dirent)->d_name))
42 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
44 #include "lib/fnmatch.h"
45 #include "lib/enh_fnmatch.h"
48 #include "lib/bregex.h"
55 #ifndef HAVE_READDIR_R
56 int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
61 * Status codes returned by create_file()
64 CF_SKIP = 1, /* skip file (not newer or something) */
65 CF_ERROR, /* error creating file */
66 CF_EXTRACT, /* file created, data to extract */
67 CF_CREATED /* file created, no data to extract */
71 /* Options saved int "options" of the include/exclude lists.
72 * They are directly jammed ito "flag" of ff packet
74 #define FO_MD5 (1<<1) /* Do MD5 checksum */
75 #define FO_GZIP (1<<2) /* Do Zlib compression */
76 #define FO_NO_RECURSION (1<<3) /* no recursion in directories */
77 #define FO_MULTIFS (1<<4) /* multiple file systems */
78 #define FO_SPARSE (1<<5) /* do sparse file checking */
79 #define FO_IF_NEWER (1<<6) /* replace if newer */
80 #define FO_NOREPLACE (1<<7) /* never replace */
81 #define FO_READFIFO (1<<8) /* read data from fifo */
82 #define FO_SHA1 (1<<9) /* Do SHA1 checksum */
83 #define FO_PORTABLE (1<<10) /* Use portable data format -- no BackupWrite */
84 #define FO_MTIMEONLY (1<<11) /* Use mtime rather than mtime & ctime */
85 #define FO_KEEPATIME (1<<12) /* Reset access time */
86 #define FO_EXCLUDE (1<<13) /* Exclude file */
87 #define FO_ACL (1<<14) /* Backup ACLs */
88 #define FO_NO_HARDLINK (1<<15) /* don't handle hard links */
89 #define FO_IGNORECASE (1<<16) /* Ignore file name case */
90 #define FO_HFSPLUS (1<<17) /* Resource forks and Finder Info */
91 #define FO_WIN32DECOMP (1<<18) /* Use BackupRead decomposition */
92 #define FO_SHA256 (1<<19) /* Do SHA256 checksum */
93 #define FO_SHA512 (1<<20) /* Do SHA512 checksum */
94 #define FO_ENCRYPT (1<<21) /* Encrypt data stream */
95 #define FO_NOATIME (1<<22) /* Use O_NOATIME to prevent atime change */
96 #define FO_ENHANCEDWILD (1<<23) /* Enhanced wild card processing */
98 struct s_included_file {
99 struct s_included_file *next;
100 uint32_t options; /* backup options */
101 int level; /* compression level */
102 int len; /* length of fname */
103 int pattern; /* set if wild card pattern */
104 char VerifyOpts[20]; /* Options for verify */
108 struct s_excluded_file {
109 struct s_excluded_file *next;
114 /* FileSet definitions very similar to the resource
115 * contained in the Director because the components
116 * of the structure are passed by the Director to the
117 * File daemon and recompiled back into this structure
129 /* File options structure */
131 uint32_t flags; /* options in bits */
132 int GZIP_level; /* GZIP level */
133 char VerifyOpts[MAX_FOPTS]; /* verify options */
134 alist regex; /* regex string(s) */
135 alist regexdir; /* regex string(s) for directories */
136 alist regexfile; /* regex string(s) for files */
137 alist wild; /* wild card strings */
138 alist wilddir; /* wild card strings for directories */
139 alist wildfile; /* wild card strings for files */
140 alist wildbase; /* wild card strings for basenames */
141 alist base; /* list of base names */
142 alist fstype; /* file system type limitation */
143 alist drivetype; /* drive type limitation */
144 char *reader; /* reader program */
145 char *writer; /* writer program */
149 /* This is either an include item or an exclude item */
151 findFOPTS *current_opts; /* points to current options structure */
152 alist opts_list; /* options list */
153 alist name_list; /* filename list -- holds char * */
162 findINCEXE *incexe; /* current item */
167 #ifdef HAVE_DARWIN_OS
168 struct HFSPLUS_INFO {
169 unsigned long length; /* Mandatory field */
170 char fndrinfo[32]; /* Finder Info */
171 off_t rsrclength; /* Size of resource fork */
176 * Definition of the find_files packet passed as the
177 * first argument to the find_files callback subroutine.
180 char *fname; /* full filename */
181 char *link; /* link if file linked */
182 POOLMEM *sys_fname; /* system filename */
183 struct stat statp; /* stat packet */
184 int32_t FileIndex; /* FileIndex of this file */
185 int32_t LinkFI; /* FileIndex of main hard linked file */
186 struct f_link *linked; /* Set if this file is hard linked */
187 int type; /* FT_ type from above */
188 int ff_errno; /* errno */
189 BFILE bfd; /* Bacula file descriptor */
190 time_t save_time; /* start of incremental time */
191 bool dereference; /* follow links (not implemented) */
192 bool null_output_device; /* using null output device */
193 bool incremental; /* incremental save */
195 struct s_included_file *included_files_list;
196 struct s_excluded_file *excluded_files_list;
197 struct s_excluded_file *excluded_paths_list;
198 findFILESET *fileset;
199 int (*callback)(FF_PKT *, void *, bool); /* User's callback */
201 /* Values set by accept_file while processing Options */
202 uint32_t flags; /* backup options */
203 int GZIP_level; /* compression level */
204 char *reader; /* reader program */
205 char *writer; /* writer program */
206 alist fstypes; /* allowed file system types */
207 alist drivetypes; /* allowed drive types */
209 /* List of all hard linked files found */
210 struct f_link **linkhash; /* hard linked files */
212 /* Darwin specific things.
213 * To avoid clutter, we always include rsrc_bfd and volhas_attrlist */
214 BFILE rsrc_bfd; /* fd for resource forks */
215 bool volhas_attrlist; /* Volume supports getattrlist() */
216 #ifdef HAVE_DARWIN_OS
217 struct HFSPLUS_INFO hfsinfo; /* Finder Info and resource fork size */
224 #endif /* __FILES_H */