X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fbcopy.c;h=fbb35120e5ca5ce803ce88a5feba8bf3d2726ba1;hb=36b40d5c7f3ff90565ab73ac75f0dc4f6660ff37;hp=2397838333c19b2ad4edfe52e1a6f8c5f5f2bdd7;hpb=b29a4a5430344451e18d4f9c741062c26d8357f2;p=bacula%2Fbacula diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index 2397838333..fbb35120e5 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2007 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Bacula® is a registered trademark of John Walker. + Bacula® is a registered trademark of Kern Sibbald. The licensor of Bacula is the Free Software Foundation Europe (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. @@ -40,6 +40,7 @@ /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } +extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code); /* Forward referenced functions */ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sessrec); @@ -59,6 +60,7 @@ static uint32_t jobs = 0; static DEV_BLOCK *out_block; static SESSION_LABEL sessrec; +static CONFIG *config; #define CONFIG_FILE "bacula-sd.conf" char *configfile = NULL; STORES *me = NULL; /* our Global resource */ @@ -74,7 +76,7 @@ PROG_COPYRIGHT "\nVersion: %s (%s)\n\n" "Usage: bcopy [-d debug_level] \n" " -b bootstrap specify a bootstrap file\n" -" -c specify configuration file\n" +" -c specify a Storage configuration file\n" " -d set debug level to \n" " -dt print timestamp in debug output\n" " -i specify input Volume names (separated by |)\n" @@ -169,7 +171,8 @@ int main (int argc, char *argv[]) configfile = bstrdup(CONFIG_FILE); } - parse_config(configfile); + config = new_config_parser(); + parse_sd_config(config, configfile, M_ERROR_TERM); /* Setup and acquire input device for reading */ Dmsg0(100, "About to setup input jcr\n"); @@ -255,9 +258,20 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec) Pmsg0(000, _("Volume label not copied.\n")); return true; case SOS_LABEL: - jobs++; + if (bsr && rec->match_stat < 1) { + /* Skipping record, because does not match BSR filter */ + if (verbose) { + Pmsg0(-1, _("Copy skipped. Record does not match BSR filter.\n")); + } + } else { + jobs++; + } break; case EOS_LABEL: + if (bsr && rec->match_stat < 1) { + /* Skipping record, because does not match BSR filter */ + return true; + } while (!write_record_to_block(out_block, rec)) { Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len, rec->remainder); @@ -289,6 +303,10 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec) } /* Write record */ + if (bsr && rec->match_stat < 1) { + /* Skipping record, because does not match BSR filter */ + return true; + } records++; while (!write_record_to_block(out_block, rec)) { Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len, @@ -350,7 +368,7 @@ bool dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;} bool dir_send_job_status(JCR *jcr) {return 1;} -bool dir_ask_sysop_to_mount_volume(DCR *dcr) +bool dir_ask_sysop_to_mount_volume(DCR *dcr, int /*mode*/) { DEVICE *dev = dcr->dev; fprintf(stderr, _("Mount Volume \"%s\" on device %s and press return when ready: "),