]> git.sur5r.net Git - bacula/bacula/commitdiff
Make weof() and clrerror() methods of class DEVICE.
authorKern Sibbald <kern@sibbald.com>
Sun, 9 Apr 2006 12:36:15 +0000 (12:36 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 9 Apr 2006 12:36:15 +0000 (12:36 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2891 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.39
bacula/src/stored/acquire.c
bacula/src/stored/ansi_label.c
bacula/src/stored/block.c
bacula/src/stored/btape.c
bacula/src/stored/dev.c
bacula/src/stored/dev.h
bacula/src/stored/label.c
bacula/src/stored/protos.h
bacula/src/stored/stored.h

index 5f893ad4712612947a0eb989307575a9996909b2..bec71496d1e0940b667c5e2d7f3ccadf0c00ee71 100644 (file)
@@ -2,6 +2,8 @@
                         Kern Sibbald
 
 General:
+09Apr06
+- Make weof() and clrerror() methods of class DEVICE.
 08Apr06
 - Tweak license to include Microsoft restrictions.
 - Move mysql.reconnect to after real_connect().  Thanks to
index edb5f7002ed38fcc2ebcf39d860d1578329cd22f..530ada2421db45bc39e8766fa312f776db3c4013 100644 (file)
@@ -460,7 +460,7 @@ bool release_device(DCR *dcr)
          }
          /* If no more writers, write an EOF */
          if (!dev->num_writers && dev->can_write()) {
-            weof_dev(dev, 1);
+            dev->weof(1);
             write_ansi_ibm_labels(dcr, ANSI_EOF_LABEL, dev->VolHdr.VolumeName);
          }
          if (!dev->at_weot()) {
index b8e02b3a594631106535428766b97fe32a8f37d9..28fba900f77e321ece6163257208c2bf4dfaccbe 100644 (file)
@@ -10,7 +10,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2005 Kern Sibbald
+   Copyright (C) 2005-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -78,7 +78,7 @@ int read_ansi_ibm_label(DCR *dcr)
       } while (stat == -1 && errno == EINTR);
       if (stat < 0) {
          berrno be;
-         clrerror_dev(dev, -1);
+         dev->clrerror(-1);
          Dmsg1(100, "Read device got: ERR=%s\n", be.strerror());
          Mmsg2(jcr->errmsg, _("Read error on device %s in ANSI label. ERR=%s\n"),
             dev->dev_name, be.strerror());
@@ -332,7 +332,7 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
       if (stat != sizeof(label)) {
          berrno be;
          if (stat == -1) {
-            clrerror_dev(dev, -1);
+            dev->clrerror(-1);
             if (dev->dev_errno == 0) {
                dev->dev_errno = ENOSPC; /* out of space */
             }
@@ -361,7 +361,7 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
       if (stat != sizeof(label)) {
          berrno be;
          if (stat == -1) {
-            clrerror_dev(dev, -1);
+            dev->clrerror(-1);
             if (dev->dev_errno == 0) {
                dev->dev_errno = ENOSPC; /* out of space */
             }
@@ -370,14 +370,14 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
                be.strerror());
                return false;
             }
-            weof_dev(dev, 1);
+            dev->weof(1);
             return true;
          } else {
             Jmsg(jcr, M_FATAL, 0, _("Could not write ANSI HDR1 label.\n"));
             return false;
          }
       }
-      if (weof_dev(dev, 1) < 0) {
+      if (!dev->weof(1)) {
          Jmsg(jcr, M_FATAL, 0, _("Error writing EOF to tape. ERR=%s"), dev->errmsg);
          return false;
       }
index 5c023da781981437044d2059e1026258b379e3de..d9320e3e2e009bf98616b4035ee55a04905b3023 100644 (file)
@@ -477,7 +477,7 @@ bool write_block_to_dev(DCR *dcr)
        (dev->file_size+block->binbuf) >= dev->max_file_size) {
       dev->file_size = 0;             /* reset file size */
 
-      if (weof_dev(dev, 1) != 0) {            /* write eof */
+      if (!dev->weof(1)) {            /* write eof */
          Dmsg0(190, "WEOF error in max file size.\n");
          Jmsg(jcr, M_FATAL, 0, _("Unable to write EOF. ERR=%s\n"), 
             dev->bstrerror());
@@ -529,7 +529,7 @@ bool write_block_to_dev(DCR *dcr)
        */
       if (stat == -1) {
          berrno be;
-         clrerror_dev(dev, -1);
+         dev->clrerror(-1);
          if (dev->dev_errno == 0) {
             dev->dev_errno = ENOSPC;        /* out of space */
          }
@@ -685,7 +685,7 @@ static bool terminate_writing_volume(DCR *dcr)
        goto bail_out;
    }
    dcr->block->write_failed = true;
-   if (weof_dev(dev, 1) != 0) {         /* end the tape */
+   if (!dev->weof(1)) {         /* end the tape */
       dev->VolCatInfo.VolCatErrors++;
       Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing final EOF to tape. This Volume may not be readable.\n"
            "%s"), dev->errmsg);
@@ -723,7 +723,7 @@ static bool terminate_writing_volume(DCR *dcr)
    /* Set new file/block parameters for current dcr */
    set_new_file_parameters(dcr);
 
-   if (ok && dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) {  /* end the tape */
+   if (ok && dev_cap(dev, CAP_TWOEOF) && !dev->weof(1)) {  /* end the tape */
       dev->VolCatInfo.VolCatErrors++;
       /* This may not be fatal since we already wrote an EOF */
       Jmsg(dcr->jcr, M_ERROR, 0, "%s", dev->errmsg);
@@ -938,7 +938,7 @@ reread:
    } while (stat == -1 && (errno == EINTR || errno == EIO) && retry++ < 11);
    if (stat < 0) {
       berrno be;
-      clrerror_dev(dev, -1);
+      dev->clrerror(-1);
       Dmsg1(200, "Read device got: ERR=%s\n", be.strerror());
       block->read_len = 0;
       Mmsg4(dev->errmsg, _("Read error at file:blk %u:%u on device %s. ERR=%s.\n"),
index cf39e9b0ab85464360c7c25b3423f7f6f3f86b1a..59577d8b060d7a702bae5ed1a20fe284a1d2c67a 100644 (file)
@@ -433,7 +433,7 @@ static void rewindcmd()
 {
    if (!dev->rewind(dcr)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), dev->bstrerror());
-      clrerror_dev(dev, -1);
+      dev->clrerror(-1);
    } else {
       Pmsg1(0, _("Rewound %s\n"), dev->print_name());
    }
@@ -444,7 +444,7 @@ static void rewindcmd()
  */
 static void clearcmd()
 {
-   clrerror_dev(dev, -1);
+   dev->clrerror(-1);
 }
 
 /*
@@ -452,7 +452,6 @@ static void clearcmd()
  */
 static void weofcmd()
 {
-   int stat;
    int num = 1;
    if (argc > 1) {
       num = atoi(argk[1]);
@@ -461,8 +460,8 @@ static void weofcmd()
       num = 1;
    }
 
-   if ((stat = weof_dev(dev, num)) < 0) {
-      Pmsg2(0, _("Bad status from weof %d. ERR=%s\n"), stat, dev->bstrerror());
+   if (!dev->weof(num)) {
+      Pmsg1(0, _("Bad status from weof. ERR=%s\n"), dev->bstrerror());
       return;
    } else {
       if (num==1) {
@@ -1193,9 +1192,9 @@ try_again:
     * a failure.
     */
    bmicrosleep(sleep_time, 0);
-   if (!dev->rewind(dcr) || weof_dev(dev,1) < 0) {
+   if (!dev->rewind(dcr) || !dev->weof(1)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), dev->bstrerror());
-      clrerror_dev(dev, -1);
+      dev->clrerror(-1);
       Pmsg0(-1, _("\nThe test failed, probably because you need to put\n"
                 "a longer sleep time in the mtx-script in the load) case.\n"
                 "Adding a 30 second sleep and trying again ...\n"));
@@ -1205,8 +1204,8 @@ try_again:
       Pmsg1(0, _("Rewound %s\n"), dev->print_name());
    }
 
-   if ((status = weof_dev(dev, 1)) < 0) {
-      Pmsg2(0, _("Bad status from weof %d. ERR=%s\n"), status, dev->bstrerror());
+   if (!dev->weof(1)) {
+      Pmsg1(0, _("Bad status from weof. ERR=%s\n"), dev->bstrerror());
       goto bail_out;
    } else {
       Pmsg1(0, _("Wrote EOF to %s\n"), dev->print_name());
@@ -1590,7 +1589,7 @@ static void scancmd()
    for (;;) {
       if ((stat = read(dev->fd, buf, sizeof(buf))) < 0) {
          berrno be;
-         clrerror_dev(dev, -1);
+         dev->clrerror(-1);
          Mmsg2(dev->errmsg, _("read error on %s. ERR=%s.\n"),
             dev->dev_name, be.strerror());
          Pmsg2(0, _("Bad status from read %d. ERR=%s\n"), stat, dev->bstrerror());
@@ -1826,7 +1825,7 @@ static void fillcmd()
    if (!dev->rewind(dcr)) {
       Pmsg0(000, _("Rewind failed.\n"));
    }
-   if (!dev->weof()) {
+   if (!dev->weof(1)) {
       Pmsg0(000, _("Write EOF failed.\n"));
    }
    labelcmd();
@@ -1940,7 +1939,7 @@ static void fillcmd()
             strftime(buf1, sizeof(buf1), "%T", &tm);
             Pmsg1(-1, _("%s Flush block, write EOF\n"), buf1);
             flush_block(block, 0);
-            weof_dev(dev, 1);
+            dev->weof(1);
          }
 
          /* Get out after writing 10 blocks to the second tape */
index 8695fa04b89909e0ee3f80771165fa4ddb87a327..39bd3e5e505950e5e1a816b347cbb991cac12958 100644 (file)
@@ -649,7 +649,7 @@ bool DEVICE::rewind(DCR *dcr)
       for (i=max_rewind_wait; ; i -= 5) {
          if (ioctl(fd, MTIOCTOP, (char *)&mt_com) < 0) {
             berrno be;
-            clrerror_dev(this, MTREW);
+            clrerror(MTREW);
             if (i == max_rewind_wait) {
                Dmsg1(200, "Rewind error, %s. retrying ...\n", be.strerror());
             }
@@ -831,7 +831,7 @@ bool DEVICE::eod()
 
       if (ioctl(fd, MTIOCTOP, (char *)&mt_com) < 0) {
          berrno be;
-         clrerror_dev(this, mt_com.mt_op);
+         clrerror(mt_com.mt_op);
          Dmsg1(50, "ioctl error: %s\n", be.strerror());
          update_pos_dev(this);
          Mmsg2(errmsg, _("ioctl MTEOM error on %s. ERR=%s.\n"),
@@ -841,7 +841,7 @@ bool DEVICE::eod()
 
       if (!dev_get_os_pos(this, &mt_stat)) {
          berrno be;
-         clrerror_dev(this, -1);
+         clrerror(-1);
          Mmsg2(errmsg, _("ioctl MTIOCGET error on %s. ERR=%s.\n"),
             print_name(), be.strerror());
          return false;
@@ -1126,7 +1126,7 @@ bool DEVICE::offline_or_rewind()
     *  such as backspacing after writing and EOF. If it is not
     *  done, all future references to the drive get and I/O error.
     */
-      clrerror_dev(this, MTREW);
+      clrerror(MTREW);
       return rewind(NULL);
    }
 }
@@ -1178,7 +1178,7 @@ bool DEVICE::fsf(int num)
          berrno be;
          set_eot();
          Dmsg0(200, "Set ST_EOT\n");
-         clrerror_dev(this, MTFSF);
+         clrerror(MTFSF);
          Mmsg2(errmsg, _("ioctl MTFSF error on %s. ERR=%s.\n"),
             print_name(), be.strerror());
          Dmsg1(200, "%s", errmsg);
@@ -1222,7 +1222,7 @@ bool DEVICE::fsf(int num)
             } else {
                berrno be;
                set_eot();
-               clrerror_dev(this, -1);
+               clrerror(-1);
                Dmsg2(100, "Set ST_EOT read errno=%d. ERR=%s\n", dev_errno,
                   be.strerror());
                Mmsg2(errmsg, _("read error on %s. ERR=%s.\n"),
@@ -1254,7 +1254,7 @@ bool DEVICE::fsf(int num)
             berrno be;
             set_eot();
             Dmsg0(100, "Set ST_EOT\n");
-            clrerror_dev(this, MTFSF);
+            clrerror(MTFSF);
             Mmsg2(errmsg, _("ioctl MTFSF error on %s. ERR=%s.\n"),
                print_name(), be.strerror());
             Dmsg0(100, "Got < 0 for MTFSF\n");
@@ -1323,7 +1323,7 @@ bool DEVICE::bsf(int num)
    stat = ioctl(fd, MTIOCTOP, (char *)&mt_com);
    if (stat < 0) {
       berrno be;
-      clrerror_dev(this, MTBSF);
+      clrerror(MTBSF);
       Mmsg2(errmsg, _("ioctl MTBSF error on %s. ERR=%s.\n"),
          print_name(), be.strerror());
    }
@@ -1367,7 +1367,7 @@ bool DEVICE::fsr(int num)
    } else {
       berrno be;
       struct mtget mt_stat;
-      clrerror_dev(this, MTFSR);
+      clrerror(MTFSR);
       Dmsg1(100, "FSF fail: ERR=%s\n", be.strerror());
       if (dev_get_os_pos(this, &mt_stat)) {
          Dmsg4(100, "Adjust from %d:%d to %d:%d\n", file,
@@ -1422,7 +1422,7 @@ bool DEVICE::bsr(int num)
    stat = ioctl(fd, MTIOCTOP, (char *)&mt_com);
    if (stat < 0) {
       berrno be;
-      clrerror_dev(this, MTBSR);
+      clrerror(MTBSR);
       Mmsg2(errmsg, _("ioctl MTBSR error on %s. ERR=%s.\n"),
          print_name(), be.strerror());
    }
@@ -1495,50 +1495,49 @@ bool DEVICE::reposition(uint32_t rfile, uint32_t rblock)
 
 /*
  * Write an end of file on the device
- *   Returns: 0 on success
- *            non-zero on failure
+ *   Returns: true on success
+ *            false on failure
  */
-int
-weof_dev(DEVICE *dev, int num)
+bool DEVICE::weof(int num)
 {
    struct mtop mt_com;
    int stat;
    Dmsg0(129, "weof_dev\n");
    
-   if (dev->fd < 0) {
-      dev->dev_errno = EBADF;
-      Mmsg0(dev->errmsg, _("Bad call to weof_dev. Device not open\n"));
-      Emsg0(M_FATAL, 0, dev->errmsg);
-      return -1;
+   if (fd < 0) {
+      dev_errno = EBADF;
+      Mmsg0(errmsg, _("Bad call to weof_dev. Device not open\n"));
+      Emsg0(M_FATAL, 0, errmsg);
+      return false;
    }
-   dev->file_size = 0;
+   file_size = 0;
 
-   if (!dev->is_tape()) {
-      return 0;
+   if (!is_tape()) {
+      return true;
    }
-   if (!dev->can_append()) {
-      Mmsg0(dev->errmsg, _("Attempt to WEOF on non-appendable Volume\n"));
-      Emsg0(M_FATAL, 0, dev->errmsg);
-      return -1;
+   if (!can_append()) {
+      Mmsg0(errmsg, _("Attempt to WEOF on non-appendable Volume\n"));
+      Emsg0(M_FATAL, 0, errmsg);
+      return false;
    }
       
-   dev->state &= ~(ST_EOT | ST_EOF);  /* remove EOF/EOT flags */
+   state &= ~(ST_EOT | ST_EOF);  /* remove EOF/EOT flags */
    mt_com.mt_op = MTWEOF;
    mt_com.mt_count = num;
-   stat = ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
+   stat = ioctl(fd, MTIOCTOP, (char *)&mt_com);
    if (stat == 0) {
-      dev->block_num = 0;
-      dev->file += num;
-      dev->file_addr = 0;
+      block_num = 0;
+      file += num;
+      file_addr = 0;
    } else {
       berrno be;
-      clrerror_dev(dev, MTWEOF);
+      clrerror(MTWEOF);
       if (stat == -1) {
-         Mmsg2(dev->errmsg, _("ioctl MTWEOF error on %s. ERR=%s.\n"),
-            dev->print_name(), be.strerror());
+         Mmsg2(errmsg, _("ioctl MTWEOF error on %s. ERR=%s.\n"),
+            print_name(), be.strerror());
        }
    }
-   return stat;
+   return stat == 0;
 }
 
 
@@ -1546,19 +1545,18 @@ weof_dev(DEVICE *dev, int num)
  * If implemented in system, clear the tape
  * error status.
  */
-void
-clrerror_dev(DEVICE *dev, int func)
+void DEVICE::clrerror(int func)
 {
    const char *msg = NULL;
    struct mtget mt_stat;
    char buf[100];
 
-   dev->dev_errno = errno;         /* save errno */
+   dev_errno = errno;         /* save errno */
    if (errno == EIO) {
-      dev->VolCatInfo.VolCatErrors++;
+      VolCatInfo.VolCatErrors++;
    }
 
-   if (!dev->is_tape()) {
+   if (!is_tape()) {
       return;
    }
    if (errno == ENOTTY || errno == ENOSYS) { /* Function not implemented */
@@ -1568,29 +1566,29 @@ clrerror_dev(DEVICE *dev, int func)
          break;
       case MTWEOF:
          msg = "WTWEOF";
-         dev->capabilities &= ~CAP_EOF; /* turn off feature */
+         capabilities &= ~CAP_EOF; /* turn off feature */
          break;
 #ifdef MTEOM
       case MTEOM:
          msg = "WTEOM";
-         dev->capabilities &= ~CAP_EOM; /* turn off feature */
+         capabilities &= ~CAP_EOM; /* turn off feature */
          break;
 #endif
       case MTFSF:
          msg = "MTFSF";
-         dev->capabilities &= ~CAP_FSF; /* turn off feature */
+         capabilities &= ~CAP_FSF; /* turn off feature */
          break;
       case MTBSF:
          msg = "MTBSF";
-         dev->capabilities &= ~CAP_BSF; /* turn off feature */
+         capabilities &= ~CAP_BSF; /* turn off feature */
          break;
       case MTFSR:
          msg = "MTFSR";
-         dev->capabilities &= ~CAP_FSR; /* turn off feature */
+         capabilities &= ~CAP_FSR; /* turn off feature */
          break;
       case MTBSR:
          msg = "MTBSR";
-         dev->capabilities &= ~CAP_BSR; /* turn off feature */
+         capabilities &= ~CAP_BSR; /* turn off feature */
          break;
       case MTREW:
          msg = "MTREW";
@@ -1610,19 +1608,39 @@ clrerror_dev(DEVICE *dev, int func)
          msg = "MTSRSZ";
          break;
 #endif
+#ifdef MTLOAD
+      case MTLOAD:
+         msg = "MTLOAD";
+         break;
+#endif
+#ifdef MTUNLOCK
+      case MTUNLOCK:
+         msg = "MTUNLOCK";
+         break;
+#endif
+      case MTOFFL:
+         msg = "MTOFFL";
+         break;
       default:
          bsnprintf(buf, sizeof(buf), _("unknown func code %d"), func);
          msg = buf;
          break;
       }
       if (msg != NULL) {
-         dev->dev_errno = ENOSYS;
-         Mmsg1(dev->errmsg, _("I/O function \"%s\" not supported on this device.\n"), msg);
-         Emsg0(M_ERROR, 0, dev->errmsg);
+         dev_errno = ENOSYS;
+         Mmsg1(errmsg, _("I/O function \"%s\" not supported on this device.\n"), msg);
+         Emsg0(M_ERROR, 0, errmsg);
       }
    }
+
+   /*
+    * Now we try different methods of clearing the error
+    *  status on the drive so that it is not locked for
+    *  further operations.
+    */
+
    /* On some systems such as NetBSD, this clears all errors */
-   ioctl(dev->fd, MTIOCGET, (char *)&mt_stat);
+   ioctl(fd, MTIOCGET, (char *)&mt_stat);
 
 /* Found on Linux */
 #ifdef MTIOCLRERR
@@ -1631,7 +1649,7 @@ clrerror_dev(DEVICE *dev, int func)
    mt_com.mt_op = MTIOCLRERR;
    mt_com.mt_count = 1;
    /* Clear any error condition on the tape */
-   ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
+   ioctl(fd, MTIOCTOP, (char *)&mt_com);
    Dmsg0(200, "Did MTIOCLRERR\n");
 }
 #endif
@@ -1641,9 +1659,9 @@ clrerror_dev(DEVICE *dev, int func)
 {
    /* Read and clear SCSI error status */
    union mterrstat mt_errstat;
-   Dmsg2(200, "Doing MTIOCERRSTAT errno=%d ERR=%s\n", dev->dev_errno,
-      strerror(dev->dev_errno));
-   ioctl(dev->fd, MTIOCERRSTAT, (char *)&mt_errstat);
+   Dmsg2(200, "Doing MTIOCERRSTAT errno=%d ERR=%s\n", dev_errno,
+      strerror(dev_errno));
+   ioctl(fd, MTIOCERRSTAT, (char *)&mt_errstat);
 }
 #endif
 
@@ -1654,7 +1672,7 @@ clrerror_dev(DEVICE *dev, int func)
    mt_com.mt_op = MTCSE;
    mt_com.mt_count = 1;
    /* Clear any error condition on the tape */
-   ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
+   ioctl(fd, MTIOCTOP, (char *)&mt_com);
    Dmsg0(200, "Did MTCSE\n");
 }
 #endif
@@ -2080,7 +2098,7 @@ void set_os_device_parameters(DEVICE *dev)
       mt_com.mt_op = MTSETBLK;
       mt_com.mt_count = 0;
       if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
-         clrerror_dev(dev, MTSETBLK);
+         dev->clrerror(MTSETBLK);
       }
       mt_com.mt_op = MTSETDRVBUFFER;
       mt_com.mt_count = MT_ST_CLEARBOOLEANS;
@@ -2091,7 +2109,7 @@ void set_os_device_parameters(DEVICE *dev)
          mt_com.mt_count |= MT_ST_FAST_MTEOM;
       }
       if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
-         clrerror_dev(dev, MTSETBLK);
+         dev->clrerror(MTSETBLK);
       }
    }
    return;
@@ -2104,13 +2122,13 @@ void set_os_device_parameters(DEVICE *dev)
       mt_com.mt_op = MTSETBSIZ;
       mt_com.mt_count = 0;
       if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
-         clrerror_dev(dev, MTSETBSIZ);
+         dev->clrerror(MTSETBSIZ);
       }
       /* Get notified at logical end of tape */
       mt_com.mt_op = MTEWARN;
       mt_com.mt_count = 1;
       if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
-         clrerror_dev(dev, MTEWARN);
+         dev->clrerror(MTEWARN);
       }
    }
    return;
@@ -2123,7 +2141,7 @@ void set_os_device_parameters(DEVICE *dev)
       mt_com.mt_op = MTSETBSIZ;
       mt_com.mt_count = 0;
       if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
-         clrerror_dev(dev, MTSETBSIZ);
+         dev->clrerror(MTSETBSIZ);
       }
    }
    return;
@@ -2136,7 +2154,7 @@ void set_os_device_parameters(DEVICE *dev)
       mt_com.mt_op = MTSRSZ;
       mt_com.mt_count = 0;
       if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
-         clrerror_dev(dev, MTSRSZ);
+         dev->clrerror(MTSRSZ);
       }
    }
    return;
index 72a960704401acd6e0bbacb0c510f09d7380c625..4ca8fb6da7d3f797298538bf6c97084d5b0130dd 100644 (file)
@@ -182,8 +182,6 @@ typedef struct s_steal_lock {
 } bsteal_lock_t;
 
 struct DEVRES;                        /* Device resource defined in stored_conf.h */
-int      weof_dev(DEVICE *dev, int num);
-bool     rewind_dev(DEVICE *dev);
 
 class DCR; /* forward reference */
 /*
@@ -308,7 +306,6 @@ public:
                     (dev_blocked == BST_UNMOUNTED ||
                      dev_blocked == BST_WAITING_FOR_SYSOP ||
                      dev_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP); };
-   bool weof() { return !weof_dev(this, 1); };
    const char *strerror() const;
    const char *archive_name() const;
    const char *name() const;
@@ -359,8 +356,10 @@ public:
    bool fsr(int num);            /* in dev.c */
    bool fsf(int num);            /* in dev.c */
    bool bsr(int num);            /* in dev.c */
+   bool weof(int num);           /* in dev.c */
    bool scan_dir_for_volume(DCR *dcr); /* in scan.c */
    bool reposition(uint32_t rfile, uint32_t rblock); /* in dev.c */
+   void clrerror(int func);     /* in dev.c */
 
    void set_blocked(int block) { dev_blocked = block; };
    int  get_blocked() const { return dev_blocked; };
index 612c2b4b97a006f37f42662f464b238f4ff9855d..2f8a4228e4effd5f1e0afa542997cf9794fc520b 100644 (file)
@@ -351,7 +351,7 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, const char *Po
    }
    Dmsg0(99, " Wrote block to device\n");
 
-   if (weof_dev(dev, 1) == 0) {
+   if (dev->weof(1)) {
       dev->set_labeled();
       write_ansi_ibm_labels(dcr, ANSI_EOF_LABEL, dev->VolHdr.VolumeName);
    }
index 42b24ba0500380554d28171dba53f895638ed353..31624d617bdb4852e99baf5c716c260beb6c9d9a 100644 (file)
@@ -89,10 +89,8 @@ void     term_dev(DEVICE *dev);
 char *   strerror_dev(DEVICE *dev);
 void     clrerror_dev(DEVICE *dev, int func);
 bool     update_pos_dev(DEVICE *dev);
-bool     rewind_dev(DEVICE *dev);
 bool     load_dev(DEVICE *dev);
 int      flush_dev(DEVICE *dev);
-int      weof_dev(DEVICE *dev, int num);
 int      write_block(DEVICE *dev);
 uint32_t status_dev(DEVICE *dev);
 bool     eod_dev(DEVICE *dev);
index f55aa444040f45ea44f2dcb05a5d349c72d07dc7..7ae3dffe94bb217736d034cd6bc72a4d2963a2a3 100644 (file)
@@ -66,9 +66,4 @@ extern bool forge_on;                 /* proceed inspite of I/O errors */
 extern pthread_mutex_t device_release_mutex;
 extern pthread_cond_t wait_device_release; /* wait for any device to be released */                           
 
-#ifdef debug_tracing
-extern int _rewind_dev(char *file, int line, DEVICE *dev);
-#define rewind_dev(d) _rewind_dev(__FILE__, __LINE__, (d))
-#endif
-
 #endif /* __STORED_H_ */