]> git.sesse.net Git - bcachefs-tools-debian/commit
feat(rust/wrappers): init `BcachefsHandle`
authorRyan Lahfa <bcachefs@lahfa.xyz>
Sat, 27 Jan 2024 03:23:20 +0000 (04:23 +0100)
committerRyan Lahfa <bcachefs@lahfa.xyz>
Sat, 27 Jan 2024 04:15:19 +0000 (05:15 +0100)
commit9282cb953ce034567cce67336947b731a770f71a
tree86eadc19f3ab42fcb7dd3f742a71bf64d9048317
parent930646e8dd31cc32f155d83e8302e84bde581025
feat(rust/wrappers): init `BcachefsHandle`

We propose a simple low-level wrapper which can perform various subvolume-related operations
as an example for the API surface.

This will be used in an upcoming commit to migrate the subvolume CLI fully to Rust.

The API design is the following:

- `BcachefsHandle` is meant as a low level handle to carry around whenever you need a filesystem handle
  to send ioctl to.
- it possess type-safe operations

Type safe operations are handled by having type safe wrappers for ioctl commands
*and* their payloads.

We assume that all ioctl payloads only use *one* argument, this can easily be changed if needed.

When the handle goes out of scope, we automatically close it à la C++ RAII.

Signed-off-by: Ryan Lahfa <bcachefs@lahfa.xyz>
src/bcachefs.rs
src/wrappers/handle.rs [new file with mode: 0644]
src/wrappers/mod.rs [new file with mode: 0644]