src/stored/vol_mgr.c
bool free_volume(DEVICE *dev)
{
   VOLRES *vol;

   lock_volumes();
   vol = dev->vol;
   if (vol == NULL) {
      Dmsg1(dbglvl, "No vol on dev %s\n", dev->print_name());
      unlock_volumes();
      return false;
   }
   /* Don't free a volume while it is being swapped */
   if (!vol->is_swapping()) {
      Dmsg2(dbglvl, "Clear in_use vol=%s slot=%d\n", vol->vol_name, vol->get_slot());
      dev->vol = NULL;
      if (vol->is_writing()) {
         vol_list->remove(vol);
      }
      Dmsg3(dbglvl, "Remove volume %s slot=%d dev=%s\n", vol->vol_name,
         vol->get_slot(), dev->print_name());
      free_vol_item(vol);
      debug_list_volumes("free_volume");
   } else {
      Dmsg1(dbglvl, "=== Cannot clear. Swapping vol=%s\n", vol->vol_name);
   }
   unlock_volumes();
   return true;
}
/*
 * Unconditionally release the volume entry
 * Note: read volumes are not in the list, so
 *   do not attempt to remove them.
 */
Unconditionally release the volume entry
Note: read volumes are not in the list, so
do not attempt to remove them.
Unconditionally release the volume entry Note : read volumes are not in the list so do not attempt to remove them .
bool free_volume(DEVICE *dev)
{
   VOLRES *vol;
   lock_volumes();
   vol = dev->vol;
   if (vol == NULL) {
      Dmsg1(dbglvl, "No vol on dev %s\n", dev->print_name());
      unlock_volumes();
      return false;
   }
   if (!vol->is_swapping()) {
      Dmsg2(dbglvl, "Clear in_use vol=%s slot=%d\n", vol->vol_name, vol->get_slot());
      dev->vol = NULL;
      if (vol->is_writing()) {
         vol_list->remove(vol);
      }
      Dmsg3(dbglvl, "Remove volume %s slot=%d dev=%s\n", vol->vol_name,
         vol->get_slot(), dev->print_name());
      free_vol_item(vol);
      debug_list_volumes("free_volume");
   } else {
      Dmsg1(dbglvl, "=== Cannot clear. Swapping vol=%s\n", vol->vol_name);
   }
   unlock_volumes();
   return true;
}
bool free_volume ( DEVICE * dev ) { VOLRES * vol ; lock_volumes ( ) ; vol = dev -> vol ; if ( vol == NULL ) { Dmsg1 ( dbglvl , " \n " , dev -> print_name ( ) ) ; unlock_volumes ( ) ; return false ; } if ( ! vol -> is_swapping ( ) ) { Dmsg2 ( dbglvl , " \n " , vol -> vol_name , vol -> get_slot ( ) ) ; dev -> vol = NULL ; if ( vol -> is_writing ( ) ) { vol_list -> remove ( vol ) ; } Dmsg3 ( dbglvl , " \n " , vol -> vol_name , vol -> get_slot ( ) , dev -> print_name ( ) ) ; free_vol_item ( vol ) ; debug_list_volumes ( " " ) ; } else { Dmsg1 ( dbglvl , " \n " , vol -> vol_name ) ; } unlock_volumes ( ) ; return true ; }
Unconditionally release the volume entry
 Note: read volumes are not in the list, so
   do not attempt to remove them.
Unconditionally release the volume entry Note : read volumes are not in the list so do not attempt to remove them .
/* Don't free a volume while it is being swapped */