src/stored/vol_mgr.c
bool volume_unused(DCR *dcr)
{
   DEVICE *dev = dcr->dev;

   if (!dev->vol) {
      Dmsg1(dbglvl, "vol_unused: no vol on %s\n", dev->print_name());
      debug_list_volumes("null vol cannot unreserve_volume");
      return false;
   }

   Dmsg2(dbglvl, "Clear in_use vol=%s slot=%d\n", dev->vol->vol_name,
         dev->vol->get_slot());
   dev->vol->clear_in_use();

   if (dev->vol->is_swapping()) {
      Dmsg1(dbglvl, "vol_unused: vol being swapped on %s\n", dev->print_name());
      debug_list_volumes("swapping vol cannot free_volume");
      return false;
   }

   /*
    * If this is a tape, we do not free the volume, rather we wait
    *  until the autoloader unloads it, or until another tape is
    *  explicitly read in this drive. This allows the SD to remember
    *  where the tapes are or last were.
    */
   Dmsg5(dbglvl, "set not reserved vol=%s slot=%d writers=%d reserves=%d dev=%s\n",
      dev->vol->vol_name, dev->vol->get_slot(), dev->num_writers,
      dev->num_reserved(), dev->print_name());
   if (dev->is_tape() || dev->is_autochanger()) {
      return true;
   } else {
      /*
       * Note, this frees the volume reservation entry, but the
       *   file descriptor remains open with the OS.
       */
      return free_volume(dev);
   }
}
/*
 * Free a Volume from the Volume list if it is no longer used
 *   Note, for tape drives we want to remember where the Volume
 *   was when last used, so rather than free the volume entry,
 *   we simply mark it "not reserved" so when the drive is really
 *   needed for another volume, we can reuse it.
 *
 *  Returns: true if the Volume found and "removed" from the list
 *           false if the Volume is not in the list or is in use
 */
Free a Volume from the Volume list if it is no longer used
Note, for tape drives we want to remember where the Volume
was when last used, so rather than free the volume entry,
we simply mark it "not reserved" so when the drive is really
needed for another volume, we can reuse it.

true if the Volume found and "removed" from the list
false if the Volume is not in the list or is in use
Free a Volume from the Volume list if it is no longer used Note for tape drives we want to remember where the Volume was when last used so rather than free the volume entry we simply mark it " not reserved " so when the drive is really needed for another volume we can reuse it . true if the Volume found and " removed " from the list false if the Volume is not in the list or is in use
bool volume_unused(DCR *dcr)
{
   DEVICE *dev = dcr->dev;
   if (!dev->vol) {
      Dmsg1(dbglvl, "vol_unused: no vol on %s\n", dev->print_name());
      debug_list_volumes("null vol cannot unreserve_volume");
      return false;
   }
   Dmsg2(dbglvl, "Clear in_use vol=%s slot=%d\n", dev->vol->vol_name,
         dev->vol->get_slot());
   dev->vol->clear_in_use();
   if (dev->vol->is_swapping()) {
      Dmsg1(dbglvl, "vol_unused: vol being swapped on %s\n", dev->print_name());
      debug_list_volumes("swapping vol cannot free_volume");
      return false;
   }
   Dmsg5(dbglvl, "set not reserved vol=%s slot=%d writers=%d reserves=%d dev=%s\n",
      dev->vol->vol_name, dev->vol->get_slot(), dev->num_writers,
      dev->num_reserved(), dev->print_name());
   if (dev->is_tape() || dev->is_autochanger()) {
      return true;
   } else {
      return free_volume(dev);
   }
}
bool volume_unused ( DCR * dcr ) { DEVICE * dev = dcr -> dev ; if ( ! dev -> vol ) { Dmsg1 ( dbglvl , " \n " , dev -> print_name ( ) ) ; debug_list_volumes ( " " ) ; return false ; } Dmsg2 ( dbglvl , " \n " , dev -> vol -> vol_name , dev -> vol -> get_slot ( ) ) ; dev -> vol -> clear_in_use ( ) ; if ( dev -> vol -> is_swapping ( ) ) { Dmsg1 ( dbglvl , " \n " , dev -> print_name ( ) ) ; debug_list_volumes ( " " ) ; return false ; } Dmsg5 ( dbglvl , " \n " , dev -> vol -> vol_name , dev -> vol -> get_slot ( ) , dev -> num_writers , dev -> num_reserved ( ) , dev -> print_name ( ) ) ; if ( dev -> is_tape ( ) || dev -> is_autochanger ( ) ) { return true ; } else { return free_volume ( dev ) ; } }
Free a Volume from the Volume list if it is no longer used
   Note, for tape drives we want to remember where the Volume
   was when last used, so rather than free the volume entry,
   we simply mark it "not reserved" so when the drive is really
   needed for another volume, we can reuse it.
Free a Volume from the Volume list if it is no longer used Note for tape drives we want to remember where the Volume was when last used so rather than free the volume entry we simply mark it " not reserved " so when the drive is really needed for another volume we can reuse it .
/*
    * If this is a tape, we do not free the volume, rather we wait
    *  until the autoloader unloads it, or until another tape is
    *  explicitly read in this drive. This allows the SD to remember
    *  where the tapes are or last were.
    */ /*
       * Note, this frees the volume reservation entry, but the
       *   file descriptor remains open with the OS.
       */