*
*/
/*
- Copyright (C) 2001-2005 Kern Sibbald
+ Copyright (C) 2001-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
int32_t FileIndex;
int32_t Stream;
int bhl, rhl;
+ char buf1[100], buf2[100];
unser_begin(b->buf, BLKHDR1_LENGTH);
unser_uint32(CheckSum);
unser_int32(Stream);
unser_uint32(data_len);
Pmsg6(000, _(" Rec: VId=%u VT=%u FI=%s Strm=%s len=%d p=%x\n"),
- VolSessionId, VolSessionTime, FI_to_ascii(FileIndex),
- stream_to_ascii(Stream, FileIndex), data_len, p);
+ VolSessionId, VolSessionTime, FI_to_ascii(buf1, FileIndex),
+ stream_to_ascii(buf2, Stream, FileIndex), data_len, p);
p += data_len + rhl;
}
}
*/
if (dev->is_tape() && dev_cap(dev, CAP_BSR)) {
/* Now back up over what we wrote and read the last block */
- if (!bsf_dev(dev, 1)) {
+ if (!dev->bsf(1)) {
berrno be;
ok = false;
Jmsg(jcr, M_ERROR, 0, _("Backspace file at EOT failed. ERR=%s\n"),
be.strerror(dev->dev_errno));
}
- if (ok && dev_cap(dev, CAP_TWOEOF) && !bsf_dev(dev, 1)) {
+ if (ok && dev->has_cap(CAP_TWOEOF) && !dev->bsf(1)) {
berrno be;
ok = false;
Jmsg(jcr, M_ERROR, 0, _("Backspace file at EOT failed. ERR=%s\n"),
dcr->block->write_failed = true;
if (weof_dev(dev, 1) != 0) { /* end the tape */
dev->VolCatInfo.VolCatErrors++;
- Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing final EOF to tape. This tape may not be readable.\n"
+ Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing final EOF to tape. This Volume may not be readable.\n"
"%s"), dev->errmsg);
ok = false;
Dmsg0(100, "WEOF error.\n");
dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */
dev->VolCatInfo.VolCatJobs++; /* increment number of jobs */
- if (dev->is_dvd()) { /* Write the current (and last) part. */
- open_next_part(dcr);
+ if (dev->is_dvd()) {
+ dvd_write_part(dcr); /* write last part */
+ dev->VolCatInfo.VolCatParts = dev->num_parts;
}
if (!dir_update_volume_info(dcr, false)) {
JCR *jcr = dcr->jcr;
DEV_BLOCK *block = dcr->block;
+ /* Don't go further if the device is not a dvd */
+ if (!dev->is_dvd()) {
+ return true;
+ }
+
/* Limit maximum part size to value specified by user
- * (not applicable to tapes/fifos)
*/
- if (!(dev->is_tape() || dev->is_fifo()) && dev->max_part_size > 0 &&
- (dev->part_size + block->binbuf) >= dev->max_part_size) {
+ if (dev->max_part_size > 0 && ((dev->part_size + block->binbuf) >= dev->max_part_size)) {
if (dev->part < dev->num_parts) {
Jmsg3(dcr->jcr, M_FATAL, 0, _("Error while writing, current part number"
" is less than the total number of parts (%d/%d, device=%s)\n"),
return false;
}
- if (open_next_part(dcr) < 0) {
+ if (dvd_open_next_part(dcr) < 0) {
Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open device next part %s: ERR=%s\n"),
dev->print_name(), strerror_dev(dev));
dev->dev_errno = EIO;
}
}
- if (dev->free_space_errno < 0) { /* Error while getting free space */
+ if (!dev->is_freespace_ok()) { /* Error while getting free space */
char ed1[50], ed2[50];
Dmsg1(10, "Cannot get free space on the device ERR=%s.\n", dev->errmsg);
Jmsg(jcr, M_FATAL, 0, _("End of Volume \"%s\" at %u:%u on device %s "
dev->file, dev->block_num, dev->print_name(),
edit_uint64_with_commas(dev->part_size, ed1), edit_uint64_with_commas(dev->free_space, ed2),
dev->free_space_errno, dev->errmsg);
- dev->dev_errno = -dev->free_space_errno;
+ dev->dev_errno = dev->free_space_errno;
return false;
}
- if ((dev->free_space_errno > 0 && (dev->part_size + block->binbuf) >= dev->free_space)) {
+ if ((dev->is_freespace_ok() && (dev->part_size + block->binbuf) >= dev->free_space)) {
char ed1[50], ed2[50];
Dmsg0(10, "==== Just enough free space on the device to write the current part...\n");
Jmsg(jcr, M_INFO, 0, _("End of Volume \"%s\" at %u:%u on device %s "
if ((dev->num_parts > 0) &&
((dev->file_addr-dev->part_start) == dev->part_size) &&
(dev->part < dev->num_parts)) {
- if (open_next_part(dcr) < 0) {
+ if (dvd_open_next_part(dcr) < 0) {
Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open device next part %s: ERR=%s\n"),
dev->print_name(), strerror_dev(dev));
dev->dev_errno = EIO;