]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix scripts/Makefile.in missing ;\ -- thanks Martin
authorKern Sibbald <kern@sibbald.com>
Fri, 12 Nov 2004 17:37:03 +0000 (17:37 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 12 Nov 2004 17:37:03 +0000 (17:37 +0000)
- 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

bacula/scripts/.cvsignore
bacula/scripts/Makefile.in
bacula/src/stored/btape.c
bacula/src/stored/dev.c

index b0dbddcbfc66a28630227071733cdef9839a9bf7..38362e56b4409a2379ba9c8586ea8e9be15d6b2f 100644 (file)
@@ -1,3 +1,4 @@
+bacula-tray-monitor.desktop
 bacula-tray-monior.desktop
 .xvpics
 logrotate
index 6be5b38fd61b3ffeb5d70b69758583bb9bb9b65a..10f97167f73e2139dd52af79cb3eba290d1bab6f 100755 (executable)
@@ -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
index 526a778208841e5f60c587c82153892be74af25d..f1578f87466ee85fc70a6602eff76b9425aadef6 100644 (file)
@@ -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; i<len; i++) {
@@ -810,16 +813,20 @@ static int write_read_test()
    for (i=1; i<=2000; i++) {
 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 (i == 1001) {
+              goto read_again;
+           }
         }
-         Pmsg1(0, _("Read block failed! ERR=%s\n"), strerror(dev->dev_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;
index d3b36be61adc7c7c3ae7f1c8b25a4c5a856ddc0c..ac75f9732c6302805766c557005c42eba0e0df61 100644 (file)
@@ -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 */