Skip to content

Move shared Unix drivers to oshi.driver.common.unix.* - #3351

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:move-shared-unix-drivers-to-common
Jun 7, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:move-shared-unix-drivers-to-common

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Sweeps the older Unix ports to match the AIX convention established in #3350. The shared (oshi-common) drivers for BSD, FreeBSD, and Solaris were sitting at the top-level oshi.driver.unix.<os> namespace, which worked only because the JNA-only drivers in oshi-core happened to live in disjoint sub-packages (e.g. oshi-core's oshi.driver.unix.solaris holds PsInfo/Who, oshi-common's oshi.driver.unix.solaris.disk holds Iostat/Lshal/Prtvtoc — different Java packages, no split). The new convention puts every oshi-common driver under oshi.driver.common.unix.<os>[.sub], mirroring oshi.driver.common.mac and oshi.driver.common.windows.* and avoiding the top-level-namespace-shared-across-modules fragility.

Moves

In oshi-common/src/main/java:

  • oshi.driver.unix.bsd.Systat → oshi.driver.common.unix.bsd.Systat
  • oshi.driver.unix.bsd.disk.Disklabel → oshi.driver.common.unix.bsd.disk.Disklabel
  • oshi.driver.unix.freebsd.disk.{GeomDiskList,GeomPartList,Mount} → oshi.driver.common.unix.freebsd.disk.*
  • oshi.driver.unix.solaris.disk.{Iostat,Lshal,Prtvtoc} → oshi.driver.common.unix.solaris.disk.*

Tests follow their drivers under oshi-common/src/test/java/oshi/driver/common/unix/....

Updated

  • Consumer imports in 8 hardware classes across oshi-common, oshi-core, and oshi-core-ffm (the FreeBSD/OpenBSD/NetBSD/Solaris HWDiskStore / Sensors / PowerSource peers, both JNA and FFM).
  • oshi-common/src/main/java/module-info.java exports: the four old oshi.driver.unix.* entries replaced by their oshi.driver.common.unix.* equivalents, sorted alphabetically.
  • oshi-common/src/test/java/module-info.test --add-opens directives: matching package renames so JUnit Platform can still introspect each test class.
  • oshi-core/pom.xml and oshi-core-ffm/pom.xml bnd Export-Package globs: the moved packages are now covered by the existing !oshi.driver.common.* exclude, so the explicit !oshi.driver.unix.{bsd,freebsd.disk,solaris.disk}.* overrides drop out.

