Skip to content

Add initial partial UDF support#403

Open
Zopolis4 wants to merge 1 commit into
superg:mainfrom
Zopolis4:overconfident
Open

Add initial partial UDF support#403
Zopolis4 wants to merge 1 commit into
superg:mainfrom
Zopolis4:overconfident

Conversation

@Zopolis4

@Zopolis4 Zopolis4 commented Jun 30, 2026

Copy link
Copy Markdown

This PR only supports up to UDF 1.02 (maybe 1.50, haven't found any discs to test it with), and also doesn't fully support parsing the filesystem beyond the initial directory yet. Those will be in later PRs once I. figure out how to implement them.

In the meantime, the added functionality is tested and working, but as it isn't ready to be directly used by anything yet I haven't committed the temporary command I used to test it.

Summary by CodeRabbit

  • New Features
    • Expanded UDF metadata support by adding additional on-disk descriptor structures for richer parsing.
    • Introduced a new UDF “browser” capability to locate key filesystem structures directly from media sectors.
    • Improved root directory discovery by chaining descriptor lookups and extents, returning a parsed root entry when available.

@coderabbitai

coderabbitai Bot commented Jun 30, 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f719a65-7afb-4a96-97dd-310a770a2f19

📥 Commits

Reviewing files that changed from the base of the PR and between 291aa91 and 283da14.

📒 Files selected for processing (4)
  • CMakeLists.txt
  • filesystem/udf/udf.ixx
  • filesystem/udf/udf_browser.ixx
  • filesystem/udf/udf_defs.ixx
✅ Files skipped from review due to trivial changes (1)
  • filesystem/udf/udf.ixx
🚧 Files skipped from review as they are similar to previous changes (3)
  • CMakeLists.txt
  • filesystem/udf/udf_defs.ixx
  • filesystem/udf/udf_browser.ixx

📝 Walkthrough

Walkthrough

Adds new UDF descriptor structs, updates PartitionDescriptor, and introduces an exported filesystem.udf:browser module with Browser helpers for locating UDF volume structures and the root directory.

Changes

UDF Browser Module

Layer / File(s) Summary
UDF descriptor layouts
filesystem/udf/udf_defs.ixx
Adds the new packed descriptor and address types, plus LogicalVolumeDescriptor, FileSetDescriptor, icbtag, and FileEntry. Updates PartitionDescriptor to store EntityID values and revised trailing fields.
Browser lookup flow
filesystem/udf/udf_browser.ixx, filesystem/udf/udf.ixx, CMakeLists.txt
Adds the exported filesystem.udf:browser module, implements anchor/descriptor/root-directory lookup helpers, and wires the module into the public import graph and build target.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • superg/redumper#318: Also changes filesystem/udf/udf_defs.ixx and is code-level related through UDF descriptor and module-surface updates.

Suggested reviewers

  • superg

Poem

🐇 A new burrow in UDF appears,
With anchors, tags, and little gears.
The browser hops from block to block,
And finds the root by reading stock.

🚥 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 matches the changeset’s goal of adding initial UDF filesystem support.
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.
✨ 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.

@Zopolis4 Zopolis4 marked this pull request as ready for review June 30, 2026 10:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@filesystem/udf/udf_browser.ixx`:
- Around line 36-55: The findDescriptorOffset helper currently signals “not
found” with a uint32_t return value, which turns into UINT32_MAX and can be read
later in the descriptor parsing path. Change findDescriptorOffset to return
std::optional<uint32_t>, have callers like the logic around descriptor reads
check for the empty case before using the LBA, and add a guard for
main_vds.length == 0 so the loop bound in findDescriptorOffset cannot underflow.
Update the related read flow in udf_browser.ixx (including the code that uses
the returned offset) to skip reads when no descriptor is found.
- Around line 90-94: The root entry creation in the UDF browser currently
returns a copied udf::FileEntry from root_directory_data, but that object does
not retain the backing payload needed for extended attributes and allocation
descriptors. Update the root_directory_data / root_directory_file_entry flow so
the returned object owns or references the full buffer, and ensure the logic in
the root-directory reader and udf::FileEntry construction/usage in udf_defs.ixx
preserves the trailing payload instead of exposing only the fixed header.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c953c3c2-003f-421e-8a5a-53bea78e1ddd

📥 Commits

Reviewing files that changed from the base of the PR and between cbf7c9b and d1dabdd.

📒 Files selected for processing (4)
  • CMakeLists.txt
  • filesystem/udf/udf.ixx
  • filesystem/udf/udf_browser.ixx
  • filesystem/udf/udf_defs.ixx

Comment thread filesystem/udf/udf_browser.ixx Outdated
Comment thread filesystem/udf/udf_browser.ixx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@filesystem/udf/udf_browser.ixx`:
- Line 24: The descriptor parsing in udf_browser.ixx is reading fields by
casting raw std::vector<uint8_t> storage directly to udf::* references, which is
undefined behavior. Update the descriptor access in the relevant parsing code
around AnchorVolumeDescriptorPointer and similar reads to first copy the bytes
into a properly created object, using a small std::memcpy or std::bit_cast
helper for fixed-size descriptors. Keep the existing flow, but ensure all udf::
descriptor reads go through real objects whose lifetime has started before
accessing their fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7a226576-bd5f-4799-8f17-0ca5982f2c6e

📥 Commits

Reviewing files that changed from the base of the PR and between d1dabdd and 291aa91.

📒 Files selected for processing (4)
  • CMakeLists.txt
  • filesystem/udf/udf.ixx
  • filesystem/udf/udf_browser.ixx
  • filesystem/udf/udf_defs.ixx
✅ Files skipped from review due to trivial changes (2)
  • filesystem/udf/udf.ixx
  • CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • filesystem/udf/udf_defs.ixx

Comment thread filesystem/udf/udf_browser.ixx
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