* [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head"
@ 2024-01-05 1:29 Charalampos Mitrodimas
2024-01-05 3:27 ` Martin Rodriguez Reboredo
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Charalampos Mitrodimas @ 2024-01-05 1:29 UTC (permalink / raw)
To: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, aliceryhl, a.hindborg
Cc: rust-for-linux, linux-kernel, Charalampos Mitrodimas
Fields named "wait_list" usually are of type "struct list_head". To
avoid confusion and because it is of type
"Opaque<bindings::wait_queue_head>" we are renaming "wait_list" to
"wait_queue_head".
Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
---
rust/kernel/sync/condvar.rs | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/rust/kernel/sync/condvar.rs b/rust/kernel/sync/condvar.rs
index b679b6f6dbeb..ea0d559fbde5 100644
--- a/rust/kernel/sync/condvar.rs
+++ b/rust/kernel/sync/condvar.rs
@@ -73,7 +73,7 @@ macro_rules! new_condvar {
#[pin_data]
pub struct CondVar {
#[pin]
- pub(crate) wait_list: Opaque<bindings::wait_queue_head>,
+ pub(crate) wait_queue_head: Opaque<bindings::wait_queue_head>,
/// A condvar needs to be pinned because it contains a [`struct list_head`] that is
/// self-referential, so it cannot be safely moved once it is initialised.
@@ -96,7 +96,7 @@ pub fn new(name: &'static CStr, key: &'static LockClassKey) -> impl PinInit<Self
_pin: PhantomPinned,
// SAFETY: `slot` is valid while the closure is called and both `name` and `key` have
// static lifetimes so they live indefinitely.
- wait_list <- Opaque::ffi_init(|slot| unsafe {
+ wait_queue_head <- Opaque::ffi_init(|slot| unsafe {
bindings::__init_waitqueue_head(slot, name.as_char_ptr(), key.as_ptr())
}),
})
@@ -108,16 +108,20 @@ fn wait_internal<T: ?Sized, B: Backend>(&self, wait_state: u32, guard: &mut Guar
// SAFETY: `wait` points to valid memory.
unsafe { bindings::init_wait(wait.get()) };
- // SAFETY: Both `wait` and `wait_list` point to valid memory.
+ // SAFETY: Both `wait` and `wait_queue_head` point to valid memory.
unsafe {
- bindings::prepare_to_wait_exclusive(self.wait_list.get(), wait.get(), wait_state as _)
+ bindings::prepare_to_wait_exclusive(
+ self.wait_queue_head.get(),
+ wait.get(),
+ wait_state as _,
+ )
};
// SAFETY: No arguments, switches to another thread.
guard.do_unlocked(|| unsafe { bindings::schedule() });
- // SAFETY: Both `wait` and `wait_list` point to valid memory.
- unsafe { bindings::finish_wait(self.wait_list.get(), wait.get()) };
+ // SAFETY: Both `wait` and `wait_queue_head` point to valid memory.
+ unsafe { bindings::finish_wait(self.wait_queue_head.get(), wait.get()) };
}
/// Releases the lock and waits for a notification in interruptible mode.
@@ -144,10 +148,10 @@ pub fn wait_uninterruptible<T: ?Sized, B: Backend>(&self, guard: &mut Guard<'_,
/// Calls the kernel function to notify the appropriate number of threads with the given flags.
fn notify(&self, count: i32, flags: u32) {
- // SAFETY: `wait_list` points to valid memory.
+ // SAFETY: `wait_queue_head` points to valid memory.
unsafe {
bindings::__wake_up(
- self.wait_list.get(),
+ self.wait_queue_head.get(),
bindings::TASK_NORMAL,
count,
flags as _,
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head"
2024-01-05 1:29 [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head" Charalampos Mitrodimas
@ 2024-01-05 3:27 ` Martin Rodriguez Reboredo
2024-01-05 9:42 ` Alice Ryhl
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Martin Rodriguez Reboredo @ 2024-01-05 3:27 UTC (permalink / raw)
To: Charalampos Mitrodimas, ojeda, alex.gaynor, wedsonaf, boqun.feng,
gary, bjorn3_gh, benno.lossin, aliceryhl, a.hindborg
Cc: rust-for-linux, linux-kernel
On 1/4/24 22:29, Charalampos Mitrodimas wrote:
> Fields named "wait_list" usually are of type "struct list_head". To
> avoid confusion and because it is of type
> "Opaque<bindings::wait_queue_head>" we are renaming "wait_list" to
> "wait_queue_head".
>
> Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
> ---
> [...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head"
2024-01-05 1:29 [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head" Charalampos Mitrodimas
2024-01-05 3:27 ` Martin Rodriguez Reboredo
@ 2024-01-05 9:42 ` Alice Ryhl
2024-01-10 9:56 ` Benno Lossin
2024-01-22 14:58 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Alice Ryhl @ 2024-01-05 9:42 UTC (permalink / raw)
To: Charalampos Mitrodimas
Cc: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, rust-for-linux, linux-kernel
On Fri, Jan 5, 2024 at 2:29 AM Charalampos Mitrodimas
<charmitro@posteo.net> wrote:
>
> Fields named "wait_list" usually are of type "struct list_head". To
> avoid confusion and because it is of type
> "Opaque<bindings::wait_queue_head>" we are renaming "wait_list" to
> "wait_queue_head".
>
> Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
This has merge conflicts with a bunch of other patchsets, but the
change itself looks good.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head"
2024-01-05 1:29 [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head" Charalampos Mitrodimas
2024-01-05 3:27 ` Martin Rodriguez Reboredo
2024-01-05 9:42 ` Alice Ryhl
@ 2024-01-10 9:56 ` Benno Lossin
2024-01-22 14:58 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Benno Lossin @ 2024-01-10 9:56 UTC (permalink / raw)
To: Charalampos Mitrodimas, ojeda, alex.gaynor, wedsonaf, boqun.feng,
gary, bjorn3_gh, aliceryhl, a.hindborg
Cc: rust-for-linux, linux-kernel
On 05.01.24 02:29, Charalampos Mitrodimas wrote:
> Fields named "wait_list" usually are of type "struct list_head". To
> avoid confusion and because it is of type
> "Opaque<bindings::wait_queue_head>" we are renaming "wait_list" to
> "wait_queue_head".
>
> Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
> ---
> rust/kernel/sync/condvar.rs | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Thanks for the patch!
--
Cheers,
Benno
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head"
2024-01-05 1:29 [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head" Charalampos Mitrodimas
` (2 preceding siblings ...)
2024-01-10 9:56 ` Benno Lossin
@ 2024-01-22 14:58 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2024-01-22 14:58 UTC (permalink / raw)
To: Charalampos Mitrodimas
Cc: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, aliceryhl, a.hindborg, rust-for-linux,
linux-kernel
On Fri, Jan 5, 2024 at 2:29 AM Charalampos Mitrodimas
<charmitro@posteo.net> wrote:
>
> Fields named "wait_list" usually are of type "struct list_head". To
> avoid confusion and because it is of type
> "Opaque<bindings::wait_queue_head>" we are renaming "wait_list" to
> "wait_queue_head".
Applied to `rust-next` -- thanks everyone!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-22 14:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05 1:29 [PATCH] rust: sync: `CondVar` rename "wait_list" to "wait_queue_head" Charalampos Mitrodimas
2024-01-05 3:27 ` Martin Rodriguez Reboredo
2024-01-05 9:42 ` Alice Ryhl
2024-01-10 9:56 ` Benno Lossin
2024-01-22 14:58 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®