[*] Win32: added nvme pcie check under fs devices

This commit is contained in:
Reece Wilson 2024-07-12 16:21:39 +01:00
parent d9230ec9c3
commit 2b2f5c3d23
2 changed files with 17 additions and 17 deletions

View File

@ -568,6 +568,11 @@ namespace Aurora::IO::FS
}
}
if (AuCodepointsToLower(device.devicePath).find("ven_nvme") != AuString::npos)
{
device.bus = EFSBusType::eBusNVMePCIe;
}
bSuccess = pSetupDiGetDeviceRegistryPropertyA(hIntDevInfo, &deviceInfoData, SPDRP_HARDWAREID, &dwDataType,
(PBYTE)szBuffer, sizeof(szBuffer), &dwRequiredSize);

View File

@ -41,7 +41,8 @@ namespace Aurora::IO::FS
AUKN_SYM AuResult<FSDevice> GetFSDeviceByFilePath(const AuString &path)
{
AuList<AuPair<AuUInt, const FSDevice *>> devs;
AuPair<AuUInt, const FSDevice *> lastDev =
AuMakePair<AuUInt, const FSDevice *>(0, nullptr);
InitPlatformFSCacheAtLoad();
@ -51,37 +52,31 @@ namespace Aurora::IO::FS
return {};
}
{
AU_LOCK_GUARD(gFSDirMutex);
for (const auto &refFSDevice : gCachedDevices)
{
for (const auto &refPart : refFSDevice.partitions) // todo sort
for (const auto &refPart : refFSDevice.partitions)
{
for (const auto &refMnt : refPart.filesystemMountPoints) // todo sort
for (const auto &refMnt : refPart.filesystemMountPoints)
{
if (AuStartsWith(path, refMnt))
{
devs.push_back(AuMakePair(refMnt.size(), &refFSDevice));
if (AuGet<0>(lastDev) < refMnt.size())
{
lastDev = AuMakePair(refMnt.size(), &refFSDevice);
}
}
}
}
}
if (devs.empty())
if (AuGet<0>(lastDev) == 0)
{
return {};
}
std::sort(devs.begin(),
devs.end(),
[](AuPair<AuUInt, const FSDevice *> a, AuPair<AuUInt, const FSDevice *> b)
{
return AuGet<0>(a) > AuGet<0>(b);
});
auto copy = AuGet<1>(devs[0]);
auto copy = *AuGet<1>(lastDev);
return AuMove(copy);
}