Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstorageinfo_linux.cpp File Reference

(73003f3b41edb7f363a2492ad349899c54a2b890)

#include "qstorageinfo_linux_p.h"
#include "qdirlisting.h"
#include <private/qcore_unix_p.h>
#include <private/qtools_p.h>
#include <q20memory.h>
#include <sys/ioctl.h>
#include <sys/statfs.h>
+ Include dependency graph for qstorageinfo_linux.cpp:

Go to the source code of this file.

Macros

#define FSLABEL_MAX   256
 
#define FS_IOC_GETFSLABEL   _IOR(0x94, 49, char[FSLABEL_MAX])
 
#define ST_RDONLY   0x0001 /* mount read-only */
 

Functions

static QString decodeFsEncString (QString &&str)
 
static dev_t deviceIdForPath (const QString &device)
 
static quint64 retrieveDeviceId (const QByteArray &device, quint64 deviceId=0)
 
static QDirListing devicesByLabel ()
 
static auto retrieveLabels ()
 
static std::optional< QStringretrieveLabelViaIoctl (const QString &path)
 
static QString retrieveLabel (const QStorageInfoPrivate &d, quint64 deviceId)
 
static std::vector< MountInfoparseMountInfo (FilterMountInfo filter=FilterMountInfo::All)
 

Macro Definition Documentation

◆ FS_IOC_GETFSLABEL

#define FS_IOC_GETFSLABEL   _IOR(0x94, 49, char[FSLABEL_MAX])

Definition at line 23 of file qstorageinfo_linux.cpp.

Referenced by retrieveLabelViaIoctl().

◆ FSLABEL_MAX

#define FSLABEL_MAX   256

Definition at line 20 of file qstorageinfo_linux.cpp.

Referenced by retrieveLabelViaIoctl().

◆ ST_RDONLY

#define ST_RDONLY   0x0001 /* mount read-only */

Definition at line 28 of file qstorageinfo_linux.cpp.

Function Documentation

◆ decodeFsEncString()

static QString decodeFsEncString ( QString && str)
static

Definition at line 38 of file qstorageinfo_linux.cpp.

References QString::begin(), QString::indexOf(), out, ptr(), Q_ASSERT, Q_UNLIKELY, QString::resize(), QString::size(), and str.

Referenced by retrieveLabel(), and retrieveLabels().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deviceIdForPath()

static dev_t deviceIdForPath ( const QString & device)
inlinestatic

Definition at line 74 of file qstorageinfo_linux.cpp.

References device, and QFile::encodeName().

+ Here is the call graph for this function:

◆ devicesByLabel()

static QDirListing devicesByLabel ( )
static

Definition at line 106 of file qstorageinfo_linux.cpp.

References QDir::AllEntries, QDir::Hidden, QDir::NoDotAndDotDot, and QDir::System.

Referenced by retrieveLabel(), and retrieveLabels().

+ Here is the caller graph for this function:

◆ parseMountInfo()

static std::vector< MountInfo > parseMountInfo ( FilterMountInfo filter = FilterMountInfo::All)
static

Definition at line 182 of file qstorageinfo_linux.cpp.

References QFileDevice::close(), doParseMountInfo(), file, QFile::open(), QIODevice::readAll(), QIODeviceBase::ReadOnly, and QIODeviceBase::Text.

+ Here is the call graph for this function:

◆ retrieveDeviceId()

static quint64 retrieveDeviceId ( const QByteArray & device,
quint64 deviceId = 0 )
inlinestatic

Definition at line 82 of file qstorageinfo_linux.cpp.

References device.

Referenced by retrieveLabel(), and retrieveLabels().

+ Here is the caller graph for this function:

◆ retrieveLabel()

static QString retrieveLabel ( const QStorageInfoPrivate & d,
quint64 deviceId )
inlinestatic

Definition at line 149 of file qstorageinfo_linux.cpp.

References d, decodeFsEncString(), devicesByLabel(), QFile::encodeName(), retrieveDeviceId(), and retrieveLabelViaIoctl().

+ Here is the call graph for this function:

◆ retrieveLabels()

static auto retrieveLabels ( )
inlinestatic

Definition at line 115 of file qstorageinfo_linux.cpp.

References decodeFsEncString(), devicesByLabel(), QFile::encodeName(), and retrieveDeviceId().

+ Here is the call graph for this function:

◆ retrieveLabelViaIoctl()

static std::optional< QString > retrieveLabelViaIoctl ( const QString & path)
static

Definition at line 132 of file qstorageinfo_linux.cpp.

References QFile::encodeName(), QString::fromUtf8(), FS_IOC_GETFSLABEL, FSLABEL_MAX, and qt_safe_open().

Referenced by retrieveLabel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: