diff options
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r-- | tdecore/tdehardwaredevices.cpp | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index bc56f8430..7fa9f3ad8 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -937,7 +937,7 @@ TQString TDEStorageDevice::mountPath() { file.close(); } - // While this device is not directly mounted, it could concievably be mounted via the Device Mapper + // While this device is not directly mounted, it could conceivably be mounted via the Device Mapper // If so, try to retrieve the mount path... TQStringList slaveDeviceList = holdingDevices(); for ( TQStringList::Iterator slavedevit = slaveDeviceList.begin(); slavedevit != slaveDeviceList.end(); ++slavedevit ) { @@ -953,7 +953,7 @@ TQString TDEStorageDevice::mountPath() { return TQString::null; } -TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions, TQString* errRet, int* retcode) { +TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOptions mountOptions, TQString* errRet, int* retcode) { int internal_retcode; if (!retcode) { retcode = &internal_retcode; @@ -969,12 +969,37 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions KTempFile passwordFile(TQString::null, "tmp", 0600); passwordFile.setAutoDelete(true); + TQString optionString; + if (mountOptions["ro"] == "true") { + optionString.append(" -r"); + } + + if (mountOptions["atime"] != "true") { + optionString.append(" -A"); + } + + if (mountOptions["utf8"] == "true") { + optionString.append(" -c utf8"); + } + + if (mountOptions["sync"] == "true") { + optionString.append(" -s"); + } + + if (mountOptions.contains("filesystem")) { + optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"])); + } + + if (mountOptions.contains("locale")) { + optionString.append(TQString(" -c %1").arg(mountOptions["locale"])); + } + TQString passFileName = passwordFile.name(); TQString devNode = deviceNode(); passFileName.replace("'", "'\\''"); devNode.replace("'", "'\\''"); mediaName.replace("'", "'\\''"); - TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); + TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { @@ -995,7 +1020,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions return ret; } -TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName, TQString mountOptions, TQString* errRet, int* retcode) { +TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName, TDEStorageMountOptions mountOptions, TQString* errRet, int* retcode) { int internal_retcode; if (!retcode) { retcode = &internal_retcode; @@ -1018,12 +1043,37 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me pwFile->writeBlock(passphrase.ascii(), passphrase.length()); pwFile->flush(); + TQString optionString; + if (mountOptions["ro"] == "true") { + optionString.append(" -r"); + } + + if (mountOptions["atime"] != "true") { + optionString.append(" -A"); + } + + if (mountOptions["utf8"] == "true") { + optionString.append(" -c utf8"); + } + + if (mountOptions["sync"] == "true") { + optionString.append(" -s"); + } + + if (mountOptions.contains("filesystem")) { + optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"])); + } + + if (mountOptions.contains("locale")) { + optionString.append(TQString(" -c %1").arg(mountOptions["locale"])); + } + TQString passFileName = passwordFile.name(); TQString devNode = deviceNode(); passFileName.replace("'", "'\\''"); devNode.replace("'", "'\\''"); mediaName.replace("'", "'\\''"); - TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); + TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { |