summaryrefslogtreecommitdiff
path: root/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
diff options
context:
space:
mode:
authorTruongSinh Tran-Nguyen <i@truongsinh.pro>2023-04-27 11:02:00 -0700
committerKent Overstreet <kent.overstreet@linux.dev>2023-04-27 19:23:17 -0400
commitc1a8e27a3fad202750a1b66a1fd1fa82a8a5bd92 (patch)
tree1bb2e1fbe3ceee13ae4b8a4257ef31e1c924a4a8 /rust-src/bch_bindgen/src/libbcachefs_wrapper.h
parent9ee211eacad51bce6858ca9b9755b6c9eb253f2e (diff)
chore(rust): add opt_get! and expose some FMODE_* as Rust const
In an effort to rewrite `bch2_read_super` from C to Rust, it is neccessary to have `opt_get!` macro defined, and some FMODE_* consts (defined as macro in `include/linux/blkdev.h`) defined as Rust const. Bindgen is currently unable to exapnd C functional macro [1], this this commit use the workaround as introduced in [2]. [1] https://github.com/rust-lang/rust-bindgen/issues/753 [2] https://github.com/rust-lang/rust-bindgen/issues/753#issuecomment-608546390 Signed-off-by: TruongSinh Tran-Nguyen <i@truongsinh.pro>
Diffstat (limited to 'rust-src/bch_bindgen/src/libbcachefs_wrapper.h')
-rw-r--r--rust-src/bch_bindgen/src/libbcachefs_wrapper.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/rust-src/bch_bindgen/src/libbcachefs_wrapper.h b/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
index d1ebf4b6..e7bcfcfb 100644
--- a/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
+++ b/rust-src/bch_bindgen/src/libbcachefs_wrapper.h
@@ -10,4 +10,11 @@
#include "../libbcachefs.h"
#include "../crypto.h"
#include "../include/linux/bio.h"
+#include "../include/linux/blkdev.h"
+
+#define MARK_FIX_753(req_name) const fmode_t Fix753_##req_name = req_name;
+
+MARK_FIX_753(FMODE_READ);
+MARK_FIX_753(FMODE_WRITE);
+MARK_FIX_753(FMODE_EXCL); \ No newline at end of file