jfuse icon indicating copy to clipboard operation
jfuse copied to clipboard

[WiP] Load versioned symbols from libfuse.so

Open overheadhunter opened this issue 10 months ago β€’ 2 comments

This adds a SymbolLookup implementation that uses dlvsym.

Fixes #116

Summary by CodeRabbit

  • Chores

    • Updated CI/CD pipeline and build configurations for dynamic, architecture-specific testing.
    • Enhanced build settings with target-specific macros for improved compilation.
  • Refactor

    • Standardized the file system interface by unifying version-specific API calls.
    • Consolidated symbol resolution into a centralized mechanism for dynamic library loading.
  • New Features

    • Introduced a dynamic symbol lookup capability to streamline shared library management.
  • Tests

    • Updated test cases to align with the revised API and symbol resolution approach, including adjustments in integration flags.

overheadhunter avatar Apr 06 '25 09:04 overheadhunter

Walkthrough

This pull request updates the CI/CD pipeline configuration and revises the FUSE API integration for both aarch64 and amd64 modules. The dynamic naming and configurable library paths are introduced in the workflow. The FUSE helper classes have been refactored to replace the deprecated fuse_new_31 with a versioned fuse_new approach. New custom FuseSymbolLookup classes for both architectures have been added and integrated into the library loading process. Additionally, associated tests and build configurations (including preprocessor macros in the pom) have been updated accordingly.

Changes

Files Change Summary
.github/workflows/build.yml CI/CD pipeline updated: dynamic job naming based on architecture, introduction of fuseLibPath in the matrix, Maven command now uses ${{ matrix.fuseLibPath }}, and fail-fast disabled.
jfuse-linux-.../FuseFFIHelper.java Renamed fuse_new_31 to fuse_new; updated symbol lookup string to "fuse_new@FUSE_3.0"; removed deprecated methods; now using FuseSymbolLookup.getInstance().
jfuse-linux-.../FuseImpl.java Updated method call from FuseFFIHelper.fuse_new_31(...) to FuseFFIHelper.fuse_new(...) in the file system creation logic.
jfuse-linux-.../FuseSymbolLookup.java Added a new custom FuseSymbolLookup class (singleton pattern) for dynamic library loading, symbol resolution (via dlopen, dlvsym, dlsym), and error handling.
jfuse-linux-.../LinuxFuseBuilder.java Inserted a call to FuseSymbolLookup.getInstance().open(libraryPath); in the build method before calling System.load(libraryPath);.
jfuse-linux-.../FuseImplTest.java Modified tests to update the mock from fuse_new_31 to fuse_new, ensuring consistency with the updated FUSE API calls.
jfuse-linux-amd64/pom.xml Added preprocessor macros __x86_64__=1 and __LP64__=1 in multiple jextract plugin executions; minor reordering of the <headerClassName> element for one execution.
jfuse-tests/.../MirrorIT.java Commented out the flags.add("-s"); line, disabling the inclusion of the -s flag in the mount operation tests.

Sequence Diagram(s)

sequenceDiagram
    participant Builder as LinuxFuseBuilder
    participant Lookup as FuseSymbolLookup
    participant System as System.load
    participant FFI as FuseFFIHelper

    Builder->>+Lookup: getInstance().open(libraryPath)
    Lookup-->>-Builder: Library handle resolved
    Builder->>+System: System.load(libraryPath)
    System-->>-Builder: Library loaded
    Builder->>+FFI: fuse_new(args, op, op_size, private_data)
    FFI-->>-Builder: Fuse instance returned

Assessment against linked issues

Objective Addressed Explanation
Use a custom Symbol Lookup for fuse_new (#116) βœ…

Possibly related issues

  • cryptomator/fuse-nio-adapter#176: The renaming from fuse_new_31 to fuse_new directly addresses unresolved symbol issues reported in this issue.

Possibly related PRs

  • cryptomator/jfuse#115: This PR includes similar modifications related to handling the fuse_new function and updating the symbol lookup mechanism.

Poem

I'm a rabbit with code so bright,
Hopping through files with sheer delight.
New symbols found in a versioned tune,
Custom lookups under the coding moon.
CI hops along, tests in lineβ€”
In every byte, my joy does shine!
πŸ‡πŸ’»

✨ Finishing Touches
  • [ ] πŸ“ Generate Docstrings

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
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 06 '25 09:04 coderabbitai[bot]

For documentation: This approach has the problem, that the library path must be set, because symbols loaded with System.loadLibrary(String libName) cannot be looked up with the custom SymbolLookup.

infeo avatar Apr 08 '25 15:04 infeo