2 * File types as returned by find_files()
7 Copyright (C) 2000-2004 Kern Sibbald and John Walker
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of
12 the License, or (at your option) any later version.
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 GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public
20 License along with this program; if not, write to the Free
21 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
34 #define NAMELEN(dirent) (strlen((dirent)->d_name))
47 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
52 #include "lib/fnmatch.h"
61 #ifndef HAVE_READDIR_R
62 int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
67 * Status codes returned by create_file()
70 CF_SKIP = 1, /* skip file (not newer or something) */
71 CF_ERROR, /* error creating file */
72 CF_EXTRACT, /* file created, data to extract */
73 CF_CREATED /* file created, no data to extract */
77 /* Options saved int "options" of the include/exclude lists.
78 * They are directly jammed ito "flag" of ff packet
80 #define FO_MD5 (1<<1) /* Do MD5 checksum */
81 #define FO_GZIP (1<<2) /* Do Zlib compression */
82 #define FO_NO_RECURSION (1<<3) /* no recursion in directories */
83 #define FO_MULTIFS (1<<4) /* multiple file systems */
84 #define FO_SPARSE (1<<5) /* do sparse file checking */
85 #define FO_IF_NEWER (1<<6) /* replace if newer */
86 #define FO_NOREPLACE (1<<7) /* never replace */
87 #define FO_READFIFO (1<<8) /* read data from fifo */
88 #define FO_SHA1 (1<<9) /* Do SHA1 checksum */
89 #define FO_PORTABLE (1<<10) /* Use portable data format -- no BackupWrite */
90 #define FO_MTIMEONLY (1<<11) /* Use mtime rather than mtime & ctime */
91 #define FO_KEEPATIME (1<<12) /* Reset access time */
92 #define FO_EXCLUDE (1<<13) /* Exclude file */
93 #define FO_ACL (1<<14) /* Backup ACLs */
94 #define FO_NO_HARDLINK (1<<15) /* don't handle hard links */
95 #define FO_IGNORECASE (1<<16) /* Ignore file name case */
96 #define FO_HFSPLUS (1<<17) /* Resource forks and Finder Info */
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 wild; /* wild card strings */
136 alist base; /* list of base names */
137 alist fstype; /* file system type limitation */
138 char *reader; /* reader program */
139 char *writer; /* writer program */
143 /* This is either an include item or an exclude item */
145 findFOPTS *current_opts; /* points to current options structure */
146 alist opts_list; /* options list */
147 alist name_list; /* filename list -- holds char * */
156 findINCEXE *incexe; /* current item */
161 #ifdef HAVE_DARWIN_OS
162 struct HFSPLUS_INFO {
163 unsigned long length; /* Mandatory field */
164 char fndrinfo[32]; /* Finder Info */
165 off_t rsrclength; /* Size of resource fork */
170 * Definition of the find_files packet passed as the
171 * first argument to the find_files callback subroutine.
174 char *fname; /* filename */
175 char *link; /* link if file linked */
176 POOLMEM *sys_fname; /* system filename */
177 struct stat statp; /* stat packet */
178 int32_t FileIndex; /* FileIndex of this file */
179 int32_t LinkFI; /* FileIndex of main hard linked file */
180 struct f_link *linked; /* Set if this file is hard linked */
181 int type; /* FT_ type from above */
182 int ff_errno; /* errno */
183 BFILE bfd; /* Bacula file descriptor */
184 time_t save_time; /* start of incremental time */
185 bool dereference; /* follow links (not implemented) */
186 bool null_output_device; /* using null output device */
187 bool incremental; /* incremental save */
189 struct s_included_file *included_files_list;
190 struct s_excluded_file *excluded_files_list;
191 struct s_excluded_file *excluded_paths_list;
192 findFILESET *fileset;
193 int (*callback)(FF_PKT *, void *); /* User's callback */
195 /* Values set by accept_file while processing Options */
196 uint32_t flags; /* backup options */
197 int GZIP_level; /* compression level */
198 char *reader; /* reader program */
199 char *writer; /* writer program */
200 alist *fstypes; /* allowed file system types */
202 /* List of all hard linked files found */
203 struct f_link *linklist; /* hard linked files */
205 /* Darwin specific things. So as not to clutter every bclose()
206 * with an #ifdef, we always include rsrc_bfd */
207 BFILE rsrc_bfd; /* fd for resource forks */
208 #ifdef HAVE_DARWIN_OS
209 struct HFSPLUS_INFO hfsinfo; /* Finder Info and resource fork size */
216 #endif /* __FILES_H */