From 743766565dc0bdeedf7db419500031c7bdc84033 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sat, 4 Nov 2023 14:56:56 +0000 Subject: rust: bindings: rename const binding using sed Currently, for `const`s that bindgen doesn't recognise, we define a helper constant with const BINDINGS_ = ; in `bindings_helper.h` and then we put pub const : = BINDINGS_; in `bindings/lib.rs`. This is fine since we currently only have 3 constants that are defined this way, but is going to be more annoying when more constants are added since every new constant needs to be defined in two places. This patch changes the way we define constant helpers to const RUST_CONST_HELPER_ = ; and then use `sed` to postprocess Rust code generated by bindgen to remove the distinct prefix, so users of the `bindings` crate can refer to the name directly. Reviewed-by: Benno Lossin Reviewed-by: Andreas Hindborg Reviewed-by: Martin Rodriguez Reboredo Signed-off-by: Gary Guo Reviewed-by: Alice Ryhl Link: https://lore.kernel.org/r/20231104145700.2495176-1-gary@garyguo.net [ Reworded for typos. ] Signed-off-by: Miguel Ojeda --- rust/bindings/lib.rs | 3 --- 1 file changed, 3 deletions(-) (limited to 'rust/bindings/lib.rs') diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs index 9bcbea04dac3..40ddaee50d8b 100644 --- a/rust/bindings/lib.rs +++ b/rust/bindings/lib.rs @@ -48,6 +48,3 @@ mod bindings_helper { } pub use bindings_raw::*; - -pub const GFP_KERNEL: gfp_t = BINDINGS_GFP_KERNEL; -pub const __GFP_ZERO: gfp_t = BINDINGS___GFP_ZERO; -- cgit v1.2.3