Repository navigation
Add macOS disk type detection via IOKit - #3231
Conversation
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughAdds disk-type support for macOS disk stores by introducing a ChangesDisk Type Detection Across Mac Implementations
Sequence Diagram(s)sequenceDiagram
participant App as Java getDisks()
participant Detect as detectDiskType()
participant IOKit as IOKit/CoreFoundation
participant Store as MacHWDiskStoreFFM/JNA
App->>Detect: request disk type for bsdName
Detect->>IOKit: query DA / IORegistry / CF properties
IOKit-->>Detect: return properties (mediumType, removable, etc.)
Detect-->>App: return "SSD"/"HDD"/"Removable"/"Unknown"
App->>Store: construct MacHWDiskStore with diskType
Store-->>App: disk object created (with diskType)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3231 +/- ##
============================================
- Coverage 63.77% 63.74% -0.03%
Complexity 73 73
============================================
Files 421 421
Lines 19358 19439 +81
Branches 3366 3390 +24
============================================
+ Hits 12346 12392 +46
- Misses 5302 5315 +13
- Partials 1710 1732 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reads IOBlockStorageDevice 'Device Characteristics' -> 'Medium Type' to detect SSD vs HDD. Also checks IOMedia 'Removable' property. Traverses IOKit hierarchy: IOMedia -> IOBlockStorageDriver -> IOBlockStorageDevice to find the Device Characteristics dictionary containing Medium Type.
13f99ee to
fdf8e4a
Compare
Summary
Follow-up to #3230 — adds macOS disk type detection for both JNA and FFM backends.
Implementation
Traverses the IOKit registry hierarchy:
IOMedia.Removableboolean propertyMedium Typecontains "Solid State" or "SSD"Medium Typecontains "Rotational"Changes
MacHWDiskStore.java: Added 5-arg constructor with diskTypeMacHWDiskStoreJNA.java: AddeddetectDiskType()using JNA IOKit bindingsMacHWDiskStoreFFM.java: AddeddetectDiskType()using FFM IOKit bindingsSummary by CodeRabbit