]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/job.c
update configure
[bacula/bacula] / bacula / src / filed / job.c
index 86641b0a7152e8f50c2719759eb8eda91370c28b..417a3931de57c7114bd1a41137c190e6412ee84f 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "bacula.h"
 #include "filed.h"
+#include "ch.h"
 
 #if defined(WIN32_VSS)
 #include "vss.h"
@@ -401,7 +402,7 @@ void *handle_client_request(void *dirp)
    Dmsg0(100, "Done with term_find_files\n");
    free_jcr(jcr);                     /* destroy JCR record */
    Dmsg0(100, "Done with free_jcr\n");
-   Dsm_check(1);
+   Dsm_check(100);
    garbage_collect_memory_pool();
    return NULL;
 }
@@ -453,7 +454,7 @@ static int cancel_cmd(JCR *jcr)
          dir->fsend(_("2901 Job %s not found.\n"), Job);
       } else {
          generate_plugin_event(cjcr, bEventCancelCommand, NULL);
-         set_jcr_job_status(cjcr, JS_Canceled);
+         cjcr->setJobStatus(JS_Canceled);
          if (cjcr->store_bsock) {
             cjcr->store_bsock->set_timed_out();
             cjcr->store_bsock->set_terminated();
@@ -469,7 +470,6 @@ static int cancel_cmd(JCR *jcr)
    return 1;
 }
 
-
 /**
  * Set debug level as requested by the Director
  *
@@ -543,7 +543,11 @@ static int job_cmd(JCR *jcr)
    Mmsg(jcr->errmsg, "JobId=%d Job=%s", jcr->JobId, jcr->Job);
    new_plugins(jcr);                  /* instantiate plugins for this jcr */
    generate_plugin_event(jcr, bEventJobStart, (void *)jcr->errmsg);
+#ifdef HAVE_WIN32
+   return dir->fsend(OKjob, VERSION, LSMDATE, win_os, DISTNAME, DISTVER);
+#else
    return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER);
+#endif
 }
 
 static int runbefore_cmd(JCR *jcr)
@@ -1229,7 +1233,7 @@ static bool term_fileset(JCR *jcr)
          }
       }
       dlistString *node;
