/*
Bacula® - The Network Backup Solution
- Copyright (C) 2005-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2005-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.
/* The device must be mounted in order to dvd-freespace to work */
mount(1);
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
icmd = device->free_space_command;
if (!icmd) {
free_pool_memory(results);
Dmsg4(29, "leave update_freespace: free_space=%s freespace_ok=%d free_space_errno=%d have_media=%d\n",
edit_uint64(free_space, ed1), !!is_freespace_ok(), free_space_errno, !!have_media());
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
return ok;
}
unlink(archive_name.c_str());
dev->set_part_spooled(false);
Dmsg1(29, "========= unlink(%s)\n", archive_name.c_str());
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
return true;
}
dev->clear_freespace_ok(); /* need to update freespace */
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
Dmsg3(29, "dvd_write_part: device is %s, part is %d, is_mounted=%d\n", dev->print_name(), dev->part, dev->is_mounted());
icmd = dev->device->write_part_command;
if (!dev->truncating) {
dcr->mark_volume_in_error();
}
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
return false;
}
Jmsg(dcr->jcr, M_INFO, 0, _("Part %d (%lld bytes) written to DVD.\n"), dev->part, dev->part_size);
unlink(archive_name.c_str());
dev->set_part_spooled(false);
Dmsg1(29, "========= unlink(%s)\n", archive_name.c_str());
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
/* growisofs umounted the device, so remount it (it will update the free space) */
dev->clear_mounted();
dev->mount(1);
Jmsg(dcr->jcr, M_INFO, 0, _("Remaining free space %s on %s\n"),
edit_uint64_with_commas(dev->free_space, ed1), dev->print_name());
- sm_check(__FILE__, __LINE__, false);
+ Dsm_check(400);
return true;
}
return -1;
}
}
-
-#ifdef neeeded
- Dmsg2(400, "num_dvd_parts=%d part=%d\n", dev->num_dvd_parts, dev->part);
- make_spooled_dvd_filename(dev, archive_name); /* makes spool name */
-
- /* Check if the next part exists in spool directory . */
- Dmsg1(100, "Check if part on spool: %s\n", archive_name.c_str());
- if ((stat(archive_name.c_str(), &buf) == 0) || (errno != ENOENT)) {
- Dmsg1(29, "======= Part %s is in the way, deleting it...\n", archive_name.c_str());
- /* Then try to unlink it */
- if (unlink(archive_name.c_str()) < 0) {
- berrno be;
- 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.bstrerror());
- return -1;
- }
- }
-#endif
}
Dmsg2(400, "Call dev->open(vol=%s, mode=%d)\n", dcr->getVolCatName(),
dev->openmode);
/* Open next part. Note, this sets part_size for part opened. */
- if (dev->open(dcr, OPEN_READ_ONLY) < 0) {
+ if (!dev->open(dcr, OPEN_READ_ONLY)) {
return -1;
}
dev->set_labeled(); /* all next parts are "labeled" */
dev->part = 1;
dev->part_start = 0;
- if (dev->open(dcr, mode) < 0) {
+ if (!dev->open(dcr, mode)) {
Dmsg0(400, "open dev() failed\n");
return false;
}
*/
boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence)
{
- DEVICE *dev = dcr->dev;
+ DEVICE *dev;
boffset_t pos;
char ed1[50], ed2[50];
+
+ if (!dcr) { /* can be NULL when called from rewind(NULL) */
+ return -1;
+ }
+ dev = dcr->dev;
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);