2 Bacula® - The Network Backup Solution
4 Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 Bacula® is a registered trademark of Kern Sibbald.
17 * Bacula File Daemon estimate.c
18 * Make and estimate of the number of files and size to be saved.
20 * Kern Sibbald, September MMI
29 static int tally_file(JCR *jcr, FF_PKT *ff_pkt, bool);
32 * Find all the requested files and count them.
34 int make_estimate(JCR *jcr)
38 jcr->setJobStatus(JS_Running);
40 set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime);
41 /* in accurate mode, we overwrite the find_one check function */
43 set_find_changed_function((FF_PKT *)jcr->ff, accurate_check_file);
46 stat = find_files(jcr, (FF_PKT *)jcr->ff, tally_file, plugin_estimate);
52 * Called here by find() for each file included.
55 static int tally_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
59 if (job_canceled(jcr)) {
62 switch (ff_pkt->type) {
63 case FT_LNKSAVED: /* Hard linked, file already saved */
90 if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode)) {
91 if (ff_pkt->statp.st_size > 0) {
92 jcr->JobBytes += ff_pkt->statp.st_size;
95 if (ff_pkt->flags & FO_HFSPLUS) {
96 if (ff_pkt->hfsinfo.rsrclength > 0) {
97 jcr->JobBytes += ff_pkt->hfsinfo.rsrclength;
99 jcr->JobBytes += 32; /* Finder info */
103 jcr->num_files_examined++;
104 jcr->JobFiles++; /* increment number of files seen */
106 memcpy(&attr.statp, &ff_pkt->statp, sizeof(struct stat));
107 attr.type = ff_pkt->type;
108 attr.ofname = (POOLMEM *)ff_pkt->fname;
109 attr.olname = (POOLMEM *)ff_pkt->link;
110 print_ls_output(jcr, &attr);
112 /* TODO: Add loop over jcr->file_list to get Accurate deleted files*/