Lines Matching +full:core +full:- +full:module

1 // SPDX-License-Identifier: GPL-2.0
36 module: &'a str,
43 fn new(module: &'a str) -> Self {
45 module,
54 // Built-in modules prefix their modinfo strings by `module.`.
56 "{module}.{field}={content}\0",
57 module = self.module,
62 // Loadable modules' modinfo strings go as-is.
68 quote!(#[cfg(not(MODULE))])
70 quote!(#[cfg(MODULE)])
74 "__{module}_{counter}",
75 module = self.module.to_uppercase(),
132 let static_name = format_ident!("__{}_{}_struct", self.module, param.name);
134 CString::new(param_name_str).expect("name contains NUL-terminator");
136 CString::new(format!("{}.{}", self.module, param.name))
137 .expect("name contains NUL-terminator");
158 if ::core::cfg!(MODULE) {
165 // time and will not be freed until the module is unloaded.
166 #[cfg(MODULE)]
168 core::ptr::from_ref(&::kernel::bindings::__this_module)
171 #[cfg(not(MODULE))]
172 mod_: ::core::ptr::null_mut(),
173 ops: core::ptr::from_ref(&#ops),
175 level: -1,
188 fn param_ops_path(param_type: &str) -> Path {
349 fn parse(input: ParseStream<'_>) -> Result<Self> {
385 fn parse(input: ParseStream<'_>) -> Result<Self> {
433 pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
447 let ident = name.value().replace('-', "_");
474 // Built-in modules also export the `file` modinfo string.
492 .long __{ident}_init - .
497 let name_cstr = CString::new(name.value()).expect("name contains NUL-terminator");
500 /// The module name.
506 // freed until the module is unloaded.
507 #[cfg(MODULE)]
510 static __this_module: ::kernel::types::Opaque<::kernel::bindings::module>;
516 #[cfg(not(MODULE))]
518 ::kernel::ThisModule::from_ptr(::core::ptr::null_mut())
521 /// The `LocalModule` type is the type of the module created by `module!`,
535 /// The "Rust loadable module" mark.
539 #[cfg(MODULE)]
543 static mut __MOD: ::core::mem::MaybeUninit<super::super::LocalModule> =
544 ::core::mem::MaybeUninit::uninit();
549 /// This function must not be called after module initialization, because it may be
551 #[cfg(MODULE)]
554 pub unsafe extern "C" fn init_module() -> ::kernel::ffi::c_int {
556 // module wrapping it. It is called exactly once by the C side via its
561 #[cfg(MODULE)]
564 static __UNIQUE_ID___addressable_init_module: unsafe extern "C" fn() -> i32 =
567 #[cfg(MODULE)]
572 // - This function is inaccessible to the outside due to the double
573 // module wrapping it. It is called exactly once by the C side via its
575 // - furthermore it is only called after `init_module` has returned `0`
580 #[cfg(MODULE)]
585 // Built-in modules are initialized through an initcall pointer
587 #[cfg(not(MODULE))]
591 pub static #ident_initcall: extern "C" fn() ->
594 #[cfg(not(MODULE))]
596 ::core::arch::global_asm!(#global_asm);
598 #[cfg(not(MODULE))]
600 pub extern "C" fn #ident_init() -> ::kernel::ffi::c_int {
602 // module wrapping it. It is called exactly once by the C side via its
607 #[cfg(not(MODULE))]
611 // - This function is inaccessible to the outside due to the double
612 // module wrapping it. It is called exactly once by the C side via its
614 // - furthermore it is only called after `#ident_init` has
622 unsafe fn __init() -> ::kernel::ffi::c_int {
626 // SAFETY: No data race, since `__MOD` can only be accessed by this module
638 /// - only be called once,
639 /// - be called after `__init` has been called and returned `0`.
641 // SAFETY: No data race, since `__MOD` can only be accessed by this module