/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2012 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
- modify it under the terms of version two of the GNU General Public
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
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
+ You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*
* Kern E. Sibbald, October 2002
*
- *
- * Version $Id$
*/
#include "bacula.h"
}
Dmsg0(100, "About to acquire device for writing\n");
/* For we must now acquire the device for writing */
- out_dev->r_dlock();
- if (out_dev->open(out_jcr->dcr, OPEN_READ_WRITE) < 0) {
+ out_dev->rLock(false);
+ if (!out_dev->open(out_jcr->dcr, OPEN_READ_WRITE)) {
Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), out_dev->errmsg);
- out_dev->dunlock();
+ out_dev->Unlock();
exit(1);
}
- out_dev->dunlock();
+ out_dev->Unlock();
if (!acquire_device_for_append(out_jcr->dcr)) {
free_jcr(in_jcr);
exit(1);
ok = read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
if (ok || out_dev->can_write()) {
- if (!write_block_to_device(out_jcr->dcr)) {
+ if (!out_jcr->dcr->write_block_to_device()) {
Pmsg0(000, _("Write of last block failed.\n"));
}
}
/* Skipping record, because does not match BSR filter */
return true;
}
- while (!write_record_to_block(out_block, rec)) {
+ while (!write_record_to_block(out_jcr->dcr, rec)) {
Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len,
rec->remainder);
- if (!write_block_to_device(out_jcr->dcr)) {
+ if (!out_jcr->dcr->write_block_to_device()) {
Dmsg2(90, "Got write_block_to_dev error on device %s: ERR=%s\n",
out_dev->print_name(), out_dev->bstrerror());
Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
return false;
}
}
- if (!write_block_to_device(out_jcr->dcr)) {
+ if (!out_jcr->dcr->write_block_to_device()) {
Dmsg2(90, "Got write_block_to_dev error on device %s: ERR=%s\n",
out_dev->print_name(), out_dev->bstrerror());
Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
return true;
}
records++;
- while (!write_record_to_block(out_block, rec)) {
+ while (!write_record_to_block(out_jcr->dcr, rec)) {
Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len,
rec->remainder);
- if (!write_block_to_device(out_jcr->dcr)) {
+ if (!out_jcr->dcr->write_block_to_device()) {
Dmsg2(90, "Got write_block_to_dev error on device %s: ERR=%s\n",
out_dev->print_name(), out_dev->bstrerror());
Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sessrec)
{
const char *rtype;
- memset(sessrec, 0, sizeof(sessrec));
+ memset(sessrec, 0, sizeof(SESSION_LABEL));
switch (rec->FileIndex) {
case PRE_LABEL:
rtype = _("Fresh Volume Label");