[*] 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, bSuccess = pSetupDiGetDeviceRegistryPropertyA(hIntDevInfo, &deviceInfoData, SPDRP_HARDWAREID, &dwDataType,
(PBYTE)szBuffer, sizeof(szBuffer), &dwRequiredSize); (PBYTE)szBuffer, sizeof(szBuffer), &dwRequiredSize);

View File

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