- Jmsg(jcr, M_INFO, 0, "End of Volume at file %u on device %s, Volume \"%s\"\n",
- dev->file, dev_name(dev), jcr->VolumeName);
- if (!mount_cb(jcr, dev, block)) {
- Jmsg(jcr, M_INFO, 0, "End of all volumes.\n");
- ok = FALSE;
- /*
- * Create EOT Label so that Media record may
- * be properly updated because this is the last
- * tape.
- */
- trec->FileIndex = EOT_LABEL;
- trec->File = dev->file;
- ok = record_cb(jcr, dev, block, trec);
- free_record(trec);
- break;
- }
- /*
- * We just have a new tape up, now read the label (first record)
- * and pass it off to the callback routine, then continue
- * most likely reading the previous record.
- */
- read_block_from_device(jcr, dev, block, NO_BLOCK_NUMBER_CHECK);
- read_record_from_block(block, trec);
- handle_session_record(dev, trec, &sessrec);
- ok = record_cb(jcr, dev, block, trec);
- free_record(trec);
- position_to_first_file(jcr, dev);
- /* After reading label, we must read first data block */
- continue;
-
- } else if (dev_state(dev, ST_EOF)) {
- if (verbose) {
- Jmsg(jcr, M_INFO, 0, "Got EOF at file %u on device %s, Volume \"%s\"\n",
- dev->file, dev_name(dev), jcr->VolumeName);
- }
- continue;
- } else if (dev_state(dev, ST_SHORT)) {
- Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
- continue;
- } else {
- /* I/O error or strange end of tape */
- display_tape_error_status(jcr, dev);
- ok = FALSE;
- break;
- }
+ } else if (dev->at_eof()) {
+ if (verbose) {
+ char *fp;
+ uint32_t fp_num;
+ if (dev->is_dvd()) {
+ fp = _("part");
+ fp_num = dev->part;
+ } else {
+ fp = _("file");
+ fp_num = dev->file;
+ }
+ Jmsg(jcr, M_INFO, 0, _("End of %s %u on device %s, Volume \"%s\"\n"),
+ fp, fp_num, dev->print_name(), dcr->VolumeName);
+ }
+ Dmsg3(200, "End of file %u on device %s, Volume \"%s\"\n",
+ dev->file, dev->print_name(), dcr->VolumeName);
+ continue;
+ } else if (dev->is_short_block()) {
+ Jmsg1(jcr, M_ERROR, 0, "%s", dev->errmsg);
+ continue;
+ } else {
+ /* I/O error or strange end of tape */
+ display_tape_error_status(jcr, dev);
+ if (forge_on || jcr->ignore_label_errors) {
+ dev->fsr(1); /* try skipping bad record */
+ Pmsg0(000, _("Did fsr in attemp to skip bad record.\n"));
+ continue; /* try to continue */
+ }
+ ok = false; /* stop everything */
+ break;
+ }