unbash_spaces(mediatype);
unbash_spaces(device.c_str());
unbash_spaces(volume);
+ if (is_writing_volume(volume)) {
+ dir->fsend(_("3900 Unable to set immutable flag on %s, volume still in use\n"), volume);
+ return true;
+ }
DCR *dcr = find_any_device(jcr, device, mediatype, drive);
if (dcr) {
DEVICE *dev = dcr->dev;
_dbg_list_one_device(dev, __FILE__, __LINE__)
/* From vol_mgr.c */
+bool is_writing_volume(const char *VolumeName);
void init_vol_list_lock();
void term_vol_list_lock();
VOLRES *reserve_volume(DCR *dcr, const char *VolumeName);
void create_volume_lists();
void free_volume_lists();
void list_volumes(void sendit(const char *msg, int len, void *sarg), void *arg);
-bool is_volume_in_use(DCR *dcr);
extern int vol_list_lock_count;
void add_read_volume(JCR *jcr, const char *VolumeName);
void remove_read_volume(JCR *jcr, const char *VolumeName);
return fvol != NULL;
}
+/*
+ * Check if volume name is in the read list.
+ */
+bool is_writing_volume(const char *VolumeName)
+{
+ VOLRES vol, *fvol;
+ lock_volumes();
+ vol.vol_name = bstrdup(VolumeName);
+ fvol = (VOLRES *)vol_list->binary_search(&vol, name_compare);
+ free(vol.vol_name);
+ unlock_volumes();
+ return fvol && fvol->is_writing();
+}
+
/*
* Remove a given volume name from the read list.
*/