-      foreach_dlist(node, incexe->name_list) {
+      foreach_dlist(node, &incexe->name_list) {
          Dmsg1(400, "F %s\n", node->c_str());
       }
       foreach_dlist(node, &incexe->plugin_list) {
@@ -1382,9 +1386,18 @@ static int set_options(findFOPTS *fo, const char *opts)
       case 'W':
          fo->flags |= FO_ENHANCEDWILD;
          break;
-      case 'Z':                 /* gzip compression */
-         fo->flags |= FO_GZIP;
-         fo->GZIP_level = *++p - '0';
+      case 'Z':                 /* compression */
+         p++;                   /* skip Z */
+         if (*p >= '0' && *p <= '9') {
+            fo->flags |= FO_COMPRESS;
+            fo->Compress_algo = COMPRESS_GZIP;
+            fo->Compress_level = *p - '0';
+         }
+         else if (*p == 'o') {
+            fo->flags |= FO_COMPRESS;
+            fo->Compress_algo = COMPRESS_LZO1X;
+            fo->Compress_level = 1; /* not used with LZO */
+         }
          break;
       case 'K':
          fo->flags |= FO_NOATIME;
@@ -1483,7 +1496,7 @@ static int bootstrap_cmd(JCR *jcr)
       while (dir->recv() >= 0)
         {  }
       free_bootstrap(jcr);
-      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      jcr->setJobStatus(JS_ErrorTerminated);
       return 0;
    }
 
@@ -1517,24 +1530,24 @@ static int level_cmd(JCR *jcr)
    if (strstr(dir->msg, "accurate")) {
       jcr->accurate = true;
    }
-   if (strstr(dir->msg, "incomplete")) {
-      jcr->incomplete = true;
+   if (strstr(dir->msg, "rerunning")) {
+      jcr->rerunning = true;
    }
    if (sscanf(dir->msg, "level = %s ", level) != 1) {
       goto bail_out;
    }
    /* Base backup requested? */
    if (strcmp(level, "base") == 0) {
-      jcr->set_JobLevel(L_BASE);
+      jcr->setJobLevel(L_BASE);
    /* Full backup requested? */
    } else if (strcmp(level, "full") == 0) {
-      jcr->set_JobLevel(L_FULL);
+      jcr->setJobLevel(L_FULL);
    } else if (strstr(level, "differential")) {
-      jcr->set_JobLevel(L_DIFFERENTIAL);
+      jcr->setJobLevel(L_DIFFERENTIAL);
       free_memory(level);
       return 1;
    } else if (strstr(level, "incremental")) {
-      jcr->set_JobLevel(L_INCREMENTAL);
+      jcr->setJobLevel(L_INCREMENTAL);
       free_memory(level);
       return 1;
    /*
@@ -1546,7 +1559,7 @@ static int level_cmd(JCR *jcr)
       utime_t since_time, adj;
       btime_t his_time, bt_start, rt=0, bt_adj=0;
       if (jcr->getJobLevel() == L_NONE) {
-         jcr->set_JobLevel(L_SINCE);     /* if no other job level set, do it now */
+         jcr->setJobLevel(L_SINCE);     /* if no other job level set, do it now */
       }
       if (sscanf(dir->msg, "level = since_utime %s mtime_only=%d",
                  buf, &mtime_only) != 2) {
@@ -1608,7 +1621,7 @@ static int level_cmd(JCR *jcr)
    if (buf) {
       free_memory(buf);
    }
-   generate_plugin_event(jcr, bEventLevel, (void *)jcr->getJobLevel());
+   generate_plugin_event(jcr, bEventLevel, (void*)(intptr_t)jcr->getJobLevel());
    return dir->fsend(OKlevel);
 
 bail_out:
@@ -1709,6 +1722,10 @@ static int storage_cmd(JCR *jcr)
    /* Try to connect for 1 hour at 10 second intervals */
 
    sd->set_source_address(me->FDsrc_addr);
+<<<<<<< HEAD
+=======
+
+>>>>>>> caaa5db... Implement RestoreObject for sqlite + cleanups
    if (!sd->connect(jcr, 10, (int)me->SDConnectTimeout, me->heartbeat_interval,
                 _("Storage daemon"), jcr->stored_addr, NULL, stored_port, 1)) {
      sd->destroy();
@@ -1783,8 +1800,8 @@ static int backup_cmd(JCR *jcr)
       goto cleanup;
    }
 
-   set_jcr_job_status(jcr, JS_Blocked);
-   jcr->set_JobType(JT_BACKUP);
+   jcr->setJobStatus(JS_Blocked);
+   jcr->setJobType(JT_BACKUP);
    Dmsg1(100, "begin backup ff=%p\n", jcr->ff);
 
    if (sd == NULL) {
@@ -1878,11 +1895,11 @@ static int backup_cmd(JCR *jcr)
     */
    Dmsg1(110, "begin blast ff=%p\n", (FF_PKT *)jcr->ff);
    if (!blast_data_to_storage_daemon(jcr, NULL)) {
-      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      jcr->setJobStatus(JS_ErrorTerminated);
       bnet_suppress_error_messages(sd, 1);
       Dmsg0(110, "Error in blast_data.\n");
    } else {
-      set_jcr_job_status(jcr, JS_Terminated);
+      jcr->setJobStatus(JS_Terminated);
       /* Note, the above set status will not override an error */
       if (!(jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings)) {
          bnet_suppress_error_messages(sd, 1);
@@ -1892,7 +1909,7 @@ static int backup_cmd(JCR *jcr)
        * Expect to get response to append_data from Storage daemon
        */
       if (!response(jcr, sd, OK_append, "Append Data")) {
-         set_jcr_job_status(jcr, JS_ErrorTerminated);
+         jcr->setJobStatus(JS_ErrorTerminated);
          goto cleanup;
       }
 
@@ -1902,7 +1919,7 @@ static int backup_cmd(JCR *jcr)
       sd->fsend(append_end, jcr->Ticket);
       /* Get end OK */
       if (!response(jcr, sd, OK_end, "Append End")) {
-         set_jcr_job_status(jcr, JS_ErrorTerminated);
+         jcr->setJobStatus(JS_ErrorTerminated);
          goto cleanup;
       }
 
@@ -1949,22 +1966,22 @@ static int verify_cmd(JCR *jcr)
    BSOCK *sd  = jcr->store_bsock;
    char level[100];
 
-   jcr->set_JobType(JT_VERIFY);
+   jcr->setJobType(JT_VERIFY);
    if (sscanf(dir->msg, verifycmd, level) != 1) {
       dir->fsend(_("2994 Bad verify command: %s\n"), dir->msg);
       return 0;
    }
 
    if (strcasecmp(level, "init") == 0) {
-      jcr->set_JobLevel(L_VERIFY_INIT);
+      jcr->setJobLevel(L_VERIFY_INIT);
    } else if (strcasecmp(level, "catalog") == 0){
-      jcr->set_JobLevel(L_VERIFY_CATALOG);
+      jcr->setJobLevel(L_VERIFY_CATALOG);
    } else if (strcasecmp(level, "volume") == 0){
-      jcr->set_JobLevel(L_VERIFY_VOLUME_TO_CATALOG);
+      jcr->setJobLevel(L_VERIFY_VOLUME_TO_CATALOG);
    } else if (strcasecmp(level, "data") == 0){
-      jcr->set_JobLevel(L_VERIFY_DATA);
+      jcr->setJobLevel(L_VERIFY_DATA);
    } else if (strcasecmp(level, "disk_to_catalog") == 0) {
-      jcr->set_JobLevel(L_VERIFY_DISK_TO_CATALOG);
+      jcr->setJobLevel(L_VERIFY_DISK_TO_CATALOG);
    } else {
       dir->fsend(_("2994 Bad verify level: %s\n"), dir->msg);
       return 0;
@@ -1973,7 +1990,7 @@ static int verify_cmd(JCR *jcr)
    dir->fsend(OKverify);
 
    generate_daemon_event(jcr, "JobStart");
-   generate_plugin_event(jcr, bEventLevel, (void *)jcr->getJobLevel());
+   generate_plugin_event(jcr, bEventLevel,(void *)(intptr_t)jcr->getJobLevel());
    generate_plugin_event(jcr, bEventStartVerifyJob);
 
    Dmsg1(110, "filed>dird: %s", dir->msg);
@@ -2109,16 +2126,16 @@ static int restore_cmd(JCR *jcr)
    dir->fsend(OKrestore);
    Dmsg1(110, "filed>dird: %s", dir->msg);
 
-   jcr->set_JobType(JT_RESTORE);
+   jcr->setJobType(JT_RESTORE);
 
-   set_jcr_job_status(jcr, JS_Blocked);
+   jcr->setJobStatus(JS_Blocked);
 
    if (!open_sd_read_session(jcr)) {
-      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      jcr->setJobStatus(JS_ErrorTerminated);
       goto bail_out;
    }
 
-   set_jcr_job_status(jcr, JS_Running);
+   jcr->setJobStatus(JS_Running);
 
    /**
     * Do restore of files and data
@@ -2158,7 +2175,7 @@ static int restore_cmd(JCR *jcr)
    do_restore(jcr);
    stop_dir_heartbeat(jcr);
 
-   set_jcr_job_status(jcr, JS_Terminated);
+   jcr->setJobStatus(JS_Terminated);
    if (jcr->JobStatus != JS_Terminated) {
       bnet_suppress_error_messages(sd, 1);
    }
@@ -2203,7 +2220,7 @@ bail_out:
    bfree_and_null(jcr->where);
 
    if (jcr->JobErrors) {
-      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      jcr->setJobStatus(JS_ErrorTerminated);
    }
 
    Dmsg0(100, "Done in job.c\n");
@@ -2355,7 +2372,7 @@ static int send_bootstrap_file(JCR *jcr)
       berrno be;
       Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
          jcr->RestoreBootstrap, be.bstrerror());
-      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      jcr->setJobStatus(JS_ErrorTerminated);
       goto bail_out;
    }
    sd->msglen = pm_strcpy(sd->msg, bootstrap);
@@ -2367,7 +2384,7 @@ static int send_bootstrap_file(JCR *jcr)
    sd->signal(BNET_EOD);
    fclose(bs);
    if (!response(jcr, sd, OKSDbootstrap, "Bootstrap")) {
-      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      jcr->setJobStatus(JS_ErrorTerminated);
       goto bail_out;
    }
    stat = 1;