]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/read.c
- Simplify code in askdir.c that waits for creating an appendable
[bacula/bacula] / bacula / src / stored / read.c
index 7b3569d6051c0acec5f62066098b6a1638767890..2eb35186655f1390907607a4d528f77e33c180ff 100644 (file)
@@ -9,19 +9,14 @@
    Copyright (C) 2000-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
@@ -40,13 +35,13 @@ static char rec_header[] = "rechdr %ld %ld %ld %ld %ld";
 /*
  *  Read Data and send to File Daemon
  *   Returns: false on failure
- *           true  on success
+ *            true  on success
  */
 bool do_read_data(JCR *jcr)
 {
    BSOCK *fd = jcr->file_bsock;
    bool ok = true;
-   DCR *dcr = jcr->dcr;
+   DCR *dcr = jcr->read_dcr;
 
    Dmsg0(20, "Start read data.\n");
 
@@ -55,10 +50,10 @@ bool do_read_data(JCR *jcr)
    }
 
 
-   create_vol_list(jcr);
+   create_restore_volume_list(jcr);
    if (jcr->NumVolumes == 0) {
       Jmsg(jcr, M_FATAL, 0, _("No Volume names found for restore.\n"));
-      free_vol_list(jcr);
+      free_restore_volume_list(jcr);
       bnet_fsend(fd, FD_error);
       return false;
    }
@@ -68,7 +63,7 @@ bool do_read_data(JCR *jcr)
 
    /* Ready device for reading */
    if (!acquire_device_for_read(dcr)) {
-      free_vol_list(jcr);
+      free_restore_volume_list(jcr);
       bnet_fsend(fd, FD_error);
       return false;
    }
@@ -84,7 +79,7 @@ bool do_read_data(JCR *jcr)
       ok = false;
    }
 
-   free_vol_list(jcr);
+   free_restore_volume_list(jcr);
    Dmsg0(30, "Done reading.\n");
    return ok;
 }
@@ -92,7 +87,7 @@ bool do_read_data(JCR *jcr)
 /*
  * Called here for each record from read_records()
  *  Returns: true if OK
- *          false if error
+ *           false if error
  */
 static bool record_cb(DCR *dcr, DEV_RECORD *rec)
 {
@@ -104,34 +99,34 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
    if (rec->FileIndex < 0) {
       return true;
    }
-   Dmsg5(100, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n",
+   Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n",
       rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream,
       rec->data_len);
 
    /* Send record header to File daemon */
    if (!bnet_fsend(fd, rec_header, rec->VolSessionId, rec->VolSessionTime,
-         rec->FileIndex, rec->Stream, rec->data_len)) {
-      Dmsg1(30, ">filed: Error Hdr=%s\n", fd->msg);
+          rec->FileIndex, rec->Stream, rec->data_len)) {
+      Pmsg1(000, _(">filed: Error Hdr=%s\n"), fd->msg);
       Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
-        bnet_strerror(fd));
+         bnet_strerror(fd));
       return false;
    } else {
-      Dmsg1(31, ">filed: Hdr=%s\n", fd->msg);
+      Dmsg1(400, ">filed: Hdr=%s\n", fd->msg);
    }
 
 
    /* Send data record to File daemon */
-   save_msg = fd->msg;         /* save fd message pointer */
-   fd->msg = rec->data;        /* pass data directly to bnet_send */
+   save_msg = fd->msg;          /* save fd message pointer */
+   fd->msg = rec->data;         /* pass data directly to bnet_send */
    fd->msglen = rec->data_len;
-   Dmsg1(31, ">filed: send %d bytes data.\n", fd->msglen);
+   Dmsg1(400, ">filed: send %d bytes data.\n", fd->msglen);
    if (!bnet_send(fd)) {
-      Pmsg1(000, "Error sending to FD. ERR=%s\n", bnet_strerror(fd));
+      Pmsg1(000, _("Error sending to FD. ERR=%s\n"), bnet_strerror(fd));
       Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
-        bnet_strerror(fd));
+         bnet_strerror(fd));
 
       ok = false;
    }
-   fd->msg = save_msg;               /* restore fd message pointer */
+   fd->msg = save_msg;                /* restore fd message pointer */
    return ok;
 }