wrcmd();
wrcmd();
weofcmd(); /* end file 2 */
+ if (dev_cap(dev, CAP_TWOEOF)) {
+ weofcmd();
+ }
rewindcmd();
Pmsg0(0, _("Now moving to end of medium.\n"));
eodcmd();
Pmsg0(-1, _("\nNow the important part, I am going to attempt to append to the tape.\n\n"));
wrcmd();
weofcmd();
+ if (dev_cap(dev, CAP_TWOEOF)) {
+ weofcmd();
+ }
rewindcmd();
Pmsg0(-1, _("Done appending, there should be no I/O errors\n\n"));
Pmsg0(-1, "Doing Bacula scan of blocks:\n");
weofcmd(); /* end file 3 */
wrcmd();
weofcmd(); /* end file 4 */
+ if (dev_cap(dev, CAP_TWOEOF)) {
+ weofcmd();
+ }
test_again:
rewindcmd();
* to set EOD or to turn off CAP_FASTFSF if on.
*/
if (file_num == (int)dev->file) {
+ struct mtget mt_stat;
Dmsg1(000, "fsf_dev did not advance from file %d\n", file_num);
- return 0; /* we are not progressing, bail out */
+ if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 &&
+ mt_stat.mt_fileno >= 0) {
+ Dmsg2(000, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno);
+ dev->file = mt_stat.mt_fileno;
+ }
+ stat = 0;
+ break; /* we are not progressing, bail out */
}
}
}
/* Backup over EOF */
stat = bsf_dev(dev, 1);
/* If BSF worked and fileno is known (not -1), set file */
- if (stat == 0 && ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 &&
- mt_stat.mt_fileno >= 0) {
+ if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) {
+ Dmsg2(000, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno);
dev->file = mt_stat.mt_fileno;
+ } else {
+ dev->file++; /* wing it -- not correct on all OSes */
}
} else {
update_pos_dev(dev); /* update position */
}
if (dev->state & ST_TAPE) {
stat |= BMT_TAPE;
- Dmsg0(-20," Driver status:");
+ Dmsg0(-20," Bacula status:");
Dmsg2(-20," file=%d block=%d\n", dev->file, dev->block_num);
if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) < 0) {
dev->dev_errno = errno;