+ ok = true;
+
+bail_out:
+ /*
+ * At this point, the device is locked and blocked.
+ * Unblock the device, restore any entry blocked condition, then
+ * return leaving the device locked (as it was on entry).
+ */
+ unblock_device(dev);
+ if (blocked != BST_NOT_BLOCKED) {
+ block_device(dev, blocked);
+ }
+ return ok; /* device locked */
+}
+
+void set_start_vol_position(DCR *dcr)
+{
+ DEVICE *dev = dcr->dev;
+ /* Set new start position */
+ if (dev->is_tape()) {
+ dcr->StartBlock = dev->block_num;
+ dcr->StartFile = dev->file;
+ } else {
+ dcr->StartBlock = (uint32_t)dev->file_addr;
+ dcr->StartFile = (uint32_t)(dev->file_addr >> 32);
+ }
+}
+
+/*
+ * We have a new Volume mounted, so reset the Volume parameters
+ * concerning this job. The global changes were made earlier
+ * in the dev structure.
+ */
+void set_new_volume_parameters(DCR *dcr)
+{
+ JCR *jcr = dcr->jcr;
+ if (dcr->NewVol && !dir_get_volume_info(dcr, GET_VOL_INFO_FOR_WRITE)) {
+ Jmsg1(jcr, M_ERROR, 0, "%s", jcr->errmsg);
+ }
+ set_new_file_parameters(dcr);
+ jcr->NumWriteVolumes++;
+ dcr->NewVol = false;