Skip to content

Comments

Extract FFI bindings into separate libublk-rs-sys crate#46

Merged
ming1 merged 1 commit intomainfrom
libublk-sys.crate
Dec 14, 2025
Merged

Extract FFI bindings into separate libublk-rs-sys crate#46
ming1 merged 1 commit intomainfrom
libublk-sys.crate

Conversation

@ming1
Copy link
Collaborator

@ming1 ming1 commented Dec 12, 2025

Create a standalone libublk-rs-sys crate containing low-level FFI bindings to the Linux ublk kernel API. This allows users to handle ublk operations on their own io_uring instance instead of using libublk's thread-local ring.

Changes:

  • Move build.rs and ublk_cmd.h to libublk-rs-sys/
  • Create libublk-rs-sys with its own Cargo.toml and documentation
  • Update main libublk to depend on libublk-rs-sys via path dependency
  • Remove build-dependencies from main Cargo.toml
  • Update src/sys.rs to re-export from libublk-rs-sys
  • Update .gitignore to exclude build artifacts in subdirectories

The crates are managed separately (not using workspace) following the pattern of similar projects like devicemapper-rs.

Resolves: #45

@ming1 ming1 mentioned this pull request Dec 12, 2025
Create a standalone libublk-rs-sys crate containing low-level FFI
bindings to the Linux ublk kernel API. This allows users to handle
ublk operations on their own io_uring instance instead of using
libublk's thread-local ring.

Changes:
- Move build.rs and ublk_cmd.h to libublk-rs-sys/
- Create libublk-rs-sys with its own Cargo.toml and documentation
- Update main libublk to depend on libublk-rs-sys via path dependency
- Remove build-dependencies from main Cargo.toml
- Update src/sys.rs to re-export from libublk-rs-sys
- Update .gitignore to exclude build artifacts in subdirectories
- Move ublk_auto_buf_reg helper functions to libublk-rs-sys with tests

The ublk_sqe_addr_to_auto_buf_reg() and ublk_auto_buf_reg_to_sqe_addr()
helper functions are now part of the libublk-rs-sys API with comprehensive
documentation and unit tests. The main crate re-exports them for backward
compatibility.

The crates are managed separately (not using workspace) following
the pattern of similar projects like devicemapper-rs.

Resolves: #45

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@ming1 ming1 force-pushed the libublk-sys.crate branch from 16b583b to c6a3e06 Compare December 13, 2025 14:11
@ming1 ming1 merged commit 8e78766 into main Dec 14, 2025
8 checks passed
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.

Publish libublk-sys crate

1 participant