lib.rs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #![feature(core_ffi_c)]
  11. // See <https://github.com/rust-lang/rust-bindgen/issues/1651>.
  12. #![cfg_attr(test, allow(deref_nullptr))]
  13. #![cfg_attr(test, allow(unaligned_references))]
  14. #![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))]
  15. #![allow(
  16. clippy::all,
  17. missing_docs,
  18. non_camel_case_types,
  19. non_upper_case_globals,
  20. non_snake_case,
  21. improper_ctypes,
  22. unreachable_pub,
  23. unsafe_op_in_unsafe_fn
  24. )]
  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. include!(concat!(
  41. env!("OBJTREE"),
  42. "/rust/bindings/bindings_helpers_generated.rs"
  43. ));
  44. }
  45. pub use bindings_raw::*;
  46. pub const GFP_KERNEL: gfp_t = BINDINGS_GFP_KERNEL;
  47. pub const __GFP_ZERO: gfp_t = BINDINGS___GFP_ZERO;