2 * Bacula File Daemon estimate.c
3 * Make and estimate of the number of files and size to be saved.
5 * Kern Sibbald, September MMI
11 Copyright (C) 2000-2003 Kern Sibbald and John Walker
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of
16 the License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write to the Free
25 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
33 static int tally_file(FF_PKT *ff_pkt, void *pkt);
36 * Find all the requested files and count them.
38 int make_estimate(JCR *jcr)
42 jcr->JobStatus = JS_Running;
44 set_find_options(jcr->ff, jcr->incremental, jcr->mtime);
46 stat = find_files(jcr->ff, tally_file, (void *)jcr);
52 * Called here by find() for each file included.
55 static int tally_file(FF_PKT *ff_pkt, void *ijcr)
57 JCR *jcr = (JCR *) ijcr;
59 switch (ff_pkt->type) {
60 case FT_LNKSAVED: /* Hard linked, file already saved */
83 if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode) &&
84 ff_pkt->statp.st_size > 0) {
85 jcr->JobBytes += ff_pkt->statp.st_size;
88 jcr->JobFiles++; /* increment number of files sent */