diff options
author | Thomas Bertschinger <tahbertschinger@gmail.com> | 2024-01-15 23:41:00 -0700 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-16 01:46:41 -0500 |
commit | 0a284fc4ffcbb46f0a4b921415ef12a9c75fa05c (patch) | |
tree | 22aa82b7448833713ca975eb3c241f607742fc78 /rust-src/bch_bindgen | |
parent | 249bf7b9d446092e1b744c366b7e8c4563a437f0 (diff) |
convert main() from C to Rust
This moves the main() function from C to Rust. It also updates the name
of the Rust package from "bcachefs-rust" to "bcachefs-tools".
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'rust-src/bch_bindgen')
-rw-r--r-- | rust-src/bch_bindgen/build.rs | 6 | ||||
-rw-r--r-- | rust-src/bch_bindgen/src/libbcachefs_wrapper.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/rust-src/bch_bindgen/build.rs b/rust-src/bch_bindgen/build.rs index 79337a0f..d9805a8d 100644 --- a/rust-src/bch_bindgen/build.rs +++ b/rust-src/bch_bindgen/build.rs @@ -10,6 +10,8 @@ impl bindgen::callbacks::ParseCallbacks for Fix753 { fn main() { use std::path::PathBuf; + println!("cargo:rerun-if-changed=src/libbcachefs_wrapper.h"); + let out_dir: PathBuf = std::env::var_os("OUT_DIR") .expect("ENV Var 'OUT_DIR' Expected") .into(); @@ -44,6 +46,10 @@ fn main() { .default_enum_style(bindgen::EnumVariation::Rust { non_exhaustive: true, }) + .allowlist_function("bcachefs_usage") + .allowlist_function("raid_init") + .allowlist_function("cmd_.*") + .allowlist_function(".*_cmds") .allowlist_function(".*bch2_.*") .allowlist_function("bio_.*") .allowlist_function("derive_passphrase") diff --git a/rust-src/bch_bindgen/src/libbcachefs_wrapper.h b/rust-src/bch_bindgen/src/libbcachefs_wrapper.h index e68de664..5fb42613 100644 --- a/rust-src/bch_bindgen/src/libbcachefs_wrapper.h +++ b/rust-src/bch_bindgen/src/libbcachefs_wrapper.h @@ -11,6 +11,8 @@ #include "../crypto.h" #include "../include/linux/bio.h" #include "../include/linux/blkdev.h" +#include "../cmds.h" +#include "../raid/raid.h" #define MARK_FIX_753(req_name) const blk_mode_t Fix753_##req_name = req_name; |