We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc33ea8 commit aaf5d63Copy full SHA for aaf5d63
rust/kernel/lib.rs
@@ -131,15 +131,25 @@ impl ThisModule {
131
bindings::kernel_param_lock(self.0)
132
}
133
134
- KParamGuard { this_module: self }
+ #[cfg(CONFIG_SYSFS)]
135
+ return KParamGuard { this_module: self };
136
+
137
+ #[cfg(not(CONFIG_SYSFS))]
138
+ return KParamGuard { _private: () };
139
140
141
142
/// Scoped lock on the kernel parameters of [`ThisModule`].
143
///
144
/// Lock will be released when this struct is dropped.
145
+#[cfg_attr(CONFIG_SYSFS, repr(transparent))]
146
pub struct KParamGuard<'a> {
147
148
this_module: &'a ThisModule,
149
150
+ // private field, so this struct can not be constructed from outside this crate
151
152
+ _private: (),
153
154
155
#[cfg(CONFIG_SYSFS)]
0 commit comments