diff --git a/src/core/partition.cpp b/src/core/partition.cpp index bb88ec5..0b4e12e 100644 --- a/src/core/partition.cpp +++ b/src/core/partition.cpp @@ -320,17 +320,7 @@ bool Partition::unmount(Report& report) while (success) { if (fileSystem().canUnmount(deviceNode())) { - success = fileSystem().unmount(deviceNode()); - if (success) - setMountPoint(QString()); - } else { - - ExternalCommand umountCmd(report, - QStringLiteral("umount"), - { QStringLiteral("--verbose"), - deviceNode() }); - if (!umountCmd.run() || umountCmd.exitCode() != 0) - success = false; + success = fileSystem().unmount(report, deviceNode()); } KMountPoint::List mountPoints = KMountPoint::currentMountPoints(KMountPoint::NeedRealDeviceName); diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 9fe2fcc..6c8eb4b 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -410,10 +410,14 @@ bool FileSystem::mount(const QString &deviceNode, const QString &mountPoint) @param mountPoint the mount point the FileSystem is mounted on @return true on success */ -bool FileSystem::unmount(const QString& mountPoint) +bool FileSystem::unmount(Report& report, const QString& deviceNode) { - Q_UNUSED(mountPoint); - + ExternalCommand umountCmd( report, + QStringLiteral("umount"), + { QStringLiteral("--verbose"), + deviceNode }); + if ( umountCmd.run() && umountCmd.exitCode() == 0 ) + return true; return false; } diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index af67f87..48c394a 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -179,14 +179,14 @@ public: return false; /**< @return true if this FileSystem can be mounted */ } virtual bool canUnmount(const QString&) const { - return false; /**< @return true if this FileSystem can be unmounted */ + return true; /**< @return true if this FileSystem can be unmounted */ } virtual QString mountTitle() const; virtual QString unmountTitle() const; virtual bool mount(const QString& deviceNode, const QString& mountPoint); - virtual bool unmount(const QString& deviceNode); + virtual bool unmount(Report& report, const QString& deviceNode); qint64 firstSector() const { return m_FirstSector; /**< @return the FileSystem's first sector */ diff --git a/src/fs/linuxswap.cpp b/src/fs/linuxswap.cpp index 9645d6b..18db682 100644 --- a/src/fs/linuxswap.cpp +++ b/src/fs/linuxswap.cpp @@ -139,9 +139,9 @@ bool linuxswap::mount(const QString& deviceNode, const QString& mountPoint) return cmd.run(-1) && cmd.exitCode() == 0; } -bool linuxswap::unmount(const QString& deviceNode) +bool linuxswap::unmount(Report& report, const QString& deviceNode) { - ExternalCommand cmd(QStringLiteral("swapoff"), { deviceNode }); + ExternalCommand cmd(report, QStringLiteral("swapoff"), { deviceNode }); return cmd.run(-1) && cmd.exitCode() == 0; } diff --git a/src/fs/linuxswap.h b/src/fs/linuxswap.h index ed647e2..5a0c8e2 100644 --- a/src/fs/linuxswap.h +++ b/src/fs/linuxswap.h @@ -56,7 +56,7 @@ public: } virtual bool mount(const QString& deviceNode, const QString& mountPoint) override; - virtual bool unmount(const QString& deviceNode) override; + virtual bool unmount(Report& report, const QString& deviceNode) override; virtual QString mountTitle() const override; virtual QString unmountTitle() const override; diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index 605ab2e..ece1529 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -403,7 +403,7 @@ bool luks::mount(const QString& deviceNode, const QString& mountPoint) return false; } -bool luks::unmount(const QString& deviceNode) +bool luks::unmount(Report& report, const QString& deviceNode) { if (!m_isCryptOpen) { @@ -427,14 +427,14 @@ bool luks::unmount(const QString& deviceNode) if (m_innerFs->canUnmount(mapperNode)) { - if (m_innerFs->unmount(mapperNode)) + if (m_innerFs->unmount(report, mapperNode)) { m_isMounted = false; return true; } } else { - ExternalCommand unmountCmd( + ExternalCommand unmountCmd( report, QStringLiteral("umount"), { QStringLiteral("--verbose"), mapperNode }); if (unmountCmd.run() && unmountCmd.exitCode() == 0) diff --git a/src/fs/luks.h b/src/fs/luks.h index 22a9d0d..a2e4edd 100644 --- a/src/fs/luks.h +++ b/src/fs/luks.h @@ -135,7 +135,7 @@ public: void createInnerFileSystem(Type type); virtual bool mount(const QString& deviceNode, const QString& mountPoint) override; - virtual bool unmount(const QString& deviceNode) override; + virtual bool unmount(Report& report, const QString& deviceNode) override; virtual FileSystem::Type type() const override;