2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many 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 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Bacula File Daemon estimate.c
21 * Make and estimate of the number of files and size to be saved.
23 * Kern Sibbald, September MMI
32 static int tally_file(JCR *jcr, FF_PKT *ff_pkt, bool);
35 * Find all the requested files and count them.
37 int make_estimate(JCR *jcr)
41 jcr->setJobStatus(JS_Running);
43 set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime);
44 /* in accurate mode, we overwrite the find_one check function */
46 set_find_changed_function((FF_PKT *)jcr->ff, accurate_check_file);
49 stat = find_files(jcr, (FF_PKT *)jcr->ff, tally_file, plugin_estimate);
55 * Called here by find() for each file included.
58 static int tally_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
62 if (job_canceled(jcr)) {
65 switch (ff_pkt->type) {
66 case FT_LNKSAVED: /* Hard linked, file already saved */
93 if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode)) {
94 if (ff_pkt->statp.st_size > 0) {
95 jcr->JobBytes += ff_pkt->statp.st_size;
98 if (ff_pkt->flags & FO_HFSPLUS) {
99 if (ff_pkt->hfsinfo.rsrclength > 0) {
100 jcr->JobBytes += ff_pkt->hfsinfo.rsrclength;
102 jcr->JobBytes += 32; /* Finder info */
106 jcr->num_files_examined++;
107 jcr->JobFiles++; /* increment number of files seen */
109 memcpy(&attr.statp, &ff_pkt->statp, sizeof(struct stat));
110 attr.type = ff_pkt->type;
111 attr.ofname = (POOLMEM *)ff_pkt->fname;
112 attr.olname = (POOLMEM *)ff_pkt->link;
113 print_ls_output(jcr, &attr);
115 /* TODO: Add loop over jcr->file_list to get Accurate deleted files*/