diff options
| author | Mark Rowe <mark@vector35.com> | 2025-08-13 18:37:18 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-08-13 19:50:14 -0700 |
| commit | 24a67b59ae9149c1c79720283c0c0f876c5dbc5c (patch) | |
| tree | 6aec6e3cff63b4547cea1632a8e8fc06e97b03d1 /view/sharedcache/core | |
| parent | a898e96134237dfd4f5e94a98ed1078d5efd2af2 (diff) | |
[DSC] Add support for DriverKit shared caches
Diffstat (limited to 'view/sharedcache/core')
| -rw-r--r-- | view/sharedcache/core/SharedCacheView.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp index 8277f887..de53827f 100644 --- a/view/sharedcache/core/SharedCacheView.cpp +++ b/view/sharedcache/core/SharedCacheView.cpp @@ -164,6 +164,7 @@ enum DSCPlatform DSCPlatformiOSSimulator = 7, DSCPlatformTVOSSimulator = 8, DSCPlatformWatchOSSimulator = 9, + DSCPlatformDriverKit = 10, DSCPlatformVisionOS = 11, // Apple Vision Pro DSCPlatformVisionOSSimulator = 12 // Apple Vision Pro Simulator }; @@ -220,6 +221,11 @@ bool SharedCacheView::Init() case DSCPlatformVisionOSSimulator: os = "ios"; break; + case DSCPlatformDriverKit: + // TODO: The same platform value is used for both macOS and iOS DriverKit shared caches. + // Until we have a way to differentiate them, default to macOS. + os = "mac"; + break; // armv7 or slide info v1 (unsupported) case DSCPlatformWatchOS: case DSCPlatformWatchOSSimulator: @@ -864,7 +870,7 @@ bool SharedCacheView::InitController() // Verify that we are not missing any entries that were stored in the metadata. // If we are that means we should alert the user that a previously associated cache entry is missing. std::set<std::string> missingCacheEntries = m_secondaryFileNames; - uint64_t expectedFileCount = 1; + std::optional<uint64_t> expectedFileCount; for (const auto& entry : sharedCacheBuilder.GetCache().GetEntries()) { missingCacheEntries.erase(entry.GetFileName()); @@ -873,21 +879,21 @@ bool SharedCacheView::InitController() if (entry.GetType() == CacheEntryType::Primary) { const auto& entryHeader = entry.GetHeader(); - // TODO: Some caches seem to have less sub caches than what we report having. - expectedFileCount += entryHeader.subCacheArrayCount; - // On older caches we don't have any sub-caches, so we want to skip alerting the user to that fact. - if (entryHeader.subCacheArrayOffset == 0) - expectedFileCount = 0; + if (expectedFileCount) + m_logger->LogWarnF("Multiple primary cache files found for '{}'.", m_primaryFileName); + + // TODO: Some caches seem to have fewer sub caches than what we report having. + expectedFileCount = 1 + entryHeader.subCacheArrayCount; } } for (const auto& missingFileName: missingCacheEntries) m_logger->LogErrorF("Secondary cache file '{}' is missing!", missingFileName); // Verify that we have the required amount of sub-caches, if not alert the user. - if (expectedFileCount == 1) - m_logger->LogWarnF("Primary cache file '{}' has no sub-caches! You are likely opening a secondary cache file instead of a primary one.", m_primaryFileName); + if (!expectedFileCount) + m_logger->LogWarnF("Did not find a primary cache file for '{}'! You are likely opening a secondary cache file instead of a primary one.", m_primaryFileName); else if (totalEntries < expectedFileCount) - m_logger->LogWarnF("Insufficient cache files in dyld header ({}/{}), loading as partial shared cache...", totalEntries, expectedFileCount); + m_logger->LogWarnF("Insufficient cache files in dyld header ({}/{}), loading as partial shared cache...", totalEntries, *expectedFileCount); } auto sharedCache = sharedCacheBuilder.Finalize(); |
