]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/job.c
ebl Modify disk-changer to check if slot contains something before
[bacula/bacula] / bacula / src / filed / job.c
index 23921df0c86f3093efddedf71af28554352ba402..6c45c3bb9ad488f1881712b04c190f14b9526d65 100644 (file)
@@ -49,6 +49,7 @@ extern CLIENT *me;                    /* our client resource */
 /* Imported functions */
 extern int status_cmd(JCR *jcr);
 extern int qstatus_cmd(JCR *jcr);
+extern int accurate_cmd(JCR *jcr);
 
 /* Forward referenced functions */
 static int backup_cmd(JCR *jcr);
@@ -106,6 +107,7 @@ static struct s_cmds cmds[] = {
    {"RunBeforeJob", runbefore_cmd, 0},
    {"RunAfterJob",  runafter_cmd,  0},
    {"Run",          runscript_cmd, 0},
+   {"accurate",     accurate_cmd, 0},
    {NULL,       NULL}                  /* list terminator */
 };
 
@@ -303,6 +305,12 @@ void *handle_client_request(void *dirp)
             for (k=0; k<fo->regex.size(); k++) {
                regfree((regex_t *)fo->regex.get(k));
             }
+            for (k=0; k<fo->regexdir.size(); k++) {
+               regfree((regex_t *)fo->regexdir.get(k));
+            }
+            for (k=0; k<fo->regexfile.size(); k++) {
+               regfree((regex_t *)fo->regexfile.get(k));
+            }
             fo->regex.destroy();
             fo->regexdir.destroy();
             fo->regexfile.destroy();
@@ -313,6 +321,9 @@ void *handle_client_request(void *dirp)
             fo->base.destroy();
             fo->fstype.destroy();
             fo->drivetype.destroy();
+            if (fo->ignoredir != NULL) {
+               free(fo->ignoredir);
+            }
          }
          incexe->opts_list.destroy();
          incexe->name_list.destroy();
@@ -672,7 +683,7 @@ static void add_file_to_fileset(JCR *jcr, const char *fname, findFILESET *filese
       }
       break;
    case '<':
-      Dmsg0(100, "Doing < include on client.\n");
+      Dmsg1(100, "Doing < of '%s' include on client.\n", p + 1);
       p++;                      /* skip over < */
       if ((ffd = fopen(p, "rb")) == NULL) {
          berrno be;
@@ -838,6 +849,11 @@ static void add_fileset(JCR *jcr, const char *item)
       set_options(current_opts, item);
       state = state_options;
       break;
+   case 'Z':
+      current_opts = start_options(ff);
+      current_opts->ignoredir = bstrdup(item);
+      state = state_options;
+      break;
    case 'D':
       current_opts = start_options(ff);
 //    current_opts->reader = bstrdup(item);
@@ -899,6 +915,9 @@ static bool term_fileset(JCR *jcr)
          for (k=0; k<fo->drivetype.size(); k++) {
             Dmsg1(400, "XD %s\n", (char *)fo->drivetype.get(k));
          }
+         if (fo->ignoredir) {
+            Dmsg1(400, "Z %s\n", fo->ignoredir);
+         }
       }
       dlistString *node;
       foreach_dlist(node, &incexe->name_list) {
@@ -1057,6 +1076,16 @@ static void set_options(findFOPTS *fo, const char *opts)
          }
          fo->VerifyOpts[j] = 0;
          break;
+      case 'C':                  /* accurate options */
+         /* Copy Accurate Options */
+         for (j=0; *p && *p != ':'; p++) {
+            fo->AccurateOpts[j] = *p;
+            if (j < (int)sizeof(fo->AccurateOpts) - 1) {
+               j++;
+            }
+         }
+         fo->AccurateOpts[j] = 0;
+         break;
       case 'P':                  /* strip path */
          /* Get integer */
          p++;                    /* skip P */
@@ -1087,6 +1116,9 @@ static void set_options(findFOPTS *fo, const char *opts)
       case 'c':
          fo->flags |= FO_CHKCHANGES;
          break;
+      case 'N':
+         fo->flags |= FO_HONOR_NODUMP;
+         break;
       default:
          Emsg1(M_ERROR, 0, _("Unknown include/exclude option: %c\n"), *p);
          break;
@@ -1195,6 +1227,9 @@ static int level_cmd(JCR *jcr)
 
    level = get_memory(dir->msglen+1);
    Dmsg1(110, "level_cmd: %s", dir->msg);
+   if (strstr(dir->msg, "accurate")) {
+      jcr->accurate = true;
+   }
    if (sscanf(dir->msg, "level = %s ", level) != 1) {
       goto bail_out;
    }
@@ -1204,14 +1239,14 @@ static int level_cmd(JCR *jcr)
    /* Full backup requested? */
    } else if (strcmp(level, "full") == 0) {
       jcr->JobLevel = L_FULL;
-   } else if (strcmp(level, "differential") == 0) {
+   } else if (strstr(level, "differential")) {
       jcr->JobLevel = L_DIFFERENTIAL;
       free_memory(level);
       return 1;
-   } else if (strcmp(level, "incremental") == 0) {
+   } else if (strstr(level, "incremental")) {
       jcr->JobLevel = L_INCREMENTAL;
       free_memory(level);
-      return 1;   
+      return 1;
    /*
     * We get his UTC since time, then sync the clocks and correct it
     *   to agree with our clock.
@@ -1465,6 +1500,7 @@ static int backup_cmd(JCR *jcr)
          berrno be;
          Jmsg(jcr, M_WARNING, 0, _("VSS was not initialized properly. VSS support is disabled. ERR=%s\n"), be.bstrerror());
       } 
+      run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS");
    }
 #endif