1 /*
2    Bacula® - The Network Backup Solution
3 
4    Copyright (C) 2001-2010 Free Software Foundation Europe e.V.
5 
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version three of the GNU Affero General Public
10    License as published by the Free Software Foundation and included
11    in the file LICENSE.
12 
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17 
18    You should have received a copy of the GNU Affero General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22 
23    Bacula® is a registered trademark of Kern Sibbald.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28 /*
29  * File types as returned by find_files()
30  *
31  *     Kern Sibbald MMI
32  */
33 /*
34  * This file contains fragments from bacula-5.0.3:src/findlib/find.h, hence
35  * retaining the copyright notice above. At some point, the fragments will be
36  * removed because the burp sbuf code will take over completely.
37  *     Graham Keeling, 2014
38  */
39 
40 #ifndef _FIND_H
41 #define _FIND_H
42 
43 #include <sys/file.h>
44 #include <sys/param.h>
45 
46 #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH)
47 
48 #ifdef HAVE_REGEX_H
49 #include <regex.h>
50 #endif
51 
52 #define FT_LNK_H	1  // hard link to file already saved.
53 #define FT_REG		3  // Regular file.
54 #define FT_LNK_S	4  // Soft Link.
55 #define FT_DIR		5  // Directory.
56 #define FT_SPEC		6  // Special file -- chr, blk, fifo, sock.
57 #define FT_NOFOLLOW	8  // Could not follow link.
58 #define FT_NOSTAT	9  // Could not stat file.
59 #define FT_NOFSCHG	14  // Different file system, prohibited.
60 #define FT_NOOPEN	15  // Could not open directory.
61 #define FT_RAW		16  // Raw block device.
62 #define FT_FIFO		17  // Raw fifo device.
63 #define FT_REPARSE	21  // Win NTFS reparse point.
64 #define FT_JUNCTION	26  // Win32 Junction point.
65 
66 /*
67  * Definition of the find_files packet passed as the
68  * first argument to the find_files callback subroutine.
69  */
70 struct FF_PKT
71 {
72 	char *fname;		/* full filename */
73 	long flen;		/* length of name component */
74 	char *link;		/* link if file linked */
75 	struct stat statp;	/* stat packet */
76 	uint64_t winattr;	/* windows attributes */
77 	int type;		/* FT_ type from above */
78 };
79 
80 struct asfd;
81 
82 extern struct FF_PKT *find_files_init(
83 	int callback(struct asfd *asfd, struct FF_PKT *ff, struct conf **confs));
84 extern void find_files_free(struct FF_PKT **ff);
85 extern int find_files_begin(struct asfd *asfd,
86 	struct FF_PKT *ff_pkt, struct conf **confs, char *fname);
87 // Returns the level of compression.
88 extern int in_exclude_comp(struct strlist *excom, const char *fname,
89 	int compression);
90 
91 #ifdef UTEST
92 extern int file_is_included_no_incext(struct conf **confs, const char *fname);
93 #endif
94 
95 
96 #endif
97