rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	"Tiago Lam" <tiagolam@gmail.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Martin Rodriguez Reboredo" <yakoyoku@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/4] rust: sync: update integer types in CondVar
Date: Thu, 4 Jan 2024 14:47:01 -0800	[thread overview]
Message-ID: <ZZc1ZcgzdRHtipr0@boqun-archlinux> (raw)
In-Reply-To: <20240104-rb-new-condvar-methods-v3-4-70b514fcbe52@google.com>

On Thu, Jan 04, 2024 at 02:02:44PM +0000, Alice Ryhl wrote:
[...]
> -use core::ffi::c_long;
> +use core::ffi::{c_int, c_long, c_uint};

core::ffi::c_uint is not needed here. And 

	use core::ptr;

is missing (for the `ptr::mut_null()` below)

>  use core::marker::PhantomPinned;
>  use macros::pin_data;
>  
[...]
> @@ -174,23 +179,16 @@ pub fn wait_interruptible_timeout<T: ?Sized, B: Backend>(
>          }
>      }
>  
> -    /// Calls the kernel function to notify the appropriate number of threads with the given flags.
> -    fn notify(&self, count: i32, flags: u32) {
> +    /// Calls the kernel function to notify the appropriate number of threads.
> +    fn notify(&self, count: c_int) {
>          // SAFETY: `wait_list` points to valid memory.
> -        unsafe {
> -            bindings::__wake_up(
> -                self.wait_list.get(),
> -                bindings::TASK_NORMAL,
> -                count,
> -                flags as _,
> -            )
> -        };
> +        unsafe { bindings::__wake_up(self.wait_list.get(), TASK_NORMAL, count, ptr::null_mut()) };
>      }
>  
[...]
> diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs
> index ffb4a51eb898..37468613ac0d 100644
> --- a/rust/kernel/task.rs
> +++ b/rust/kernel/task.rs
> @@ -10,6 +10,14 @@

Missing:

	use core::ffi::{c_long, c_int, c_uint};

here.

Regards,
Boqun

>  /// A sentinal value used for infinite timeouts.
>  pub const MAX_SCHEDULE_TIMEOUT: c_long = c_long::MAX;
>  
> +/// Bitmask for tasks that are sleeping in an interruptible state.
> +pub const TASK_INTERRUPTIBLE: c_int = bindings::TASK_INTERRUPTIBLE as c_int;
> +/// Bitmask for tasks that are sleeping in an uninterruptible state.
> +pub const TASK_UNINTERRUPTIBLE: c_int = bindings::TASK_UNINTERRUPTIBLE as c_int;
> +/// Convenience constant for waking up tasks regardless of whether they are in interruptible or
> +/// uninterruptible sleep.
> +pub const TASK_NORMAL: c_uint = bindings::TASK_NORMAL as c_uint;
> +
>  /// Returns the currently running task.
>  #[macro_export]
>  macro_rules! current {
> 
> -- 
> 2.43.0.472.g3155946c3a-goog
> 

  parent reply	other threads:[~2024-01-04 22:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 14:02 [PATCH v3 0/4] Additional CondVar methods needed by Rust Binder Alice Ryhl
2024-01-04 14:02 ` [PATCH v3 1/4] rust: sync: add `CondVar::notify_sync` Alice Ryhl
2024-01-04 18:56   ` Boqun Feng
2024-01-04 14:02 ` [PATCH v3 2/4] rust: time: add msecs to jiffies conversion Alice Ryhl
2024-01-04 14:02 ` [PATCH v3 3/4] rust: sync: add `CondVar::wait_timeout` Alice Ryhl
2024-01-04 22:18   ` Boqun Feng
2024-01-05 10:30     ` Alice Ryhl
2024-01-04 22:44   ` Boqun Feng
2024-01-04 14:02 ` [PATCH v3 4/4] rust: sync: update integer types in CondVar Alice Ryhl
2024-01-04 14:19   ` Martin Rodriguez Reboredo
2024-01-04 22:47   ` Boqun Feng [this message]
2024-01-05  9:44     ` Alice Ryhl
2024-01-04 14:17 ` [PATCH v3 0/4] Additional CondVar methods needed by Rust Binder Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZc1ZcgzdRHtipr0@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tiagolam@gmail.com \
    --cc=wedsonaf@gmail.com \
    --cc=will@kernel.org \
    --cc=yakoyoku@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).