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>
This commit is contained in:
parent
0e6ee136c9
commit
da8c3e5807
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user