summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig@kdab.com>2015-02-16 15:00:53 +0000
committerTobias Koenig <tobias.koenig@kdab.com>2015-02-20 18:05:20 +0000
commitf7716a0899fba150fcde29f5b03da06dd284c6be (patch)
tree2b8524806d119bcaca555137243c9696e033ceb2 /src/corelib
parent04ec8134e8b001ec2c853a75b581a9d5387c85e6 (diff)
Haiku: Extend QStorageInfo implementation
Provide the file system type, the name (label) of the volume and the path to the associated device (if available). Change-Id: I7dd0d314d3f757e0f57c8f82beaf8ee21da86167 Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index 667301b516..7e23ac897d 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -59,6 +59,7 @@
# include <Path.h>
# include <Volume.h>
# include <VolumeRoster.h>
+# include <fs_info.h>
# include <sys/statvfs.h>
#else
# include <sys/statvfs.h>
@@ -341,9 +342,18 @@ inline bool QStorageIterator::next()
return false;
const BPath path(&directory);
+
+ fs_info fsInfo;
+ memset(&fsInfo, 0, sizeof(fsInfo));
+
+ if (fs_stat_dev(volume.Device(), &fsInfo) != 0)
+ return false;
+
m_rootPath = path.Path();
- m_fileSystemType = QByteArray(); // no public API to access it
- m_device = QByteArray::number(static_cast<qint32>(volume.Device()));
+ m_fileSystemType = QByteArray(fsInfo.fsh_name);
+
+ const QByteArray deviceName(fsInfo.device_name);
+ m_device = (deviceName.isEmpty() ? QByteArray::number(qint32(volume.Device())) : deviceName);
return true;
}
@@ -444,6 +454,19 @@ static inline QString retrieveLabel(const QByteArray &device)
if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device)
return fileInfo.fileName();
}
+#elif defined Q_OS_HAIKU
+ fs_info fsInfo;
+ memset(&fsInfo, 0, sizeof(fsInfo));
+
+ int32 pos = 0;
+ dev_t dev;
+ while ((dev = next_dev(&pos)) >= 0) {
+ if (fs_stat_dev(dev, &fsInfo) != 0)
+ continue;
+
+ if (qstrcmp(fsInfo.device_name, device.constData()) == 0)
+ return QString::fromLocal8Bit(fsInfo.volume_name);
+ }
#else
Q_UNUSED(device);
#endif