unmount device as long as we find mountpoints for it, not just once

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1129201
This commit is contained in:
Volker Lanz 2010-05-21 15:29:10 +00:00
parent 2d39afad2b
commit 91b3dc546a
1 changed files with 16 additions and 6 deletions

View File

@ -32,6 +32,7 @@
#include <kdebug.h>
#include <klocale.h>
#include <kmountpoint.h>
/** Creates a new Partition object.
@param parent the Partition's parent. May be another Partition (for logicals) or a PartitionTable. Must not be NULL.
@ -308,13 +309,22 @@ bool Partition::unmount(Report& report)
bool success = true;
if (fileSystem().canUnmount(deviceNode()))
success = fileSystem().unmount(deviceNode());
else
while (success)
{
ExternalCommand umountCmd(report, "umount", QStringList() << "-v" << mountPoint());
if (!umountCmd.run() || umountCmd.exitCode() != 0)
success = false;
KMountPoint::List mountPoints = KMountPoint::currentMountPoints(KMountPoint::NeedRealDeviceName);
if (!mountPoints.findByDevice(deviceNode()))
break;
if (fileSystem().canUnmount(deviceNode()))
success = fileSystem().unmount(deviceNode());
else
{
ExternalCommand umountCmd(report, "umount", QStringList() << "-v" << deviceNode());
if (!umountCmd.run() || umountCmd.exitCode() != 0)
success = false;
}
}
setMounted(!success);