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>
This commit is contained in:
parent
04ec8134e8
commit
f7716a0899
@ -59,6 +59,7 @@
|
|||||||
# include <Path.h>
|
# include <Path.h>
|
||||||
# include <Volume.h>
|
# include <Volume.h>
|
||||||
# include <VolumeRoster.h>
|
# include <VolumeRoster.h>
|
||||||
|
# include <fs_info.h>
|
||||||
# include <sys/statvfs.h>
|
# include <sys/statvfs.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/statvfs.h>
|
# include <sys/statvfs.h>
|
||||||
@ -341,9 +342,18 @@ inline bool QStorageIterator::next()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const BPath path(&directory);
|
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_rootPath = path.Path();
|
||||||
m_fileSystemType = QByteArray(); // no public API to access it
|
m_fileSystemType = QByteArray(fsInfo.fsh_name);
|
||||||
m_device = QByteArray::number(static_cast<qint32>(volume.Device()));
|
|
||||||
|
const QByteArray deviceName(fsInfo.device_name);
|
||||||
|
m_device = (deviceName.isEmpty() ? QByteArray::number(qint32(volume.Device())) : deviceName);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -444,6 +454,19 @@ static inline QString retrieveLabel(const QByteArray &device)
|
|||||||
if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device)
|
if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device)
|
||||||
return fileInfo.fileName();
|
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
|
#else
|
||||||
Q_UNUSED(device);
|
Q_UNUSED(device);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user