11#include <qplatformdefs.h>
17# include <sys/statvfs.h>
22inline quint64 devIdAndInodeToId(quint32 devId, quint32 inode)
29 memcpy(&res, arr,
sizeof(arr));
41 return devIdAndInodeToId(
static_cast<quint32
>(stBuf.st_dev),
42 static_cast<quint32
>(stBuf.st_ino));
46inline int statWithFsid(
const char* path, QT_STATBUF* statBuf)
48 int ret = QT_LSTAT(path, statBuf);
54 ret = statvfs(path, &fsBuf);
55 if (ret == 0 && fsBuf.f_fsid != 0) {
57 statBuf->st_dev =
static_cast<quint32
>(fsBuf.f_fsid ^ (fsBuf.f_fsid >> 32));
63inline int filePathToStat(
const QByteArray& filePath, QT_STATBUF& statBuf)
66 return statWithFsid(filePath.
constData(), &statBuf);
68 const int ret = QT_STAT(filePath.
constData(), &statBuf);
70 if (ret == 0 &&
QFileInfo(filePathStr).isSymLink()) {
71 return QT_STAT(
QFileInfo(filePathStr).symLinkTarget().toUtf8().constData(), &statBuf);
78inline quint64 filePathToId(
const QByteArray& filePath)
81 const int ret = filePathToStat(filePath, statBuf);
85inline quint32 idToInode(quint64
id)
87 quint32* arr =
reinterpret_cast<quint32*
>(&id);
91inline quint32 idToDeviceId(quint64
id)
93 quint32* arr =
reinterpret_cast<quint32*
>(&id);
97template<
typename T,
typename V>
103 const auto i(std::lower_bound(vec.begin(), vec.end(),
id));
109 if (i == vec.end() || (
id != *i))
113template<
typename T,
typename V>
114inline void sortedIdRemove(T& vec,
const V&
id)
116 const int idx = vec.indexOf(
id);
Implements storage for docIds without any associated data Instantiated for:
void sortedIdInsert(T &vec, const V &id)
quint64 statBufToId(const QT_STATBUF &stBuf)
Convert the QT_STATBUF into a 64 bit unique identifier for the file.
const char * constData() const const
QString fromUtf8(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:58 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.