Skip to content

Look up FreeBSD file store UUIDs by the volume's device - #3823

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:freebsd-filestore-uuid
Oct 17, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:freebsd-filestore-uuid

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

OSFileStore.getUUID() on FreeBSD was empty for every file system except /.

getFileStores() builds a map from geom part list that is keyed by partition device (da1p1). It then looked each file store up by the last element of its mount point (home). Only / ever matched, because for / the name is taken from the volume instead.

Change

  • Lookup key: the UUID is now looked up by the device the volume names below /dev.
  • Other device names: a partition can also be mounted by its GPT label (/dev/gpt/rootfs) or its GPT ID (/dev/gptid/<rawuuid>). parseGeomPartList now maps those names as well.
  • Cleanup: the // TODO map mount point to UUID? comment is gone.

Verification

cfarm430 (FreeBSD 16.0-CURRENT):

Mount Volume UUID before UUID after
/ /dev/da0p2 d4553393-... d4553393-8f91-11ef-8e4d-00155dc40030
/boot/efi /dev/da0p1 empty d454a567-8f91-11ef-8e4d-00155dc40030
/home /dev/da1p1 empty deb7728b-8f91-11ef-8e4d-00155dc40030

The new test uses this machine's geom part list output. It covers volumes named by device, GPT label and GPT ID, and volumes that should get no UUID: a whole disk, tmpfs and a ZFS dataset.

Not verified

cfarm430 mounts everything by device, so the GPT label and GPT ID cases are tested only against fixture data. ZFS datasets have no partition UUID and still return an empty string, as before.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed volume UUID detection on FreeBSD. UUIDs are now found for volumes identified by their device, GPT label, or GPT ID, rather than relying on the mount point.
    • Volumes without a supported device identifier, such as temporary filesystems and ZFS datasets, continue to return no UUID.

getFileStores() looked up each file store's UUID in the geom part list
map, which is keyed by partition device (da1p1), using the last element
of the mount point (home). Only / matched, because for / the name is
taken from the volume instead. Look the UUID up by the device the volume
names below /dev.

A partition can also be mounted by GPT label (/dev/gpt/rootfs) or by GPT
ID (/dev/gptid/<rawuuid>), so parseGeomPartList maps those names too.

On cfarm430 (FreeBSD 16.0-CURRENT), /, /boot/efi and /home now each
report the rawuuid geom lists; before, only / did.
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d0250ef-991a-4ee4-b493-69f42a342724
📥 Commits

Reviewing files that changed from the base of the PR and between 61aafad and 02f3d80.

📒 Files selected for processing: 3
  • CHANGELOG.md
  • oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java
  • oshi-common/src/test/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystemTest.java

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 7
  • GitHub Check: Test JDK 25, OpenIndiana
  • GitHub Check: Test JDK 25, OpenBSD
  • GitHub Check: Test JDK 25, NetBSD
  • GitHub Check: Test JDK 25, FreeBSD
  • GitHub Check: Analyze (java)
  • GitHub Check: Lint (ForbiddenAPIs, Javadoc, SLF4J)
  • GitHub Check: Test JDK 25, windows-latest
🧰 Additional context used
📚 Code guidelines: 2
AGENTS.md — auto-discovered
CONTRIBUTING.md — auto-discovered
📓 Path-based instructions: 2
Source excerpt: **Banned APIs** (`config/forbidden-apis.txt` and friends, enforced by `forbiddenapis:check`): `oshi-common` may not reference `com.sun.jna.**`, `java.lang.foreign.**`, or any `System.load`/`loadLibrary`.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • oshi-common/src/test/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystemTest.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java
Applicability reference: AGENTS.md: # AGENTS.md Instructions for AI coding agents working in the OSHI repository.

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • CHANGELOG.md
🔇 Additional comments: 3
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java: 1

96-96: LGTM!

Also applies to: 121-130, 132-136, 139-139, 144-144, 146-146, 149-158

oshi-common/src/test/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystemTest.java: 1

35-38: LGTM!

Also applies to: 44-87

CHANGELOG.md: 1

30-30: LGTM!

📝 Walkthrough

FreeBSD file-store UUID lookup now uses the volume’s device path. GEOM partition parsing indexes UUIDs by partition device, GPT ID, and valid GPT label. Tests cover supported paths and volumes that return no UUID.

Changes: FreeBSD UUID lookup

Layer / File(s) Summary
Index GEOM partition UUIDs
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java, oshi-common/src/test/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystemTest.java
GEOM parsing maps each partition UUID to its device name and GPT ID. It maps nonempty labels other than (null) to the same UUID. The parser test checks the GPT ID mapping.
Resolve UUIDs from volume paths
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java, oshi-common/src/test/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystemTest.java, CHANGELOG.md
getFileStores resolves UUIDs through uuidForVolume, which looks up /dev/ volume names and returns an empty string for other volumes. Tests cover partition paths, GPT labels and IDs, whole-disk paths, tmpfs, and ZFS datasets. The changelog describes the lookup change.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 02f3d

The UUID lookup change is ready to merge after normal checks; no blocking issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 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: FreeBSD file store UUID lookup now uses the volume's device.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

I’m a rabbit by the partition map,
I follow device paths through the gap.
GPT labels join the UUID parade,
GPT IDs get a matching shade.
Empty paths return no UUID to find,
I nibble the changelog, pleased and kind.

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

@dbwiddis
dbwiddis merged commit 83adeaf into oshi:master Oct 17, 2026
17 of 18 checks passed
@dbwiddis
dbwiddis deleted the freebsd-filestore-uuid branch October 17, 2026 20:18
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