2 * File types as returned by find_files()
7 Copyright (C) 2000-2003 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,
33 #define NAMELEN(dirent) (strlen((dirent)->d_name))
46 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
51 #include "lib/fnmatch.h"
56 #ifndef HAVE_READDIR_R
57 int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
62 * Status codes returned by create_file()
64 #define CF_SKIP 1 /* skip file (not newer or something) */
65 #define CF_ERROR 2 /* error creating file */
66 #define CF_EXTRACT 3 /* file created, data to extract */
67 #define CF_CREATED 4 /* file created, no data to extract */
70 * NOTE!!! These go on the tape, so don't change them. If
71 * need be, add to them.
73 #define FT_LNKSAVED 1 /* hard link to file already saved */
74 #define FT_REGE 2 /* Regular file but empty */
75 #define FT_REG 3 /* Regular file */
76 #define FT_LNK 4 /* Soft Link */
77 #define FT_DIR 5 /* Directory */
78 #define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
79 #define FT_NOACCESS 7 /* Not able to access */
80 #define FT_NOFOLLOW 8 /* Could not follow link */
81 #define FT_NOSTAT 9 /* Could not stat file */
82 #define FT_NOCHG 10 /* Incremental option, file not changed */
83 #define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
84 #define FT_ISARCH 12 /* Trying to save archive file */
85 #define FT_NORECURSE 13 /* No recursion into directory */
86 #define FT_NOFSCHG 14 /* Different file system, prohibited */
87 #define FT_NOOPEN 15 /* Could not open directory */
88 #define FT_RAW 16 /* Raw block device */
89 #define FT_FIFO 17 /* Raw fifo device */
91 /* Options saved in "flag" of ff packet */
92 #define FO_MD5 0x001 /* Do MD5 checksum */
93 #define FO_GZIP 0x002 /* Do Zlib compression */
94 #define FO_NO_RECURSION 0x004 /* no recursion in directories */
95 #define FO_MULTIFS 0x008 /* multiple file systems */
96 #define FO_SPARSE 0x010 /* do sparse file checking */
97 #define FO_IF_NEWER 0x020 /* replace if newer */
98 #define FO_NOREPLACE 0x040 /* never replace */
99 #define FO_READFIFO 0x080 /* read data from fifo */
100 #define FO_SHA1 0x100 /* Do SHA1 checksum */
103 * Options saved in "options" of include list
104 * These are now directly jammed into ff->flags, so the above
105 * FO_xxx options may be used
107 * ***FIXME*** replace all OPT_xxx with FO_xxx or vise-versa
109 #define OPT_compute_MD5 0x01 /* compute MD5 of file's data */
110 #define OPT_GZIP_compression 0x02 /* use GZIP compression */
111 #define OPT_no_recursion 0x04 /* no recursion in directories */
112 #define OPT_multifs 0x08 /* multiple file systems */
113 #define OPT_sparse 0x10 /* do sparse file checking */
114 #define OPT_replace_if_newer 0x20 /* replace file if newer */
115 #define OPT_never_replace 0x40 /* never replace */
116 #define OPT_read_fifo 0x80 /* read data from fifo (named pipe) */
117 #define OPT_compute_SHA1 0x100 /* compute SHA1 of file's data */
120 struct s_included_file {
121 struct s_included_file *next;
122 int options; /* backup options */
123 int level; /* compression level */
124 int len; /* length of fname */
125 int pattern; /* set if pattern */
126 char VerifyOpts[20]; /* Options for verify */
130 struct s_excluded_file {
131 struct s_excluded_file *next;
142 #define BF_READ 1 /* BackupRead */
143 #define BF_WRITE 2 /* BackupWrite */
145 /* Basic low level I/O file packet */
146 typedef struct s_bfile {
147 int use_win_api; /* set if using WinAPI */
148 int mode; /* set if file is open */
149 HANDLE fh; /* Win32 file handle */
150 int fid; /* fd if doing Unix style */
151 LPVOID lpContext; /* BackupRead/Write context */
152 POOLMEM *errmsg; /* error message buffer */
153 DWORD rw_bytes; /* Bytes read or written */
154 DWORD lerror; /* Last error code */
159 /* Basic low level I/O file packet */
160 typedef struct s_bfile {
161 int fid; /* file id on Unix */
168 * Definition of the find_files packet passed as the
169 * first argument to the find_files callback subroutine.
171 typedef struct s_ff {
172 char *fname; /* filename */
173 char *link; /* link if file linked */
174 POOLMEM *sys_fname; /* system filename */
175 struct stat statp; /* stat packet */
176 uint32_t FileIndex; /* FileIndex of this file */
177 uint32_t LinkFI; /* FileIndex of main hard linked file */
178 struct f_link *linked; /* Set if we are hard linked */
179 int type; /* FT_ type from above */
180 int flags; /* control flags */
181 int ff_errno; /* errno */
182 int incremental; /* do incremental save */
183 BFILE bfd; /* Bacula file descriptor */
184 time_t save_time; /* start of incremental time */
185 int mtime_only; /* incremental on mtime_only */
186 int dereference; /* follow links */
187 int GZIP_level; /* compression level */
188 int atime_preserve; /* preserve access times */
189 int null_output_device; /* using null output device */
191 struct s_included_file *included_files_list;
192 struct s_excluded_file *excluded_files_list;
193 struct s_excluded_file *excluded_paths_list;
195 struct f_link *linklist; /* hard linked files */
201 #endif /* __FILES_H */