]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/autochanger.c
Add V: to bextract and bscan
[bacula/bacula] / bacula / src / stored / autochanger.c
index fbfa32a75cbea728c708e95df73b7232f094331f..a6a19870c99d6ffdf73302358d91e91f6a7caa7c 100644 (file)
@@ -89,9 +89,7 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir)
 
       /* If bad status or tape we want is not loaded, load it. */
       if (status != 0 || loaded != slot) { 
-        if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
-           offline_dev(dev);
-        }
+        offline_or_rewind_dev(dev);
         /* We are going to load a new tape, so close the device */
         force_close_dev(dev);
         if (loaded != 0) {        /* must unload drive */
@@ -130,6 +128,16 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir)
    return rtn_stat;
 }
 
+void invalidate_slot_in_catalog(JCR *jcr)
+{
+   Jmsg(jcr, M_ERROR, 0, _("Autochanger Volume \"%s\" not found in slot %d.\n"
+"    Setting slot to zero in catalog.\n"),
+       jcr->VolCatInfo.VolCatName, jcr->VolCatInfo.Slot);
+   jcr->VolCatInfo.Slot = 0; /* invalidate slot */
+   Dmsg0(200, "update vol info in mount\n");
+   dir_update_volume_info(jcr, &jcr->VolCatInfo, 1);  /* set slot */
+}
+
 /*
  * List the Volumes that are in the autoloader possibly
  *   with their barcodes.
@@ -149,9 +157,7 @@ int autochanger_list(JCR *jcr, DEVICE *dev, BSOCK *dir)
    }
 
    changer = get_pool_memory(PM_FNAME);
-   if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
-      offline_dev(dev);
-   }
+   offline_or_rewind_dev(dev);
    /* We are going to load a new tape, so close the device */
    force_close_dev(dev);
 
@@ -216,7 +222,7 @@ static char *edit_device_codes(JCR *jcr, char *omsg, char *imsg, char *cmd)
             str = "%";
            break;
          case 'a':
-           str = jcr->device->dev->dev_name;
+           str = dev_name(jcr->device->dev);
            break;
          case 'c':
            str = NPRT(jcr->device->changer_name);