QStorageInfoPrivate/Linux: de-duplicate some code
Change-Id: Ie0fe0c80a61c123c12242f24830ca622a726d7ac Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e34c2429c8
commit
b13c46d6ef
@ -229,11 +229,9 @@ quint64 QStorageInfoPrivate::initRootPath()
|
|||||||
for (auto it = infos.rbegin(); it != infos.rend(); ++it) {
|
for (auto it = infos.rbegin(); it != infos.rend(); ++it) {
|
||||||
if (rootPathDevId != it->stDev || !isParentOf(it->mountPoint, oldRootPath))
|
if (rootPathDevId != it->stDev || !isParentOf(it->mountPoint, oldRootPath))
|
||||||
continue;
|
continue;
|
||||||
rootPath = std::move(it->mountPoint);
|
auto stDev = it->stDev;
|
||||||
device = std::move(it->device);
|
setFromMountInfo(std::move(*it));
|
||||||
fileSystemType = std::move(it->fsType);
|
return stDev;
|
||||||
subvolume = std::move(it->fsRoot);
|
|
||||||
return it->stDev;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -67,13 +67,20 @@ public:
|
|||||||
QByteArray fsRoot;
|
QByteArray fsRoot;
|
||||||
dev_t stDev = 0;
|
dev_t stDev = 0;
|
||||||
};
|
};
|
||||||
QStorageInfoPrivate(MountInfo &&info)
|
|
||||||
: rootPath(std::move(info.mountPoint)),
|
void setFromMountInfo(MountInfo &&info)
|
||||||
device(std::move(info.device)),
|
|
||||||
subvolume(std::move(info.fsRoot)),
|
|
||||||
fileSystemType(std::move(info.fsType))
|
|
||||||
{
|
{
|
||||||
|
rootPath = std::move(info.mountPoint);
|
||||||
|
fileSystemType = std::move(info.fsType);
|
||||||
|
device = std::move(info.device);
|
||||||
|
subvolume = std::move(info.fsRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStorageInfoPrivate(MountInfo &&info)
|
||||||
|
{
|
||||||
|
setFromMountInfo(std::move(info));
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(Q_OS_UNIX)
|
#elif defined(Q_OS_UNIX)
|
||||||
void initRootPath();
|
void initRootPath();
|
||||||
void retrieveVolumeInfo();
|
void retrieveVolumeInfo();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user