From b50e60b53eed5406d2a773bb723adbd20bb331d7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 16 Jul 2007 14:14:13 +0000 Subject: [PATCH] kes Add ability to mount and unmount a file device providing it is marked as being removable and has the appropriate mount and unmount commands defined in the Device resource. This fixes bug #830. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5187 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dev.h | 1 + bacula/src/stored/dircmd.c | 8 ++++---- bacula/src/version.h | 4 ++-- bacula/technotes-2.1 | 3 +++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 37dc0ddc4f..5babdf67b2 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -281,6 +281,7 @@ public: int is_offline() const { return state & ST_OFFLINE; } int is_labeled() const { return state & ST_LABEL; } int is_mounted() const { return state & ST_MOUNTED; } + int is_unmountable() const { return (is_dvd() || (is_file() && is_removable())); } int is_part_spooled() const { return state & ST_PART_SPOOLED; } int have_media() const { return state & ST_MEDIA; } int is_short_block() const { return state & ST_SHORT; } diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 1c31bf233a..cb99f95bef 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -735,7 +735,7 @@ static bool mount_cmd(JCR *jcr) "If this is not a blank tape, try unmounting and remounting the Volume.\n"), dev->print_name()); } - } else if (dev->is_dvd()) { + } else if (dev->is_unmountable()) { if (dev->mount(1)) { bnet_fsend(dir, _("3002 Device %s is mounted.\n"), dev->print_name()); @@ -785,7 +785,7 @@ static bool unmount_cmd(JCR *jcr) if (!dev->is_busy()) { unload_autochanger(dcr, -1); } - if (dev->is_dvd()) { + if (dev->is_unmountable()) { if (dev->unmount(0)) { bnet_fsend(dir, _("3002 Device %s unmounted.\n"), dev->print_name()); @@ -804,7 +804,7 @@ static bool unmount_cmd(JCR *jcr) /* ***FIXME**** what is this ???? */ dev->close(); } - if (dev->is_dvd() && !dev->unmount(0)) { + if (dev->is_unmountable() && !dev->unmount(0)) { bnet_fsend(dir, _("3907 %s"), dev->bstrerror()); } else { dev->set_blocked(BST_UNMOUNTED_WAITING_FOR_SYSOP); @@ -835,7 +835,7 @@ static bool unmount_cmd(JCR *jcr) if (!unload_autochanger(dcr, -1)) { dev->close(); } - if (dev->is_dvd() && !dev->unmount(0)) { + if (dev->is_unmountable() && !dev->unmount(0)) { bnet_fsend(dir, _("3907 %s"), dev->bstrerror()); } else { bnet_fsend(dir, _("3002 Device %s unmounted.\n"), diff --git a/bacula/src/version.h b/bacula/src/version.h index fea4a0e17c..c05ba6a53f 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.27" -#define BDATE "14 July 2007" -#define LSMDATE "14Jul07" +#define BDATE "16 July 2007" +#define LSMDATE "16Jul07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index d5c17e5134..0f70d18a46 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,9 @@ General: 16Jul07 +kes Add ability to mount and unmount a file device providing it is + marked as being removable and has the appropriate mount and unmount + commands defined in the Device resource. This fixes bug #830. kes When applying a storage override, release all previous storage definitions rather than just prepending the new storage. This should prevent a good deal of confusion. -- 2.39.5