diff --git a/src/corelib/io/qstorageinfo_linux.cpp b/src/corelib/io/qstorageinfo_linux.cpp index 7475f3d416..54b487e83f 100644 --- a/src/corelib/io/qstorageinfo_linux.cpp +++ b/src/corelib/io/qstorageinfo_linux.cpp @@ -10,24 +10,8 @@ #include #include -#if defined(Q_OS_ANDROID) -# include -# include -# define QT_STATFS ::statfs -# define QT_STATFSBUF struct statfs -# if !defined(ST_RDONLY) -# define ST_RDONLY 1 // hack for missing define on Android -# endif -#else -# include -# if defined(QT_LARGEFILE_SUPPORT) -# define QT_STATFSBUF struct statvfs64 -# define QT_STATFS ::statvfs64 -# else -# define QT_STATFSBUF struct statvfs -# define QT_STATFS ::statvfs -# endif // QT_LARGEFILE_SUPPORT -#endif +#include +#include QT_BEGIN_NAMESPACE @@ -160,9 +144,9 @@ void QStorageInfoPrivate::doStat() void QStorageInfoPrivate::retrieveVolumeInfo() { - QT_STATFSBUF statfs_buf; + struct statfs64 statfs_buf; int result; - EINTR_LOOP(result, QT_STATFS(QFile::encodeName(rootPath).constData(), &statfs_buf)); + EINTR_LOOP(result, statfs64(QFile::encodeName(rootPath).constData(), &statfs_buf)); if (result == 0) { valid = true; ready = true; @@ -171,14 +155,7 @@ void QStorageInfoPrivate::retrieveVolumeInfo() bytesFree = statfs_buf.f_bfree * statfs_buf.f_frsize; bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_frsize; blockSize = int(statfs_buf.f_bsize); - -#if defined(Q_OS_ANDROID) -#if defined(_STATFS_F_FLAGS) - readOnly = (statfs_buf.f_flags & ST_RDONLY) != 0; -#endif -#else - readOnly = (statfs_buf.f_flag & ST_RDONLY) != 0; -#endif + readOnly = (statfs_buf.f_flags & MS_RDONLY) != 0; } } diff --git a/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt b/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt index 45631c1c2c..acbd90cb45 100644 --- a/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt +++ b/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt @@ -16,4 +16,5 @@ qt_internal_add_test(tst_qstorageinfo tst_qstorageinfo.cpp LIBRARIES Qt::CorePrivate + Qt::TestPrivate ) diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index 38976d5ad1..5c375d12ef 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "private/qemulationdetector_p.h" #include @@ -148,6 +149,9 @@ void tst_QStorageInfo::currentStorage() void tst_QStorageInfo::storageList_data() { + if (QTestPrivate::isRunningArmOnX86()) + QSKIP("QEMU appears not to emulate the system calls correctly."); + QStorageInfo root = QStorageInfo::root(); QList volumes = QStorageInfo::mountedVolumes();