@@ -77,7 +77,7 @@ pub unsafe trait Backend {
77
77
///
78
78
/// Exposes one of the kernel locking primitives. Which one is exposed depends on the lock
79
79
/// [`Backend`] specified as the generic parameter `B`.
80
- #[ cfg( not( CONFIG_RROS ) ) ]
80
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
81
81
#[ pin_data]
82
82
pub struct Lock < T : ?Sized , B : Backend > {
83
83
/// The kernel lock object.
@@ -95,15 +95,15 @@ pub struct Lock<T: ?Sized, B: Backend> {
95
95
}
96
96
97
97
// SAFETY: `Lock` can be transferred across thread boundaries iff the data it protects can.
98
- #[ cfg( not( CONFIG_RROS ) ) ]
98
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
99
99
unsafe impl < T : ?Sized + Send , B : Backend > Send for Lock < T , B > { }
100
100
101
101
// SAFETY: `Lock` serialises the interior mutability it provides, so it is `Sync` as long as the
102
102
// data it protects is `Send`.
103
- #[ cfg( not( CONFIG_RROS ) ) ]
103
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
104
104
unsafe impl < T : ?Sized + Send , B : Backend > Sync for Lock < T , B > { }
105
105
106
- #[ cfg( not( CONFIG_RROS ) ) ]
106
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
107
107
impl < T , B : Backend > Lock < T , B > {
108
108
/// Constructs a new lock initialiser.
109
109
#[ allow( clippy:: new_ret_no_self) ]
@@ -120,7 +120,7 @@ impl<T, B: Backend> Lock<T, B> {
120
120
}
121
121
}
122
122
123
- #[ cfg( not( CONFIG_RROS ) ) ]
123
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
124
124
impl < T : ?Sized , B : Backend > Lock < T , B > {
125
125
/// Acquires the lock and gives the caller access to the data protected by it.
126
126
pub fn lock ( & self ) -> Guard < ' _ , T , B > {
@@ -137,7 +137,7 @@ impl<T: ?Sized, B: Backend> Lock<T, B> {
137
137
/// Allows mutual exclusion primitives that implement the [`Backend`] trait to automatically unlock
138
138
/// when a guard goes out of scope. It also provides a safe and convenient way to access the data
139
139
/// protected by the lock.
140
- #[ cfg( not( CONFIG_RROS ) ) ]
140
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
141
141
#[ must_use = "the lock unlocks immediately when the guard is unused" ]
142
142
pub struct Guard < ' a , T : ?Sized , B : Backend > {
143
143
pub ( crate ) lock : & ' a Lock < T , B > ,
@@ -146,10 +146,10 @@ pub struct Guard<'a, T: ?Sized, B: Backend> {
146
146
}
147
147
148
148
// SAFETY: `Guard` is sync when the data protected by the lock is also sync.
149
- #[ cfg( not( CONFIG_RROS ) ) ]
149
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
150
150
unsafe impl < T : Sync + ?Sized , B : Backend > Sync for Guard < ' _ , T , B > { }
151
151
152
- #[ cfg( not( CONFIG_RROS ) ) ]
152
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
153
153
impl < T : ?Sized , B : Backend > Guard < ' _ , T , B > {
154
154
pub ( crate ) fn do_unlocked ( & mut self , cb : impl FnOnce ( ) ) {
155
155
// SAFETY: The caller owns the lock, so it is safe to unlock it.
@@ -163,7 +163,7 @@ impl<T: ?Sized, B: Backend> Guard<'_, T, B> {
163
163
}
164
164
}
165
165
166
- #[ cfg( not( CONFIG_RROS ) ) ]
166
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
167
167
impl < T : ?Sized , B : Backend > core:: ops:: Deref for Guard < ' _ , T , B > {
168
168
type Target = T ;
169
169
@@ -173,23 +173,23 @@ impl<T: ?Sized, B: Backend> core::ops::Deref for Guard<'_, T, B> {
173
173
}
174
174
}
175
175
176
- #[ cfg( not( CONFIG_RROS ) ) ]
176
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
177
177
impl < T : ?Sized , B : Backend > core:: ops:: DerefMut for Guard < ' _ , T , B > {
178
178
fn deref_mut ( & mut self ) -> & mut Self :: Target {
179
179
// SAFETY: The caller owns the lock, so it is safe to deref the protected data.
180
180
unsafe { & mut * self . lock . data . get ( ) }
181
181
}
182
182
}
183
183
184
- #[ cfg( not( CONFIG_RROS ) ) ]
184
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
185
185
impl < T : ?Sized , B : Backend > Drop for Guard < ' _ , T , B > {
186
186
fn drop ( & mut self ) {
187
187
// SAFETY: The caller owns the lock, so it is safe to unlock it.
188
188
unsafe { B :: unlock ( self . lock . state . get ( ) , & self . state ) } ;
189
189
}
190
190
}
191
191
192
- #[ cfg( not( CONFIG_RROS ) ) ]
192
+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
193
193
impl < ' a , T : ?Sized , B : Backend > Guard < ' a , T , B > {
194
194
/// Constructs a new immutable lock guard.
195
195
///
@@ -247,7 +247,7 @@ pub trait NeedsLockClass {
247
247
}
248
248
249
249
/// Reschedules the caller's task if needed.
250
- #[ cfg( CONFIG_RROS ) ]
250
+ #[ cfg( CONFIG_RROS_SPINLOCK ) ]
251
251
pub fn cond_resched ( ) -> bool {
252
252
// SAFETY: No arguments, reschedules `current` if needed.
253
253
unsafe { rust_helper_cond_resched ( ) != 0 }
0 commit comments