Notes

  • Pure refactor — no public API surface changes (everything in the moved packages was already shared between oshi-common consumers; the exported package names change but the class names don't).
  • No oshi-core packages move. The oshi.driver.unix.aix JNA-only package (PsInfoJNA + the perfstat/Perfstat*JNA drivers) stays put, as do oshi.driver.unix.freebsd.Who and oshi.driver.unix.solaris.{PsInfo,Who,kstat.SystemPages}.

Test plan

  • ./mvnw clean install -Djacoco.skip=true green through oshi-dist (where bnd conflicts typically surface)
  • Inspected the resulting bnd manifests — oshi-common exports the four new paths, no oshi.driver.unix.{bsd,freebsd,solaris} leaks from any module
  • All oshi-common tests pass under mvn clean install

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Reorganized internal Unix/BSD/Solaris driver utilities package structure for improved code organization and maintainability. All functionality remains unchanged and there is no impact on end-users.

Sweeps the older Unix ports to match the AIX convention established in
#3350. The shared (oshi-common) drivers for BSD, FreeBSD, and Solaris
were sitting at the top-level `oshi.driver.unix.<os>` namespace, which
worked only because the JNA-only drivers in oshi-core happened to live
in disjoint sub-packages (e.g. oshi-core's `oshi.driver.unix.solaris`
holds `PsInfo`/`Who`, oshi-common's `oshi.driver.unix.solaris.disk`
holds `Iostat`/`Lshal`/`Prtvtoc` — different Java packages, no split).
The new convention puts every oshi-common driver under
`oshi.driver.common.unix.<os>[.sub]`, mirroring `oshi.driver.common.mac`
and `oshi.driver.common.windows.*` and avoiding the
top-level-namespace-shared-across-modules fragility.

Moved (oshi-common):
* oshi.driver.unix.bsd.Systat -> oshi.driver.common.unix.bsd.Systat
* oshi.driver.unix.bsd.disk.Disklabel
  -> oshi.driver.common.unix.bsd.disk.Disklabel
* oshi.driver.unix.freebsd.disk.{GeomDiskList,GeomPartList,Mount}
  -> oshi.driver.common.unix.freebsd.disk.*
* oshi.driver.unix.solaris.disk.{Iostat,Lshal,Prtvtoc}
  -> oshi.driver.common.unix.solaris.disk.*
* Tests follow their drivers under
  oshi-common/src/test/java/oshi/driver/common/unix/...

Updated:
* Consumer imports in 8 hardware classes across oshi-common, oshi-core,
  and oshi-core-ffm (FreeBsd/OpenBsd/NetBsd/Solaris HW disk/sensors/
  power source FFM + JNA peers).
* oshi-common module-info.java exports: the four old `oshi.driver.unix.*`
  entries replaced by their `oshi.driver.common.unix.*` equivalents,
  sorted alphabetically.
* oshi-common module-info.test add-opens: matching package renames so
  JUnit Platform can still introspect each test class.
* oshi-core and oshi-core-ffm bnd Export-Package globs: the moved
  packages are now covered by the existing `!oshi.driver.common.*`
  exclude, so the explicit
  `!oshi.driver.unix.{bsd,freebsd.disk,solaris.disk}.*` overrides drop
  out.

Pure refactor — no public API surface changes (everything in the
moved packages was already shared between oshi-common consumers; the
exported package names change but the class names don't). Full
`mvn clean install` green through oshi-dist; bnd manifests show the
new export paths with no leaks of the old paths.
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1ca4bbf6-bd76-4c7f-a145-53fdbe2c2860

📥 Commits

Reviewing files that changed from the base of the PR and between ec2ffa6 and 87a6b09.

📒 Files selected for processing (29)
  • oshi-common/src/main/java/module-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/Disklabel.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomDiskList.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomPartList.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/Mount.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Iostat.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Lshal.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Prtvtoc.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java
  • oshi-common/src/test/java/module-info.test
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/disk/DisklabelTest.java
  • oshi-common/src/test/java/oshi/driver/common/unix/freebsd/disk/DiskDriversTest.java
  • oshi-common/src/test/java/oshi/driver/common/unix/solaris/disk/DiskDriversTest.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStoreFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdSensors.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStore.java
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Analyze (java)
  • GitHub Check: JMH Benchmarks, macos-latest
  • GitHub Check: JMH Benchmarks, windows-latest
  • GitHub Check: JMH Benchmarks, ubuntu-latest
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdSensors.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java
  • oshi-common/src/main/java/module-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/package-info.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStore.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/Mount.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/package-info.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/disk/DisklabelTest.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/Disklabel.java
  • oshi-common/src/test/java/oshi/driver/common/unix/solaris/disk/DiskDriversTest.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Iostat.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomPartList.java
  • oshi-common/src/test/java/oshi/driver/common/unix/freebsd/disk/DiskDriversTest.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomDiskList.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStoreFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Lshal.java
  • oshi-common/src/test/java/module-info.test
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Prtvtoc.java
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdSensors.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java
📚 Learning: 2026-05-31T04:49:19.668Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:19.668Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdSensors.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java
📚 Learning: 2026-04-06T04:45:51.516Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java
  • oshi-common/src/main/java/module-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/Disklabel.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Lshal.java
  • oshi-common/src/test/java/module-info.test
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java
  • oshi-common/src/main/java/module-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/Mount.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/Disklabel.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Iostat.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomPartList.java
  • oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomDiskList.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Lshal.java
  • oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Prtvtoc.java
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.

Applied to files:

  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreFFM.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java
📚 Learning: 2026-04-08T00:58:10.736Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3125
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java:131-133
Timestamp: 2026-04-08T00:58:10.736Z
Learning: In `oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java` and `oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java`, the `getPowerSources()` method intentionally returns a singleton list wrapping a single `getPowerSource("System Battery")` call, and the enumeration loop short-circuits after the first eligible battery pack. This matches the longstanding JNA behavior and is not a bug. A broader refactor to support zero-or-more batteries across both implementations is planned for a later date. Do not flag this as an issue.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java
📚 Learning: 2026-04-03T18:43:51.290Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:51.290Z
Learning: In oshi/oshi PlatformEnum.java, the DragonFly BSD detection uses `osName.equalsIgnoreCase("dragonflybsd")` intentionally, mirroring the exact same check in JNA's `Platform.java` source. Java's `os.name` property on DragonFly BSD is "dragonflybsd" (no space), so `startsWith("DragonFly")` is NOT the correct pattern here. Do not suggest changing it to `startsWith`.

Applied to files:

  • oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java
  • oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java
📚 Learning: 2026-04-03T02:07:49.467Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3110
File: oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java:119-121
Timestamp: 2026-04-03T02:07:49.467Z
Learning: In `oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java` (and similar FFM/API implementations in OSHI), the `updateAttributes()` method intentionally uses `catch (Throwable e) { return false; }` without logging. This is by design: `updateAttributes()` is a public API method whose contract is to return `false` on failure; callers consume the boolean and would never see log output, so adding a log statement is not desired.

Applied to files:

  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStoreFFM.java
🔇 Additional comments (29)
oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java (1)

12-13: LGTM!

oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java (1)

13-13: LGTM!

oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java (1)

5-5: LGTM!

Also applies to: 19-19

oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java (1)

12-13: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdSensors.java (1)

13-13: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/Disklabel.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/package-info.java (1)

8-8: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java (1)

8-8: LGTM!

oshi-common/src/test/java/oshi/driver/common/unix/bsd/disk/DisklabelTest.java (1)

5-5: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java (1)

17-17: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdHWDiskStore.java (1)

17-17: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java (1)

17-17: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomDiskList.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomPartList.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/Mount.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/package-info.java (1)

8-8: LGTM!

oshi-common/src/test/java/oshi/driver/common/unix/freebsd/disk/DiskDriversTest.java (1)

5-5: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreFFM.java (1)

16-17: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.java (1)

16-17: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Iostat.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Lshal.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Prtvtoc.java (1)

5-5: LGTM!

oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/package-info.java (1)

4-4: LGTM!

oshi-common/src/test/java/oshi/driver/common/unix/solaris/disk/DiskDriversTest.java (1)

5-5: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStoreFFM.java (1)

17-19: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStore.java (1)

21-23: LGTM!

oshi-common/src/main/java/module-info.java (1)

25-28: LGTM!

oshi-common/src/test/java/module-info.test (1)

50-50: LGTM!

Also applies to: 52-52, 54-54, 56-56


📝 Walkthrough

Walkthrough

This PR consolidates Unix/BSD disk driver utilities by relocating classes from oshi.driver.unix.* to oshi.driver.common.unix.* packages. All consuming code across three modules is updated to import from the new locations, including test classes and module system configuration.

Changes

Unix Driver Package Consolidation

Layer / File(s) Summary
BSD Systat relocation
oshi-common/src/main/java/oshi/driver/common/unix/bsd/Systat.java, oshi-common/src/test/java/oshi/driver/common/unix/bsd/SystatTest.java, oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java, oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java, oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdPowerSource.java, oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdSensors.java
Systat class and its nested BatteryFields are relocated from oshi.driver.unix.bsd to oshi.driver.common.unix.bsd. All power and sensor implementations (OpenBSD, NetBSD) update imports to consume from the new location.
BSD disk utilities relocation
oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/Disklabel.java, oshi-common/src/main/java/oshi/driver/common/unix/bsd/disk/package-info.java, oshi-common/src/main/java/oshi/driver/common/unix/bsd/package-info.java, oshi-common/src/test/java/oshi/driver/common/unix/bsd/disk/DisklabelTest.java, oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java, oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdHWDiskStore.java, oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
Disklabel class and package documentation move from oshi.driver.unix.bsd.disk to oshi.driver.common.unix.bsd.disk. Disk store implementations across FFM and JNA variants update imports to reference the relocated utility.
FreeBSD disk utilities relocation
oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomDiskList.java, oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/GeomPartList.java, oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/Mount.java, oshi-common/src/main/java/oshi/driver/common/unix/freebsd/disk/package-info.java, oshi-common/src/test/java/oshi/driver/common/unix/freebsd/disk/DiskDriversTest.java, oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreFFM.java, oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.java
GeomDiskList, GeomPartList, and Mount are relocated from oshi.driver.unix.freebsd.disk to oshi.driver.common.unix.freebsd.disk. Both FFM and JNA disk store implementations update their imports accordingly.
Solaris disk utilities relocation
oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Iostat.java, oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Lshal.java, oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/Prtvtoc.java, oshi-common/src/main/java/oshi/driver/common/unix/solaris/disk/package-info.java, oshi-common/src/test/java/oshi/driver/common/unix/solaris/disk/DiskDriversTest.java, oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStoreFFM.java, oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStore.java
Iostat, Lshal, and Prtvtoc move from oshi.driver.unix.solaris.disk to oshi.driver.common.unix.solaris.disk. Both FFM and JNA implementations update imports to reference the new location.
Module system and test configuration
oshi-common/src/main/java/module-info.java, oshi-common/src/test/java/module-info.test
The main module's exports declarations are reordered to reference relocated BSD packages under oshi.driver.common.unix.*. Test module --add-opens directives are updated to grant reflective access to the new package namespace.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • oshi/oshi#3312: Extracted BSD parsers (Systat, Disklabel) into oshi.driver.unix.bsd.* packages, which this PR then consolidates further into oshi.driver.common.unix.bsd.*.
  • oshi/oshi#3335: Related module system changes to Unix BSD driver package exports in module-info.java and test --add-opens configuration.

🐰 From module to common, our drivers go,
Systat and Disklabel find a better home below,
FreeBSD geoms, Solaris stats align,
Consolidated packages, all by design!
One namespace shared, imports refined. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving shared Unix drivers from their original packages to the new oshi.driver.common.unix.* namespace, which aligns with the refactoring work documented in the objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.94%. Comparing base (ec2ffa6) to head (87a6b09).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3351      +/-   ##
============================================
- Coverage     74.95%   74.94%   -0.01%     
  Complexity       76       76              
============================================
  Files           602      602              
  Lines         25845    25845              
  Branches       3990     3990              
============================================
- Hits          19371    19369       -2     
+ Misses         4221     4217       -4     
- Partials       2253     2259       +6     
Flag Coverage Δ
freebsd 23.18% <ø> (+0.01%) ⬆️
linux 26.85% <ø> (ø)
macos 30.22% <ø> (ø)
openbsd 22.51% <ø> (ø)
solaris 24.80% <ø> (+<0.01%) ⬆️
windows 36.18% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbwiddis
dbwiddis merged commit 387ca45 into oshi:master Jun 7, 2026
21 of 22 checks passed
@dbwiddis
dbwiddis deleted the move-shared-unix-drivers-to-common branch June 7, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant