diff options
author | Pino Toscano <toscano.pino@tiscali.it> | 2015-03-24 20:17:17 +0100 |
---|---|---|
committer | Pino Toscano <toscano.pino@tiscali.it> | 2015-04-02 08:37:21 +0000 |
commit | da8c3e580764c0aadc911e26c830970be7233be0 (patch) | |
tree | 0ff7c0ea4017360316726980b3dc97ff2d528d52 /src/corelib/io | |
parent | 0e6ee136c91432d4ceeeda64e5a5fa88231398d4 (diff) |
Hurd: Implement QStorageInfo for Hurd
Make use of the Linux implementation for Hurd as well, as the mntent API
is available there too (including getmntent_r, specific to GNU libc).
Since PATH_MAX is not available on Hurd, and the current bufferSize is
a lot more larger than it is needed, restrict bufferSize to 1024 bytes,
which should be enough to cover 3 paths in mtab and it is usually used
also in other projects.
Change-Id: Ied43be2ab1eb95b48eb9f55a92064e7549efaefd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 45b32830cd..d120d7569a 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -49,7 +49,7 @@ # include <sys/mount.h> # include <sys/vfs.h> # include <mntent.h> -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) # include <mntent.h> # include <sys/statvfs.h> #elif defined(Q_OS_SOLARIS) @@ -133,7 +133,7 @@ private: QByteArray m_rootPath; QByteArray m_fileSystemType; QByteArray m_device; -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) FILE *fp; mntent mnt; QByteArray buffer; @@ -275,10 +275,11 @@ inline QByteArray QStorageIterator::device() const return m_device; } -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) static const char pathMounted[] = "/etc/mtab"; -static const int bufferSize = 3*PATH_MAX; // 2 paths (mount point+device) and metainfo +static const int bufferSize = 1024; // 2 paths (mount point+device) and metainfo; + // should be enough inline QStorageIterator::QStorageIterator() : buffer(QByteArray(bufferSize, 0)) |