]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/findlib/find.h
BFILE I/O, new console @ commands, regression, file mode restore fixes
[bacula/bacula] / bacula / src / findlib / find.h
1 /*
2  * File types as returned by find_files()
3  *
4  *     Kern Sibbald MIM
5  */
6 /*
7    Copyright (C) 2000-2003 Kern Sibbald and John Walker
8
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.
13
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.
18
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,
22    MA 02111-1307, USA.
23
24  */
25
26 #ifndef __FILES_H
27 #define __FILES_H
28
29 #include "jcr.h"
30
31 #ifdef HAVE_DIRENT_H
32 #include <dirent.h>
33 #define NAMELEN(dirent) (strlen((dirent)->d_name))
34 #endif
35 #include <sys/file.h>
36 #include <utime.h>
37
38 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
39
40 #ifdef HAVE_FNMATCH
41 #include <fnmatch.h>
42 #else
43 #include "lib/fnmatch.h"
44 #endif
45
46 #include "save-cwd.h"
47
48 /* 
49  * Status codes returned by create_file()
50  */
51 #define CF_SKIP       1               /* skip file (not newer or something) */
52 #define CF_ERROR      2               /* error creating file */
53 #define CF_EXTRACT    3               /* file created, data to extract */
54 #define CF_CREATED    4               /* file created, no data to extract */
55
56 /* 
57  *  NOTE!!! These go on the tape, so don't change them. If 
58  *  need be, add to them.
59  */
60 #define FT_LNKSAVED   1               /* hard link to file already saved */  
61 #define FT_REGE       2               /* Regular file but empty */
62 #define FT_REG        3               /* Regular file */
63 #define FT_LNK        4               /* Soft Link */
64 #define FT_DIR        5               /* Directory */
65 #define FT_SPEC       6               /* Special file -- chr, blk, fifo, sock */
66 #define FT_NOACCESS   7               /* Not able to access */
67 #define FT_NOFOLLOW   8               /* Could not follow link */
68 #define FT_NOSTAT     9               /* Could not stat file */
69 #define FT_NOCHG     10               /* Incremental option, file not changed */
70 #define FT_DIRNOCHG  11               /* Incremental option, directory not changed */
71 #define FT_ISARCH    12               /* Trying to save archive file */
72 #define FT_NORECURSE 13               /* No recursion into directory */
73 #define FT_NOFSCHG   14               /* Different file system, prohibited */
74 #define FT_NOOPEN    15               /* Could not open directory */
75 #define FT_RAW       16               /* Raw block device */
76 #define FT_FIFO      17               /* Raw fifo device */
77
78 /* Options saved in "flag" of ff packet */
79 #define FO_MD5          0x001         /* Do MD5 checksum */
80 #define FO_GZIP         0x002         /* Do Zlib compression */
81 #define FO_NO_RECURSION 0x004         /* no recursion in directories */
82 #define FO_MULTIFS      0x008         /* multiple file systems */
83 #define FO_SPARSE       0x010         /* do sparse file checking */
84 #define FO_IF_NEWER     0x020         /* replace if newer */
85 #define FO_NOREPLACE    0x040         /* never replace */
86 #define FO_READFIFO     0x080         /* read data from fifo */
87 #define FO_SHA1         0x100         /* Do SHA1 checksum */
88
89 /*
90  * Options saved in "options" of include list
91  * These are now directly jammed into ff->flags, so the above
92  *   FO_xxx options may be used
93  *
94  * ***FIXME*** replace all OPT_xxx with FO_xxx or vise-versa 
95  */
96 #define OPT_compute_MD5       0x01    /* compute MD5 of file's data */
97 #define OPT_GZIP_compression  0x02    /* use GZIP compression */
98 #define OPT_no_recursion      0x04    /* no recursion in directories */
99 #define OPT_multifs           0x08    /* multiple file systems */
100 #define OPT_sparse            0x10    /* do sparse file checking */
101 #define OPT_replace_if_newer  0x20    /* replace file if newer */
102 #define OPT_never_replace     0x40    /* never replace */
103 #define OPT_read_fifo         0x80    /* read data from fifo (named pipe) */
104 #define OPT_compute_SHA1     0x100    /* compute SHA1 of file's data */
105
106
107 struct s_included_file {
108    struct s_included_file *next;
109    int options;                       /* backup options */
110    int level;                         /* compression level */
111    int len;                           /* length of fname */
112    int pattern;                       /* set if pattern */
113    char VerifyOpts[20];               /* Options for verify */
114    char fname[1];
115 };
116
117 struct s_excluded_file {
118    struct s_excluded_file *next;
119    int len;
120    char fname[1];
121 };
122
123 typedef struct s_bfile {
124    int fid;                           /* file id on Unix */
125 } BFILE;
126
127
128 /*
129  * Definition of the find_files packet passed as the
130  * first argument to the find_files callback subroutine.
131  */
132 typedef struct s_ff {
133    char *fname;                       /* filename */
134    char *link;                        /* link if file linked */
135    POOLMEM *sys_fname;                /* system filename */
136    struct stat statp;                 /* stat packet */
137    uint32_t FileIndex;                /* FileIndex of this file */
138    uint32_t LinkFI;                   /* FileIndex of main hard linked file */
139    struct f_link *linked;             /* Set if we are hard linked */
140    int type;                          /* FT_ type from above */
141    int flags;                         /* control flags */
142    int ff_errno;                      /* errno */
143    int incremental;                   /* do incremental save */
144    BFILE bfd;                         /* Bacula file descriptor */
145    time_t save_time;                  /* start of incremental time */
146    int mtime_only;                    /* incremental on mtime_only */
147    int dereference;                   /* follow links */
148    int GZIP_level;                    /* compression level */
149    int atime_preserve;                /* preserve access times */
150    int null_output_device;            /* using null output device */
151    char VerifyOpts[20];
152    struct s_included_file *included_files_list;
153    struct s_excluded_file *excluded_files_list;
154    struct s_excluded_file *excluded_paths_list;
155
156    struct f_link *linklist;           /* hard linked files */
157 } FF_PKT;
158
159
160 #include "protos.h"
161
162 #endif /* __FILES_H */