summaryrefslogtreecommitdiff
path: root/rust-src/bch_bindgen/src
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-28 06:15:48 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-28 06:15:48 -0500
commit8a7e3344fe089b3e2c6c45f00ade217e3d55a958 (patch)
tree801bec15e86816d8c87da17f0ce4f5e21299c0f6 /rust-src/bch_bindgen/src
parentdaebbc085d74dc7666dd704f48fa4ed5c0005f75 (diff)
rust: Filesystem options now supported
This implements opt_set!(), which works exactly the same as the C version and allows filesystem options to be specified in Rust code. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'rust-src/bch_bindgen/src')
-rw-r--r--rust-src/bch_bindgen/src/btree.rs2
-rw-r--r--rust-src/bch_bindgen/src/lib.rs2
-rw-r--r--rust-src/bch_bindgen/src/libbcachefs_wrapper.h1
-rw-r--r--rust-src/bch_bindgen/src/opts.rs9
4 files changed, 12 insertions, 2 deletions
diff --git a/rust-src/bch_bindgen/src/btree.rs b/rust-src/bch_bindgen/src/btree.rs
index 7877b6e2..8ab91aeb 100644
--- a/rust-src/bch_bindgen/src/btree.rs
+++ b/rust-src/bch_bindgen/src/btree.rs
@@ -1,5 +1,3 @@
-#![allow(non_snake_case)]
-
use crate::SPOS_MAX;
use crate::c;
use crate::bkey::BkeySC;
diff --git a/rust-src/bch_bindgen/src/lib.rs b/rust-src/bch_bindgen/src/lib.rs
index bce150a4..3bc21a18 100644
--- a/rust-src/bch_bindgen/src/lib.rs
+++ b/rust-src/bch_bindgen/src/lib.rs
@@ -6,6 +6,8 @@ pub mod keyutils;
pub mod log;
pub mod rs;
pub mod fs;
+pub mod opts;
+pub use paste::paste;
pub mod c {
pub use crate::bcachefs::*;
diff --git a/rust-src/bch_bindgen/src/libbcachefs_wrapper.h b/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
index 6332d957..c8990dcc 100644
--- a/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
+++ b/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
@@ -3,6 +3,7 @@
#include "../libbcachefs/bcachefs_format.h"
#include "../libbcachefs/btree_iter.h"
#include "../libbcachefs/errcode.h"
+#include "../libbcachefs/error.h"
#include "../libbcachefs/opts.h"
#include "../libbcachefs.h"
#include "../crypto.h"
diff --git a/rust-src/bch_bindgen/src/opts.rs b/rust-src/bch_bindgen/src/opts.rs
new file mode 100644
index 00000000..e2261993
--- /dev/null
+++ b/rust-src/bch_bindgen/src/opts.rs
@@ -0,0 +1,9 @@
+#[macro_export]
+macro_rules! opt_set {
+ ($opts:ident, $n:ident, $v:expr) => {
+ bch_bindgen::paste! {
+ $opts.$n = $v;
+ $opts.[<set_ $n _defined>](1);
+ }
+ }
+}