2 Bacula® - The Network Backup Solution
4 Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
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 two of the GNU General Public
10 License as published by the Free Software Foundation and included
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.
18 You should have received a copy of the GNU 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
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.
29 * Bacula File Daemon estimate.c
30 * Make and estimate of the number of files and size to be saved.
32 * Kern Sibbald, September MMI
41 static int tally_file(JCR *jcr, FF_PKT *ff_pkt, bool);
44 * Find all the requested files and count them.
46 int make_estimate(JCR *jcr)
50 set_jcr_job_status(jcr, JS_Running);
52 set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime);
53 stat = find_files(jcr, (FF_PKT *)jcr->ff, tally_file, NULL);
59 * Called here by find() for each file included.
62 static int tally_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
66 if (job_canceled(jcr)) {
69 switch (ff_pkt->type) {
70 case FT_LNKSAVED: /* Hard linked, file already saved */
96 if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode)) {
97 if (ff_pkt->statp.st_size > 0) {
98 jcr->JobBytes += ff_pkt->statp.st_size;
100 #ifdef HAVE_DARWIN_OS
101 if (ff_pkt->flags & FO_HFSPLUS) {
102 if (ff_pkt->hfsinfo.rsrclength > 0) {
103 jcr->JobBytes += ff_pkt->hfsinfo.rsrclength;
105 jcr->JobBytes += 32; /* Finder info */
109 jcr->num_files_examined++;
110 jcr->JobFiles++; /* increment number of files seen */
112 memcpy(&attr.statp, &ff_pkt->statp, sizeof(struct stat));
113 attr.type = ff_pkt->type;
114 attr.ofname = (POOLMEM *)ff_pkt->fname;
115 attr.olname = (POOLMEM *)ff_pkt->link;
116 print_ls_output(jcr, &attr);