]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/findlib/find.h
c25fafa692d34eff237622919fa1858fae4da0c4
[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 #include "bfile.h"
31
32 #ifdef HAVE_DIRENT_H
33 #include <dirent.h>
34 #define NAMELEN(dirent) (strlen((dirent)->d_name))
35 #endif
36
37 #include <sys/file.h>
38 #if HAVE_UTIME_H
39 #include <utime.h>
40 #else
41 struct utimbuf {
42     long actime;
43     long modtime;
44 };
45 #endif
46
47 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
48
49 #ifdef HAVE_FNMATCH
50 #include <fnmatch.h>
51 #else
52 #include "lib/fnmatch.h"
53 #endif
54
55 #include "save-cwd.h"
56
57 #ifndef HAVE_READDIR_R
58 int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
59 #endif
60
61
62 /* 
63  * Status codes returned by create_file()
64  */
65 enum {
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 */
70 };
71
72
73 /* Options saved in "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
84 /*
85  * Options saved in "options" of include list
86  * These are now directly jammed into ff->flags, so the above
87  *   FO_xxx options may be used
88  *
89  * ***FIXME*** replace all OPT_xxx with FO_xxx or vise-versa 
90  */
91 #define OPT_compute_MD5      FO_MD5           /* compute MD5 of file's data */
92 #define OPT_GZIP_compression FO_GZIP          /* use GZIP compression */
93 #define OPT_no_recursion     FO_NO_RECURSION  /* no recursion in directories */
94 #define OPT_multifs          FO_MULTIFS       /* multiple file systems */
95 #define OPT_sparse           FO_SPARSE        /* do sparse file checking */
96 #define OPT_replace_if_newer FO_IF_NEWER      /* replace file if newer */
97 #define OPT_never_replace    FO_NOREPLACE     /* never replace */
98 #define OPT_read_fifo        FO_READFIFO      /* read data from fifo (named pipe) */
99 #define OPT_compute_SHA1     FO_SHA1          /* compute SHA1 of file's data */
100
101
102 struct s_included_file {
103    struct s_included_file *next;
104    int options;                       /* backup options */
105    int level;                         /* compression level */
106    int len;                           /* length of fname */
107    int pattern;                       /* set if pattern */
108    char VerifyOpts[20];               /* Options for verify */
109    char fname[1];
110 };
111
112 struct s_excluded_file {
113    struct s_excluded_file *next;
114    int len;
115    char fname[1];
116 };
117
118
119
120 /*
121  * Definition of the find_files packet passed as the
122  * first argument to the find_files callback subroutine.
123  */
124 typedef struct s_ff {
125    char *fname;                       /* filename */
126    char *link;                        /* link if file linked */
127    POOLMEM *sys_fname;                /* system filename */
128    struct stat statp;                 /* stat packet */
129    uint32_t FileIndex;                /* FileIndex of this file */
130    uint32_t LinkFI;                   /* FileIndex of main hard linked file */
131    struct f_link *linked;             /* Set if we are hard linked */
132    int type;                          /* FT_ type from above */
133    int flags;                         /* control flags */
134    int ff_errno;                      /* errno */
135    int incremental;                   /* do incremental save */
136    BFILE bfd;                         /* Bacula file descriptor */
137    time_t save_time;                  /* start of incremental time */
138    int mtime_only;                    /* incremental on mtime_only */
139    int dereference;                   /* follow links */
140    int GZIP_level;                    /* compression level */
141    int atime_preserve;                /* preserve access times */
142    int null_output_device;            /* using null output device */
143    char VerifyOpts[20];
144    struct s_included_file *included_files_list;
145    struct s_excluded_file *excluded_files_list;
146    struct s_excluded_file *excluded_paths_list;
147
148    struct f_link *linklist;           /* hard linked files */
149 } FF_PKT;
150
151
152 #include "protos.h"
153
154 #endif /* __FILES_H */