]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/bcopy.c
kes Define a machine dependent ioctl request type for use with
[bacula/bacula] / bacula / src / stored / bcopy.c
index e99662477a21c5150850a74a87e6d1588b0cca52..fbb35120e5ca5ce803ce88a5feba8bf3d2726ba1 100644 (file)
@@ -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] <input-archive> <output-archive>\n"
 "       -b bootstrap      specify a bootstrap file\n"
-"       -c <file>         specify configuration file\n"
+"       -c <file>         specify a Storage configuration file\n"
 "       -d <nn>           set debug level to <nn>\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,