]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/append.c
Use rentrant mysql lib, eliminate race in sql_list, Win32 streams, misc see kes-1.31
[bacula/bacula] / bacula / src / stored / append.c
index 3d5ca9009a3a51dab5622812bcd4ce8c2586996b..27650e7915e3de5cfef74925f00825b7ff7aab2f 100644 (file)
@@ -5,7 +5,7 @@
  *  Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -51,8 +51,6 @@ int do_append_data(JCR *jcr)
    /* Tell File daemon to send data */
    bnet_fsend(fd_sock, OK_data);
 
-   sm_check(__FILE__, __LINE__, False);
-
    if (!jcr->no_attributes && jcr->spool_attributes) {
       open_spool_file(jcr, jcr->dir_bsock);
    }
@@ -75,13 +73,11 @@ int do_append_data(JCR *jcr)
     *  subroutine.
     */
    Dmsg0(100, "just before acquire_device\n");
-   if (!acquire_device_for_append(jcr, dev, block)) {
+   if (!(dev=acquire_device_for_append(jcr, dev, block))) {
       set_jcr_job_status(jcr, JS_ErrorTerminated);
       free_block(block);
       return 0;
    }
-   sm_check(__FILE__, __LINE__, False);
-
    Dmsg0(100, "Just after acquire_device_for_append\n");
    /*
     * Write Begin Session Record
@@ -93,8 +89,6 @@ int do_append_data(JCR *jcr)
       ok = FALSE;
    }
 
-   sm_check(__FILE__, __LINE__, False);
-
    memset(&rec, 0, sizeof(rec));
 
    /* 
@@ -116,7 +110,7 @@ int do_append_data(JCR *jcr)
     */
    jcr->VolFirstFile = 0;
    time(&jcr->run_time);             /* start counting time for rates */
-   for (last_file_index = 0; ok && !job_cancelled(jcr); ) {
+   for (last_file_index = 0; ok && !job_canceled(jcr); ) {
       char info[100];
 
       /* Read Stream header from the File daemon.
@@ -135,7 +129,6 @@ int do_append_data(JCR *jcr)
         ok = FALSE;
         break;
       }
-      sm_check(__FILE__, __LINE__, False);
       ds->msg[ds->msglen] = 0;
       if (sscanf(ds->msg, "%ld %ld %100s", &file_index, &stream, info) != 3) {
          Jmsg1(jcr, M_FATAL, 0, _("Malformed data header from FD: %s\n"), ds->msg);
@@ -161,10 +154,8 @@ int do_append_data(JCR *jcr)
       /* Read data stream from the File daemon.
        *  The data stream is just raw bytes
        */
-      sm_check(__FILE__, __LINE__, False);
-      while ((n=bget_msg(ds)) > 0 && !job_cancelled(jcr)) {
+      while ((n=bget_msg(ds)) > 0 && !job_canceled(jcr)) {
 
-        sm_check(__FILE__, __LINE__, False);
         rec.VolSessionId = jcr->VolSessionId;
         rec.VolSessionTime = jcr->VolSessionTime;
         rec.FileIndex = file_index;
@@ -188,7 +179,6 @@ int do_append_data(JCR *jcr)
               break;
            }
         }
-        sm_check(__FILE__, __LINE__, False);
         if (!ok) {
             Dmsg0(400, "Not OK\n");
            break;
@@ -200,7 +190,7 @@ int do_append_data(JCR *jcr)
 
         /* Send attributes and MD5 to Director for Catalog */
         if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_MD5_SIGNATURE ||
-            stream == STREAM_WIN32_ATTRIBUTES) { 
+            stream == STREAM_WIN32_ATTRIBUTES || stream == STREAM_SHA1_SIGNATURE) { 
            if (!jcr->no_attributes) {
               if (jcr->spool_attributes && jcr->dir_bsock->spool_fd) {
                  jcr->dir_bsock->spool = 1;
@@ -216,7 +206,6 @@ int do_append_data(JCR *jcr)
               jcr->dir_bsock->spool = 0;
            }
         }
-        sm_check(__FILE__, __LINE__, False);
       }
       if (is_bnet_error(ds)) {
          Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"),
@@ -229,7 +218,6 @@ int do_append_data(JCR *jcr)
     *   We probably need a new flag that says "Do not attempt
     *   to write because there is no tape".
     */
-   sm_check(__FILE__, __LINE__, False);
    Dmsg0(90, "Write_end_session_label()\n");
 
    /* Create Job status for end of session label */