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)] 29*7129ea6eSMiguel Ojeda #[cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))] 308326ac05SMiguel Ojeda mod bindings_raw { 312fd6f55cSGary Guo // Manual definition for blocklisted types. 322fd6f55cSGary Guo type __kernel_size_t = usize; 332fd6f55cSGary Guo type __kernel_ssize_t = isize; 342fd6f55cSGary Guo type __kernel_ptrdiff_t = isize; 352fd6f55cSGary Guo 368326ac05SMiguel Ojeda // Use glob import here to expose all helpers. 378326ac05SMiguel Ojeda // Symbols defined within the module will take precedence to the glob import. 388326ac05SMiguel Ojeda pub use super::bindings_helper::*; 398326ac05SMiguel Ojeda include!(concat!( 408326ac05SMiguel Ojeda env!("OBJTREE"), 418326ac05SMiguel Ojeda "/rust/bindings/bindings_generated.rs" 428326ac05SMiguel Ojeda )); 438326ac05SMiguel Ojeda } 448326ac05SMiguel Ojeda 458326ac05SMiguel Ojeda // When both a directly exposed symbol and a helper exists for the same function, 468326ac05SMiguel Ojeda // the directly exposed symbol is preferred and the helper becomes dead code, so 478326ac05SMiguel Ojeda // ignore the warning here. 488326ac05SMiguel Ojeda #[allow(dead_code)] 498326ac05SMiguel Ojeda mod bindings_helper { 508326ac05SMiguel Ojeda // Import the generated bindings for types. 519dc04365SWedson Almeida Filho use super::bindings_raw::*; 528326ac05SMiguel Ojeda include!(concat!( 538326ac05SMiguel Ojeda env!("OBJTREE"), 548326ac05SMiguel Ojeda "/rust/bindings/bindings_helpers_generated.rs" 558326ac05SMiguel Ojeda )); 568326ac05SMiguel Ojeda } 578326ac05SMiguel Ojeda 588326ac05SMiguel Ojeda pub use bindings_raw::*; 59