]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add ioctl(MTIOCGET) call to clrerror_dev() in dev.c. As reported
authorKern Sibbald <kern@sibbald.com>
Tue, 21 Sep 2004 09:47:13 +0000 (09:47 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 21 Sep 2004 09:47:13 +0000 (09:47 +0000)
  by Frank Kardel, this should clear error conditions on NetBSD.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1604 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/dev.c

index b81b745e52eb8d63e119804366667dfec9d72b02..d446b8c4379a598b2cb366d2eaa2b3a8d43ea5a5 100644 (file)
@@ -1185,6 +1185,7 @@ void
 clrerror_dev(DEVICE *dev, int func)
 {
    const char *msg = NULL;
+   struct mtget mt_stat;
 
    dev->dev_errno = errno;        /* save errno */
    if (errno == EIO) {
@@ -1235,6 +1236,9 @@ clrerror_dev(DEVICE *dev, int func)
         Emsg0(M_ERROR, 0, dev->errmsg);
       }
    }
+   /* On some systems such as NetBSD, this clears all errors */
+   ioctl(dev->fd, MTIOCGET, (char *)&mt_stat);     
+
 /* Found on Linux */
 #ifdef MTIOCLRERR
 {
@@ -1427,47 +1431,6 @@ term_dev(DEVICE *dev)
    }
 }
 
-#ifdef xxxx
-/*
- * We attach a jcr to the device so that when
- *   the Volume is full during writing, a  
- *   JobMedia record will be created for this 
- *   Job.
- */
-void attach_jcr_to_device(DEVICE *dev, JCR *jcr)
-{
-   jcr->prev_dev = (JCR *)NULL;
-   jcr->next_dev = dev->attached_jcrs;
-   if (dev->attached_jcrs) {
-      dev->attached_jcrs->prev_dev = jcr;
-   }
-   dev->attached_jcrs = jcr;
-   Dmsg1(100, "Attached Job %s\n", jcr->Job);
-}
-
-void detach_jcr_from_device(DEVICE *dev, JCR *jcr)
-{
-   if (!jcr->prev_dev) {
-      dev->attached_jcrs = jcr->next_dev;
-   } else {
-      jcr->prev_dev->next_dev = jcr->next_dev;
-   }
-   if (jcr->next_dev) {
-      jcr->next_dev->prev_dev = jcr->prev_dev; 
-   }
-   jcr->next_dev = jcr->prev_dev = NULL;
-   Dmsg1(100, "Detached Job %s\n", jcr->Job);
-}
-
-JCR *next_attached_jcr(DEVICE *dev, JCR *jcr)
-{
-   if (jcr == (JCR *)NULL) {
-      return dev->attached_jcrs;
-   }
-   return jcr->next_dev;
-}
-#endif
-
 /*
  * This routine initializes the device wait timers
  */