18326ac05SMiguel Ojeda // SPDX-License-Identifier: GPL-2.0 28326ac05SMiguel Ojeda 38326ac05SMiguel Ojeda //! Bindings. 48326ac05SMiguel Ojeda //! 58326ac05SMiguel Ojeda //! Imports the generated bindings by `bindgen`. 68326ac05SMiguel Ojeda //! 78326ac05SMiguel Ojeda //! This crate may not be directly used. If you need a kernel C API that is 88326ac05SMiguel Ojeda //! not ported or wrapped in the `kernel` crate, then do so first instead of 98326ac05SMiguel Ojeda //! using this crate. 108326ac05SMiguel Ojeda 118326ac05SMiguel Ojeda #![no_std] 128326ac05SMiguel Ojeda // See <https://github.com/rust-lang/rust-bindgen/issues/1651>. 138326ac05SMiguel Ojeda #![cfg_attr(test, allow(deref_nullptr))] 148326ac05SMiguel Ojeda #![cfg_attr(test, allow(unaligned_references))] 158326ac05SMiguel Ojeda #![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))] 168326ac05SMiguel Ojeda #![allow( 178326ac05SMiguel Ojeda clippy::all, 188326ac05SMiguel Ojeda missing_docs, 198326ac05SMiguel Ojeda non_camel_case_types, 208326ac05SMiguel Ojeda non_upper_case_globals, 218326ac05SMiguel Ojeda non_snake_case, 228326ac05SMiguel Ojeda improper_ctypes, 238326ac05SMiguel Ojeda unreachable_pub, 248326ac05SMiguel Ojeda unsafe_op_in_unsafe_fn 258326ac05SMiguel Ojeda )] 268326ac05SMiguel Ojeda 27f85bea18SMiguel Ojeda #[allow(dead_code)] 28db4f72c9SMiguel Ojeda #[allow(clippy::undocumented_unsafe_blocks)] 298326ac05SMiguel Ojeda mod bindings_raw { 30*2fd6f55cSGary Guo // Manual definition for blocklisted types. 31*2fd6f55cSGary Guo type __kernel_size_t = usize; 32*2fd6f55cSGary Guo type __kernel_ssize_t = isize; 33*2fd6f55cSGary Guo type __kernel_ptrdiff_t = isize; 34*2fd6f55cSGary Guo 358326ac05SMiguel Ojeda // Use glob import here to expose all helpers. 368326ac05SMiguel Ojeda // Symbols defined within the module will take precedence to the glob import. 378326ac05SMiguel Ojeda pub use super::bindings_helper::*; 388326ac05SMiguel Ojeda include!(concat!( 398326ac05SMiguel Ojeda env!("OBJTREE"), 408326ac05SMiguel Ojeda "/rust/bindings/bindings_generated.rs" 418326ac05SMiguel Ojeda )); 428326ac05SMiguel Ojeda } 438326ac05SMiguel Ojeda 448326ac05SMiguel Ojeda // When both a directly exposed symbol and a helper exists for the same function, 458326ac05SMiguel Ojeda // the directly exposed symbol is preferred and the helper becomes dead code, so 468326ac05SMiguel Ojeda // ignore the warning here. 478326ac05SMiguel Ojeda #[allow(dead_code)] 488326ac05SMiguel Ojeda mod bindings_helper { 498326ac05SMiguel Ojeda // Import the generated bindings for types. 509dc04365SWedson Almeida Filho use super::bindings_raw::*; 518326ac05SMiguel Ojeda include!(concat!( 528326ac05SMiguel Ojeda env!("OBJTREE"), 538326ac05SMiguel Ojeda "/rust/bindings/bindings_helpers_generated.rs" 548326ac05SMiguel Ojeda )); 558326ac05SMiguel Ojeda } 568326ac05SMiguel Ojeda 578326ac05SMiguel Ojeda pub use bindings_raw::*; 58