From: Kern Sibbald Date: Fri, 12 Nov 2004 17:37:03 +0000 (+0000) Subject: Fix scripts/Makefile.in missing ;\ -- thanks Martin X-Git-Tag: Release-7.0.0~9100 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3f64fa238ad124be9c4ed98d7d32f1f3cb9425cf;p=bacula%2Fbacula Fix scripts/Makefile.in missing ;\ -- thanks Martin - A bit of work on btape to keep if from going into infinite loops when things do not work well, and to print a bit better info. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1685 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/scripts/.cvsignore b/bacula/scripts/.cvsignore index b0dbddcbfc..38362e56b4 100644 --- a/bacula/scripts/.cvsignore +++ b/bacula/scripts/.cvsignore @@ -1,3 +1,4 @@ +bacula-tray-monitor.desktop bacula-tray-monior.desktop .xvpics logrotate diff --git a/bacula/scripts/Makefile.in b/bacula/scripts/Makefile.in index 6be5b38fd6..10f97167f7 100755 --- a/bacula/scripts/Makefile.in +++ b/bacula/scripts/Makefile.in @@ -39,7 +39,7 @@ install: installdirs $(INSTALL_SCRIPT) bacula $(DESTDIR)$(scriptdir)/bacula @if test -f ${DESTDIR}${scriptdir}/mtx-changer; then \ echo " ==> Saving existing mtx-changer to mtx-changer.old"; \ - $(MV) -f ${DESTDIR}${scriptdir}/mtx-changer ${DESTDIR}${scriptdir}/mtx-changer.old + $(MV) -f ${DESTDIR}${scriptdir}/mtx-changer ${DESTDIR}${scriptdir}/mtx-changer.old; \ fi $(INSTALL_SCRIPT) mtx-changer $(DESTDIR)$(scriptdir)/mtx-changer $(INSTALL_DATA) btraceback.gdb $(DESTDIR)$(scriptdir)/btraceback.gdb diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 526a778208..f1578f8746 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -544,6 +544,7 @@ static void capcmd() printf("%sFSR ", dev->capabilities & CAP_FSR ? "" : "!"); printf("%sFSF ", dev->capabilities & CAP_FSF ? "" : "!"); printf("%sFASTFSF ", dev->capabilities & CAP_FASTFSF ? "" : "!"); + printf("%sBSFATEOM ", dev->capabilities & CAP_BSFATEOM ? "" : "!"); printf("%sEOM ", dev->capabilities & CAP_EOM ? "" : "!"); printf("%sREM ", dev->capabilities & CAP_REM ? "" : "!"); printf("%sRACCESS ", dev->capabilities & CAP_RACCESS ? "" : "!"); @@ -706,12 +707,14 @@ static int re_read_block_test() } Pmsg0(0, "Backspace record OK.\n"); if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) { - Pmsg1(0, _("Read block failed! ERR=%s\n"), strerror(dev->dev_errno)); + berrno be; + Pmsg1(0, _("Read block failed! ERR=%s\n"), be.strerror(dev->dev_errno)); goto bail_out; } memset(rec->data, 0, rec->data_len); if (!read_record_from_block(block, rec)) { - Pmsg1(0, _("Read block failed! ERR=%s\n"), strerror(dev->dev_errno)); + berrno be; + Pmsg1(0, _("Read block failed! ERR=%s\n"), be.strerror(dev->dev_errno)); goto bail_out; } for (int i=0; idev_errno)); + Pmsg2(0, _("Read block %d failed! ERR=%s\n"), i, be.strerror(dev->dev_errno)); goto bail_out; } memset(rec->data, 0, rec->data_len); if (!read_record_from_block(block, rec)) { - Pmsg1(0, _("Read record failed! ERR=%s\n"), strerror(dev->dev_errno)); + berrno be; + Pmsg2(0, _("Read record failed. Block %d! ERR=%s\n"), i, be.strerror(dev->dev_errno)); goto bail_out; } p = (int *)rec->data; @@ -858,6 +865,7 @@ static int position_test() int recno = 0; int file = 0, blk = 0; int *p; + bool got_eof = false; Pmsg0(-1, _("\n=== Write, rewind, and position test ===\n\n" "I'm going to write 1000 records and an EOF\n" @@ -959,20 +967,33 @@ static int position_test() } read_again: if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) { + berrno be; if (dev_state(dev, ST_EOF)) { Pmsg0(-1, _("Got EOF on tape.\n")); - goto read_again; + if (!got_eof) { + got_eof = true; + goto read_again; + } } - Pmsg1(0, _("Read block failed! ERR=%s\n\n"), strerror(dev->dev_errno)); + Pmsg4(0, _("Read block %d failed! file=%d blk=%d. ERR=%s\n\n"), + recno, file, blk, be.strerror(dev->dev_errno)); Pmsg0(0, _("This may be because the tape drive block size is not\n" " set to variable blocking as normally used by Bacula.\n" " Please see the Tape Testing chapter in the manual and \n" - " look for using mt with defblksize and setoptions\n")); + " look for using mt with defblksize and setoptions\n" + "If your tape drive block size is correct, then perhaps\n" + " your SCSI driver is *really* stupid and does not\n" + " correctly report the file:block after a FSF. In this\n" + " case try setting:\n" + " Fast Forward Space File = no\n" + " in your Device resource.\n")); + goto bail_out; } memset(rec->data, 0, rec->data_len); if (!read_record_from_block(block, rec)) { - Pmsg1(0, _("Read record failed! ERR=%s\n"), strerror(dev->dev_errno)); + berrno be; + Pmsg1(0, _("Read record failed! ERR=%s\n"), be.strerror(dev->dev_errno)); goto bail_out; } p = (int *)rec->data; @@ -983,7 +1004,7 @@ read_again: goto bail_out; } } - Pmsg0(-1, _("Block re-read correctly.\n")); + Pmsg1(-1, _("Block %d re-read correctly.\n"), recno); } Pmsg0(-1, _("=== Test Succeeded. End Write, rewind, and re-read test ===\n\n")); stat = 1; diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index d3b36be61a..ac75f9732c 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -470,7 +470,7 @@ eod_dev(DEVICE *dev) } mt_com.mt_op = MTFSF; /* - * ***FIXEM*** fix code to handle case that INT16_MAX is + * ***FIXME*** fix code to handle case that INT16_MAX is * not large enough. */ mt_com.mt_count = INT16_MAX; /* use big positive number */ @@ -532,11 +532,13 @@ eod_dev(DEVICE *dev) if (file_num == (int)dev->file) { struct mtget mt_stat; Dmsg1(100, "fsf_dev did not advance from file %d\n", file_num); +#ifndef HAVE_OPENBSD_OS if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) { Dmsg2(100, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno); dev->file = mt_stat.mt_fileno; } +#endif stat = 0; break; /* we are not progressing, bail out */ } @@ -553,7 +555,7 @@ eod_dev(DEVICE *dev) stat = bsf_dev(dev, 1); /* If BSF worked and fileno is known (not -1), set file */ if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) { - Dmsg2(100, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno); + Dmsg2(100, "BSFATEOF 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 */ @@ -822,14 +824,14 @@ fsf_dev(DEVICE *dev, int num) Dmsg0(200, "ST_EOF set on entry to FSF\n"); } - Dmsg0(29, "fsf_dev\n"); + Dmsg0(100, "fsf_dev\n"); dev->block_num = 0; /* * If Fast forward space file is set, then we * use MTFSF to forward space and MTIOCGET * to get the file position. We assume that * the SCSI driver will ensure that we do not - * forward space over the end of data mark. + * forward space past the end of the medium. */ if (dev_cap(dev, CAP_FSF) && dev_cap(dev, CAP_FASTFSF)) { mt_com.mt_op = MTFSF; @@ -872,7 +874,7 @@ fsf_dev(DEVICE *dev, int num) mt_com.mt_op = MTFSF; mt_com.mt_count = 1; while (num-- && !(dev->state & ST_EOT)) { - Dmsg0(200, "Doing read before fsf\n"); + Dmsg0(100, "Doing read before fsf\n"); if ((stat = read(dev->fd, (char *)rbuf, rbuf_len)) < 0) { if (errno == ENOMEM) { /* tape record exceeds buf len */ stat = rbuf_len; /* This is OK */ @@ -880,21 +882,21 @@ fsf_dev(DEVICE *dev, int num) berrno be; dev->state |= ST_EOT; clrerror_dev(dev, -1); - Dmsg2(200, "Set ST_EOT read errno=%d. ERR=%s\n", dev->dev_errno, + Dmsg2(100, "Set ST_EOT read errno=%d. ERR=%s\n", dev->dev_errno, be.strerror()); Mmsg2(dev->errmsg, _("read error on %s. ERR=%s.\n"), dev->dev_name, be.strerror()); - Dmsg1(200, "%s", dev->errmsg); + Dmsg1(100, "%s", dev->errmsg); break; } } if (stat == 0) { /* EOF */ update_pos_dev(dev); - Dmsg1(200, "End of File mark from read. File=%d\n", dev->file+1); + Dmsg1(100, "End of File mark from read. File=%d\n", dev->file+1); /* Two reads of zero means end of tape */ if (dev->state & ST_EOF) { dev->state |= ST_EOT; - Dmsg0(200, "Set ST_EOT\n"); + Dmsg0(100, "Set ST_EOT\n"); break; } else { dev->state |= ST_EOF; @@ -907,17 +909,17 @@ fsf_dev(DEVICE *dev, int num) dev->state &= ~(ST_EOF|ST_EOT); } - Dmsg0(200, "Doing MTFSF\n"); + Dmsg0(100, "Doing MTFSF\n"); stat = ioctl(dev->fd, MTIOCTOP, (char *)&mt_com); if (stat < 0) { /* error => EOT */ berrno be; dev->state |= ST_EOT; - Dmsg0(200, "Set ST_EOT\n"); + Dmsg0(100, "Set ST_EOT\n"); clrerror_dev(dev, MTFSF); Mmsg2(&dev->errmsg, _("ioctl MTFSF error on %s. ERR=%s.\n"), dev->dev_name, be.strerror()); - Dmsg0(200, "Got < 0 for MTFSF\n"); - Dmsg1(200, "%s", dev->errmsg); + Dmsg0(100, "Got < 0 for MTFSF\n"); + Dmsg1(100, "%s", dev->errmsg); } else { dev->state |= ST_EOF; /* just read EOF */ dev->file++; @@ -1033,12 +1035,15 @@ fsr_dev(DEVICE *dev, int num) struct mtget mt_stat; clrerror_dev(dev, MTFSR); Dmsg1(100, "FSF fail: ERR=%s\n", be.strerror()); +#ifndef HAVE_OPENBSD_OS if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) { Dmsg4(100, "Adjust from %d:%d to %d:%d\n", dev->file, dev->block_num, mt_stat.mt_fileno, mt_stat.mt_blkno); dev->file = mt_stat.mt_fileno; dev->block_num = mt_stat.mt_blkno; - } else { + } else +#endif + { if (dev->state & ST_EOF) { dev->state |= ST_EOT; } else { @@ -1140,12 +1145,18 @@ reposition_dev(DEVICE *dev, uint32_t file, uint32_t block) if (file > dev->file) { Dmsg1(100, "fsf %d\n", file-dev->file); if (!fsf_dev(dev, file-dev->file)) { + Dmsg1(100, "fsf failed! ERR=%s\n", strerror_dev(dev)); return false; } + Dmsg2(100, "wanted_file=%d at_file=%d\n", file, dev->file); } if (block < dev->block_num) { + Dmsg2(100, "wanted_blk=%d at_blk=%d\n", block, dev->block_num); + Dmsg0(100, "bsf_dev 1\n"); bsf_dev(dev, 1); + Dmsg0(100, "fsf_dev 1\n"); fsf_dev(dev, 1); + Dmsg2(100, "wanted_blk=%d at_blk=%d\n", block, dev->block_num); } if (dev_cap(dev, CAP_POSITIONBLOCKS) && block > dev->block_num) { /* Ignore errors as Bacula can read to the correct block */