X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fdvd.c;h=0496359b4a48b6f940595836754e61b266d052d4;hb=0d99c317e0ac4a98ccbe01ac960e4d0c35184eb9;hp=8a45fd78c3917d8538039d1a065671b07ab406e9;hpb=eb6ca2497cb437e6ac7916b682a2ac24b363fb9c;p=bacula%2Fbacula diff --git a/bacula/src/stored/dvd.c b/bacula/src/stored/dvd.c index 8a45fd78c3..0496359b4a 100644 --- a/bacula/src/stored/dvd.c +++ b/bacula/src/stored/dvd.c @@ -1,3 +1,30 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2005-2008 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 + License as published by the Free Software Foundation and included + in the file LICENSE. + + 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., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ /* * * dvd.c -- Routines specific to DVD devices (and @@ -7,20 +34,6 @@ * * Version $Id$ */ -/* - Copyright (C) 2005-2006 Kern Sibbald - - This program is free software; you can redistribute it and/or - 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 - the file LICENSE for additional details. - - */ #include "bacula.h" #include "stored.h" @@ -131,7 +144,7 @@ bool DEVICE::update_freespace() free_space_errno = EPIPE; clear_freespace_ok(); /* no valid freespace */ Mmsg2(errmsg, _("Cannot run free space command. Results=%s ERR=%s\n"), - results, be.strerror(status)); + results, be.bstrerror(status)); if (--timeout > 0) { Dmsg4(40, "Cannot get free space on device %s. free_space=%s, " @@ -241,7 +254,7 @@ bool dvd_write_part(DCR *dcr) } Dmsg2(20, "Write part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout); - status = run_program_full_output(ocmd.c_str(), timeout, results.c_str()); + status = run_program_full_output(ocmd.c_str(), timeout, results.addr()); Dmsg2(20, "Write part status=%d result=%s\n", status, results.c_str()); dev->blank_dvd = false; @@ -253,7 +266,7 @@ bool dvd_write_part(DCR *dcr) Dmsg1(100, "%s\n", dev->errmsg); dev->dev_errno = EIO; if (!dev->truncating) { - mark_volume_in_error(dcr); + dcr->mark_volume_in_error(); } sm_check(__FILE__, __LINE__, false); return false; @@ -305,7 +318,7 @@ int dvd_open_next_part(DCR *dcr) if (dev->can_append() && (dev->part > dev->num_dvd_parts) && (dev->part_size == 0)) { Dmsg0(29, "open_next_part exited immediately (dev->part_size == 0).\n"); - return dev->fd; + return dev->fd(); } dev->close_part(dcr); /* close current part */ @@ -363,7 +376,7 @@ int dvd_open_next_part(DCR *dcr) dev->set_part_spooled(false); dev->dev_errno = errno; Mmsg2(dev->errmsg, _("open_next_part can't unlink existing part %s, ERR=%s\n"), - archive_name.c_str(), be.strerror()); + archive_name.c_str(), be.bstrerror()); return -1; } } @@ -379,7 +392,7 @@ int dvd_open_next_part(DCR *dcr) } dev->set_labeled(); /* all next parts are "labeled" */ - return dev->fd; + return dev->fd(); } /* @@ -422,7 +435,7 @@ boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence) boffset_t pos; char ed1[50], ed2[50]; - Dmsg5(400, "Enter lseek_dvd fd=%d off=%s w=%d part=%d nparts=%d\n", dev->fd, + Dmsg5(400, "Enter lseek_dvd fd=%d off=%s w=%d part=%d nparts=%d\n", dev->fd(), edit_int64(offset, ed1), whence, dev->part, dev->num_dvd_parts); switch(whence) { @@ -434,9 +447,9 @@ boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence) (uint64_t)offset < dev->part_start+dev->part_size) { /* We are staying in the current part, just seek */ #if defined(HAVE_WIN32) - pos = _lseeki64(dev->fd, offset-dev->part_start, SEEK_SET); + pos = _lseeki64(dev->fd(), offset-dev->part_start, SEEK_SET); #else - pos = lseek(dev->fd, offset-dev->part_start, SEEK_SET); + pos = lseek(dev->fd(), offset-dev->part_start, SEEK_SET); #endif if (pos < 0) { return pos; @@ -473,7 +486,7 @@ boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence) break; case SEEK_CUR: Dmsg1(400, "lseek_dvd SEEK_CUR to %s\n", edit_int64(offset, ed1)); - if ((pos = lseek(dev->fd, (off_t)0, SEEK_CUR)) < 0) { + if ((pos = lseek(dev->fd(), 0, SEEK_CUR)) < 0) { Dmsg0(400, "Seek error.\n"); return pos; } @@ -505,7 +518,7 @@ boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence) * right part number, simply seek */ if (dev->is_part_spooled() && dev->part > dev->num_dvd_parts) { - if ((pos = lseek(dev->fd, (off_t)0, SEEK_END)) < 0) { + if ((pos = lseek(dev->fd(), 0, SEEK_END)) < 0) { return pos; } else { Dmsg1(400, "lseek_dvd SEEK_END returns %s\n", @@ -673,7 +686,7 @@ bool truncate_dvd(DCR *dcr) dcr->VolCatInfo.VolCatBytes = 0; /* Update catalog */ - if (!dir_update_volume_info(dcr, false)) { + if (!dir_update_volume_info(dcr, false, true)) { return false; } @@ -707,7 +720,7 @@ bool check_can_write_on_non_blank_dvd(DCR *dcr) berrno be; dev->dev_errno = errno; Dmsg3(29, "check_can_write_on_non_blank_dvd: failed to open dir %s (dev=%s), ERR=%s\n", - dev->device->mount_point, dev->print_name(), be.strerror()); + dev->device->mount_point, dev->print_name(), be.bstrerror()); return false; } @@ -734,7 +747,7 @@ bool check_can_write_on_non_blank_dvd(DCR *dcr) berrno be; dev->dev_errno = errno; Dmsg2(29, "check_can_write_on_non_blank_dvd: cannot stat file (file=%s), ERR=%s\n", - filename.c_str(), be.strerror()); + filename.c_str(), be.bstrerror()); ok = false; break; } @@ -783,7 +796,7 @@ int find_num_dvd_parts(DCR *dcr) berrno be; dev->dev_errno = errno; Dmsg3(29, "find_num_dvd_parts: failed to open dir %s (dev=%s), ERR=%s\n", - dev->device->mount_point, dev->print_name(), be.strerror()); + dev->device->mount_point, dev->print_name(), be.bstrerror()); goto get_out; }