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
9 Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of
14 the License, or (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public
22 License along with this program; if not, write to the Free
23 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
31 static int tally_file(FF_PKT *ff_pkt, void *pkt);
34 * Find all the requested files and count them.
36 int make_estimate(JCR *jcr)
40 jcr->JobStatus = JS_Running;
42 set_find_options(jcr->ff, jcr->incremental, jcr->mtime);
44 stat = find_files(jcr->ff, tally_file, (void *)jcr);
50 * Called here by find() for each file included.
52 * *****FIXME***** add FSMs File System Modules
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 */
81 if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode) &&
82 ff_pkt->statp.st_size > 0) {
83 jcr->JobBytes += ff_pkt->statp.st_size;
86 jcr->JobFiles++; /* increment number of files sent */