From 35175977bf626e7a85a69d44e2c6f0bed11e7fdb Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 27 Jul 2005 22:45:20 +0000 Subject: [PATCH] Other modifications outside DVD functions. (@kern please double-check this) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2262 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dev.h | 2 ++ bacula/src/stored/device.c | 2 +- bacula/src/stored/label.c | 2 +- bacula/src/stored/mount.c | 6 ++++-- bacula/src/stored/protos.h | 4 +++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 3e7c58474c..57c4bb5b77 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -230,6 +230,8 @@ public: * - free_space_errno == 0: ignore free_space. * - free_space_errno < 0: an error occured. * - free_space_errno > 0: free_space is valid. */ + bool truncating; /* if set, we are currently truncating the DVD */ + utime_t vol_poll_interval; /* interval between polling Vol mount */ DEVRES *device; /* pointer to Device Resource */ diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 65b956878c..282c486354 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -296,7 +296,7 @@ bool open_device(DCR *dcr) } if (dev->open(dcr, mode) < 0) { /* If polling, ignore the error */ - if (!dev->poll) { + if ((!dev->poll) && (!dev->is_dvd())) { Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open device %s: ERR=%s\n"), dev->print_name(), strerror_dev(dev)); Pmsg2(000, "Unable to open archive %s: ERR=%s\n", diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index c6bd1391d8..e83532e4b1 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -377,7 +377,7 @@ bool rewrite_volume_label(DCR *dcr, bool recycle) dev->print_name(), strerror_dev(dev)); } if (recycle) { - if (!truncate_dev(dev)) { + if (!truncate_dev(dcr)) { Jmsg2(jcr, M_WARNING, 0, _("Truncate error on device %s: ERR=%s\n"), dev->print_name(), strerror_dev(dev)); } diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 97e82cfc0d..bf71087cf5 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -48,7 +48,7 @@ bool mount_next_write_volume(DCR *dcr, bool release) JCR *jcr = dcr->jcr; DEV_BLOCK *block = dcr->block; - Dmsg0(100, "Enter mount_next_volume()\n"); + Dmsg1(100, "Enter mount_next_volume(release=%d)\n", release); init_device_wait_timers(dcr); @@ -123,10 +123,12 @@ mount_next_vol: * we will err, recurse and ask the operator the next time. */ if (!release && dev->is_tape() && dev_cap(dev, CAP_AUTOMOUNT)) { + Dmsg0(100, "(1)Ask=0"); ask = false; /* don't ask SYSOP this time */ } /* Don't ask if not removable */ if (!dev_cap(dev, CAP_REM)) { + Dmsg0(100, "(2)Ask=0"); ask = false; } Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger); @@ -147,7 +149,7 @@ mount_next_vol: /* Ensure the device is open */ if (!open_device(dcr)) { - if (dev->poll) { + if ((dev->poll) || (dev->is_dvd())) { goto mount_next_vol; } else { return false; diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index 54e526b036..d35e52a958 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -83,7 +83,7 @@ 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(DEVICE *dev); +bool truncate_dev(DCR *dcr); void term_dev(DEVICE *dev); char * strerror_dev(DEVICE *dev); void clrerror_dev(DEVICE *dev, int func); @@ -120,6 +120,8 @@ bool unmount_dev(DEVICE* dev, int timeout); void update_free_space_dev(DEVICE *dev); void make_mounted_dvd_filename(DEVICE *dev, POOL_MEM &archive_name); void make_spooled_dvd_filename(DEVICE *dev, POOL_MEM &archive_name); +bool truncate_dvd_dev(DCR *dcr); +bool check_can_write_on_non_blank_dvd(DCR *dcr); /* From device.c */ bool open_device(DCR *dcr); -- 2.39.2