ok = find_recycled_volume(jcr, InChanger, mr);
Dmsg2(100, "find_recycled_volume %d FW=%d\n", ok, mr->FirstWritten);
if (!ok) {
- /*
- * 3. Try pruning Volumes
+ /*
+ * 3. Try recycling any purged volume
*/
- prune_volumes(jcr);
ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
- if (InChanger) {
- InChanger = false;
- if (!ok) {
- continue; /* retry again accepting any volume */
- }
- }
- Dmsg2(200, "find_recycled_volume2 %d FW=%d\n", ok, mr->FirstWritten);
- if (!ok && create) {
+ if (!ok) {
/*
- * 4. Try "creating" a new Volume
+ * 4. Try pruning Volumes
*/
- ok = newVolume(jcr, mr);
+ prune_volumes(jcr);
+ ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
+ if (InChanger) {
+ InChanger = false;
+ if (!ok) {
+ continue; /* retry again accepting any volume */
+ }
+ }
+ Dmsg2(200, "find_recycled_volume2 %d FW=%d\n", ok, mr->FirstWritten);
+ if (!ok && create) {
+ /*
+ * 5. Try "creating" a new Volume
+ */
+ ok = newVolume(jcr, mr);
+ }
}
}
* that we can get the filename; the device_name for
* a file is the directory only.
*
- * Retuns: 0 on failure
- * 1 on success
+ * Returns: false on failure
+ * true on success
*/
-int first_open_device(DEVICE *dev)
+bool first_open_device(DEVICE *dev)
{
Dmsg0(120, "start open_output_device()\n");
if (!dev) {
- return 0;
+ return false;
}
lock_device(dev);
if (!dev_is_tape(dev)) {
Dmsg0(129, "Device is file, deferring open.\n");
unlock_device(dev);
- return 1;
+ return true;
}
if (!(dev->state & ST_OPENED)) {
if (open_dev(dev, NULL, mode) < 0) {
Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
unlock_device(dev);
- return 0;
+ return false;
}
}
Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
unlock_device(dev);
- return 1;
+ return true;
}
/*
* Make sure device is open, if not do so
*/
-int open_device(JCR *jcr, DEVICE *dev)
+bool open_device(JCR *jcr, DEVICE *dev)
{
/* Open device */
if (!(dev_state(dev, ST_OPENED))) {
mode = OPEN_READ_WRITE;
}
if (open_dev(dev, jcr->VolCatInfo.VolCatName, mode) < 0) {
- Jmsg2(jcr, M_FATAL, 0, _("Unable to open device %s. ERR=%s\n"),
- dev_name(dev), strerror_dev(dev));
- return 0;
+ /* If polling, ignore the error */
+ if (!dev->poll) {
+ Jmsg2(jcr, M_FATAL, 0, _("Unable to open device %s. ERR=%s\n"),
+ dev_name(dev), strerror_dev(dev));
+ }
+ return false;
}
}
- return 1;
+ return true;
}
void dev_lock(DEVICE *dev)
bool dev_is_tape(DEVICE *dev);
/* From device.c */
-int open_device(JCR *jcr, DEVICE *dev);
-int first_open_device(DEVICE *dev);
+bool open_device(JCR *jcr, DEVICE *dev);
+bool first_open_device(DEVICE *dev);
bool fixup_device_block_write_error(DCR *dcr, DEV_BLOCK *block);
void _lock_device(const char *file, int line, DEVICE *dev);
void _unlock_device(const char *file, int line, DEVICE *dev);
/* */
#undef VERSION
#define VERSION "1.35.3"
-#define BDATE "02 September 2004"
-#define LSMDATE "02Sep04"
+#define BDATE "03 September 2004"
+#define LSMDATE "03Sep04"
/* Debug flags */
#undef DEBUG