]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/mount.c
kes Define a machine dependent ioctl request type for use with
[bacula/bacula] / bacula / src / stored / mount.c
index c7f5eda63a7ae0dca63113acb17af017c86fd955..efb76029d654fc00e9150ee54c23ea5754589972 100644 (file)
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -113,7 +113,9 @@ mount_next_vol:
       ask = true;                     /* ask operator to mount tape */
       do_find = true;                 /* re-find a volume after unload */
    }
-   do_swapping(true /*writing*/);
+   do_unload();
+   do_swapping(true /*is_writing*/);
+   do_load(true /*is_writing*/);
 
    if (do_find && !find_a_volume()) {
       goto no_lock_bail_out;
@@ -142,7 +144,7 @@ mount_next_vol:
    } else {
       autochanger = false;
       VolCatInfo.Slot = 0;
-      ask = true;
+      ask = retry >= 2;
    }
    Dmsg1(150, "autoload_dev returns %d\n", autochanger);
    /*
@@ -500,12 +502,30 @@ bool DCR::is_suitable_volume_mounted()
    return dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE);
 }
 
-void DCR::do_swapping(bool is_writing)
+bool DCR::do_unload()
 {
    if (dev->must_unload()) {
       Dmsg1(100, "must_unload release %s\n", dev->print_name());
       release_volume();
    }
+   return false;
+}
+
+bool DCR::do_load(bool is_writing)
+{
+   if (dev->must_load()) {
+      Dmsg1(100, "Must load %s\n", dev->print_name());
+      if (autoload_device(this, is_writing, NULL) > 0) {
+         dev->clear_load();
+         return true;
+      }
+      return false;
+   }
+   return true;
+}
+
+void DCR::do_swapping(bool is_writing)
+{
    /*
     * See if we are asked to swap the Volume from another device
     *  if so, unload the other device here, and attach the
@@ -528,12 +548,6 @@ void DCR::do_swapping(bool is_writing)
       }
       dev->swap_dev = NULL;
    }
-   if (dev->must_load()) {
-      Dmsg1(100, "Must load %s\n", dev->print_name());
-      if (autoload_device(this, is_writing, NULL) > 0) {
-         dev->clear_load();
-      }
-   }
 }