You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce duplication: extract IOKit iteration into template/callback pattern #3260
Mac implementations for platformExpert(), queryCompatibleStrings(), and calculateNominalFrequencies() in both MacCentralProcessorJNA and MacCentralProcessorFFM share identical algorithmic structure:
Get matching service/services by name
Iterate IORegistryEntries
Extract byte array properties
Parse and return results
The only difference is the IOKit API used (IOKitUtil/IOKit.IOIterator for JNA vs IOKitUtilFFM/oshi.ffm.mac.IOKit.IOIterator for FFM).
Estimated duplicated code: ~300 lines across Mac platform classes.
Example
Both versions iterate IOPlatformDevice entries looking for CPU nodes and extracting the "compatible" property — same logic, different API calls.
Proposal
Introduce a callback or strategy pattern (e.g., IOKitProvider interface with getMatchingService, getMatchingServices, property extraction methods) that can be injected into the common Mac base classes. The iteration logic would live once in oshi-common, with JNA and FFM each providing their IOKitProvider implementation.
Activity
Extract IOKit iteration into IOKitProvider callback pattern (#3260) (#…