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"
57 #ifndef HAVE_READDIR_R
58 int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
63 * Status codes returned by create_file()
66 CF_SKIP = 1, /* skip file (not newer or something) */
67 CF_ERROR, /* error creating file */
68 CF_EXTRACT, /* file created, data to extract */
69 CF_CREATED /* file created, no data to extract */
73 /* Options saved int "options" of the include/exclude lists.
74 * They are directly jammed ito "flag" of ff packet
76 #define FO_MD5 (1<<1) /* Do MD5 checksum */
77 #define FO_GZIP (1<<2) /* Do Zlib compression */
78 #define FO_NO_RECURSION (1<<3) /* no recursion in directories */
79 #define FO_MULTIFS (1<<4) /* multiple file systems */
80 #define FO_SPARSE (1<<5) /* do sparse file checking */
81 #define FO_IF_NEWER (1<<6) /* replace if newer */
82 #define FO_NOREPLACE (1<<7) /* never replace */
83 #define FO_READFIFO (1<<8) /* read data from fifo */
84 #define FO_SHA1 (1<<9) /* Do SHA1 checksum */
85 #define FO_PORTABLE (1<<10) /* Use portable data format -- no BackupWrite */
86 #define FO_MTIMEONLY (1<<11) /* Use mtime rather than mtime & ctime */
87 #define FO_KEEPATIME (1<<12) /* Reset access time */
88 #define FO_EXCLUDE (1<<13) /* Exclude file */
90 struct s_included_file {
91 struct s_included_file *next;
92 uint32_t options; /* backup options */
93 int level; /* compression level */
94 int len; /* length of fname */
95 int pattern; /* set if wild card pattern */
96 char VerifyOpts[20]; /* Options for verify */
100 struct s_excluded_file {
101 struct s_excluded_file *next;
106 /* FileSet definitions very similar to the resource
107 * contained in the Director because the components
108 * of the structure are passed by the Director to the
109 * File daemon and recompiled back into this structure
121 /* File options structure */
123 char opts[MAX_FOPTS]; /* options string */
124 uint32_t flags; /* options in bits */
125 int GZIP_level; /* GZIP level */
126 char VerifyOpts[MAX_FOPTS]; /* verify options */
127 alist regex; /* regex string(s) */
128 alist wild; /* wild card strings */
129 alist base; /* list of base names */
133 /* This is either an include item or an exclude item */
135 findFOPTS *current_opts; /* points to current options structure */
136 alist opts_list; /* options list */
137 alist name_list; /* filename list -- holds char * */
146 findINCEXE *incexe; /* current item */
153 * Definition of the find_files packet passed as the
154 * first argument to the find_files callback subroutine.
157 char *fname; /* filename */
158 char *link; /* link if file linked */
159 POOLMEM *sys_fname; /* system filename */
160 struct stat statp; /* stat packet */
161 int32_t FileIndex; /* FileIndex of this file */
162 int32_t LinkFI; /* FileIndex of main hard linked file */
163 struct f_link *linked; /* Set if this file is hard linked */
164 int type; /* FT_ type from above */
165 uint32_t flags; /* backup options */
166 int ff_errno; /* errno */
167 BFILE bfd; /* Bacula file descriptor */
168 time_t save_time; /* start of incremental time */
169 bool dereference; /* follow links (not implemented) */
170 bool null_output_device; /* using null output device */
171 bool incremental; /* incremental save */
172 int GZIP_level; /* compression level */
174 struct s_included_file *included_files_list;
175 struct s_excluded_file *excluded_files_list;
176 struct s_excluded_file *excluded_paths_list;
177 findFILESET *fileset;
178 int (*callback)(FF_PKT *, void *); /* User's callback */
180 /* List of all hard linked files found */
181 struct f_link *linklist; /* hard linked files */
187 #endif /* __FILES_H */