lib.rs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // SPDX-License-Identifier: GPL-2.0
  2. //! Bindings.
  3. //!
  4. //! Imports the generated bindings by `bindgen`.
  5. //!
  6. //! This crate may not be directly used. If you need a kernel C API that is
  7. //! not ported or wrapped in the `kernel` crate, then do so first instead of
  8. //! using this crate.
  9. #![no_std]
  10. // See <https://github.com/rust-lang/rust-bindgen/issues/1651>.
  11. #![cfg_attr(test, allow(deref_nullptr))]
  12. #![cfg_attr(test, allow(unaligned_references))]
  13. #![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))]
  14. #![allow(
  15. clippy::all,
  16. missing_docs,
  17. non_camel_case_types,
  18. non_upper_case_globals,
  19. non_snake_case,
  20. improper_ctypes,
  21. unreachable_pub,
  22. unsafe_op_in_unsafe_fn
  23. )]
  24. #[allow(dead_code)]
  25. mod bindings_raw {
  26. // Use glob import here to expose all helpers.
  27. // Symbols defined within the module will take precedence to the glob import.
  28. pub use super::bindings_helper::*;
  29. include!(concat!(
  30. env!("OBJTREE"),
  31. "/rust/bindings/bindings_generated.rs"
  32. ));
  33. }
  34. // When both a directly exposed symbol and a helper exists for the same function,
  35. // the directly exposed symbol is preferred and the helper becomes dead code, so
  36. // ignore the warning here.
  37. #[allow(dead_code)]
  38. mod bindings_helper {
  39. // Import the generated bindings for types.
  40. use super::bindings_raw::*;
  41. include!(concat!(
  42. env!("OBJTREE"),
  43. "/rust/bindings/bindings_helpers_generated.rs"
  44. ));
  45. }
  46. pub use bindings_raw::*;