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 */
}
if (!dir_update_volume_info(dcr, false)) {
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->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;
/*
* Write a part (Vol, Vol.1, ...) from the spool to the DVD
- * This MUST only be called from open_next_part. Otherwise the part number
- * is not updated.
- * It is also called from truncate_dvd_dev to "blank" the medium.
+ * This routine does not update the part number, so normally, you
+ * should call open_next_part()
+ * It is also called from truncate_dvd_dev to "blank" the medium, as
+ * well as from block.c when the DVD is full to write the last part.
*/
-static bool dvd_write_part(DCR *dcr)
+bool dvd_write_part(DCR *dcr)
{
DEVICE *dev = dcr->dev;
POOL_MEM ocmd(PM_FNAME);
sm_check(__FILE__, __LINE__, false);
}
- /* growisofs umount the device, so remount it (it will update the free space) */
+ /* growisofs umounted the device, so remount it (it will update the free space) */
dev->clear_mounted();
mount_dev(dev, 1);
Jmsg(dcr->jcr, M_INFO, 0, _("Remaining free space %s on %s\n"),
* - Increment part number
* - Reopen the device
*/
-int open_next_part(DCR *dcr)
+int dvd_open_next_part(DCR *dcr)
{
DEVICE *dev = dcr->dev;
* - Close the fd
* - Reopen the device
*/
-int open_first_part(DCR *dcr, int mode)
+int dvd_open_first_part(DCR *dcr, int mode)
{
DEVICE *dev = dcr->dev;
}
} else {
/* Load next part, and start again */
- if (open_next_part(dcr) < 0) {
+ if (dvd_open_next_part(dcr) < 0) {
Dmsg0(100, "lseek_dev failed while trying to open the next part\n");
return -1;
}
* so just load the first one, and seek again
* until the right one is loaded
*/
- if (open_first_part(dcr, dev->openmode) < 0) {
+ if (dvd_open_first_part(dcr, dev->openmode) < 0) {
Dmsg0(100, "lseek_dev failed while trying to open the first part\n");
return -1;
}
*/
int modesave = dev->openmode;
/* Works because num_parts > 0. */
- if (open_first_part(dcr, OPEN_READ_ONLY) < 0) {
+ if (dvd_open_first_part(dcr, OPEN_READ_ONLY) < 0) {
Dmsg0(100, "lseek_dev failed while trying to open the first part\n");
return -1;
}
if (dev->num_parts > 0) {
while (dev->part < (dev->num_parts-1)) {
- if (open_next_part(dcr) < 0) {
+ if (dvd_open_next_part(dcr) < 0) {
Dmsg0(100, "lseek_dev failed while trying to open the next part\n");
return -1;
}
}
dev->openmode = modesave;
- if (open_next_part(dcr) < 0) {
+ if (dvd_open_next_part(dcr) < 0) {
Dmsg0(100, "lseek_dev failed while trying to open the next part\n");
return -1;
}
NB: No! If you call dvd_write_part, the part number is not updated.
You must open the next part, it will automatically write the part and
update the part number. */
- if (ok && (open_next_part(dcr) < 0)) {
+ if (ok && (dvd_open_next_part(dcr) < 0)) {
Jmsg2(jcr, M_FATAL, 0, _("Unable to write part %s: ERR=%s\n"),
dev->print_name(), strerror_dev(dev));
dev->dev_errno = EIO;
Dmsg0(100, "truncate_dvd_dev: Opening first part (1)...\n");
dev->truncating = true;
- if (open_first_part(dcr, OPEN_READ_WRITE) < 0) {
+ if (dvd_open_first_part(dcr, OPEN_READ_WRITE) < 0) {
Dmsg0(100, "truncate_dvd_dev: Error while opening first part (1).\n");
dev->truncating = false;
return false;
return false;
}
- if (open_first_part(dcr, OPEN_READ_WRITE) < 0) {
+ if (dvd_open_first_part(dcr, OPEN_READ_WRITE) < 0) {
Dmsg0(100, "truncate_dvd_dev: Error while opening first part (2).\n");
return false;
}
/* From dev.c */
DEVICE *init_dev(JCR *jcr, DEVRES *device);
off_t lseek_dev(DEVICE *dev, off_t offset, int whence);
-int open_first_part(DCR *dcr, int mode);
-int open_next_part(DCR *dcr);
bool can_open_mounted_dev(DEVICE *dev);
bool truncate_dev(DCR *dcr);
void term_dev(DEVICE *dev);
uint32_t dev_file(DEVICE *dev);
/* From dvd.c */
+int dvd_open_next_part(DCR *dcr);
+bool dvd_write_part(DCR *dcr);
bool dvd_close_job(DCR *dcr);
bool mount_dev(DEVICE* dev, int timeout);
bool unmount_dev(DEVICE* dev, int timeout);