Lines Matching +full:kernel +full:- +full:parameters

1 // SPDX-License-Identifier: GPL-2.0
3 //! Support for module parameters.
10 use kernel::sync::SetOnce;
19 pub const fn new(val: bindings::kernel_param) -> Self { in new()
24 // SAFETY: C kernel handles serializing access to this type. We never access it
28 /// Types that can be used for module parameters.
32 fn try_from_param_arg(arg: &BStr) -> Result<Self>; in try_from_param_arg()
37 /// Used to set the parameter value at kernel initialization, when loading
44 /// - If `val` is non-null then it must point to a valid null-terminated string that must be valid
46 /// - `param` must be a pointer to a `bindings::kernel_param` initialized by the rust module macro.
51 /// - The safety requirements are satisfied by C API contract when this function is invoked by the
53 /// - Currently, we only support read-only parameters that are not readable from `sysfs`. Thus, this
54 /// function is only called at kernel initialization time, or at module load time, and we have
58 unsafe extern "C" fn set_param<T>(val: *const c_char, param: *const bindings::kernel_param) -> c_int in set_param()
70 // SAFETY: By function safety requirement, val is non-null, null-terminated in set_param()
84 .ok_or(kernel::error::code::EEXIST) in set_param()
91 fn try_from_param_arg(arg: &BStr) -> Result<Self> {
109 /// A wrapper for kernel parameters.
111 /// This type is instantiated by the [`module!`] macro when module parameters are
127 pub const fn new(default: T) -> Self { in new()
135 // Note: When sysfs access to parameters are enabled, we have to pass in a
137 pub fn value(&self) -> &T { in value()
144 pub const fn as_void_ptr(&self) -> *mut c_void { in as_void_ptr()