rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wedson Almeida Filho <wedsonaf@gmail.com>
To: Antonio Hickey <antoniohickey99@gmail.com>
Cc: ojeda@kernel.org, alex.gaynor@gmail.com, boqun.feng@gmail.com,
	 gary@garyguo.net, bjorn3_gh@protonmail.com,
	benno.lossin@proton.me,  a.hindborg@samsung.com,
	aliceryhl@google.com, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust: task: add `as_raw()` to `Task`
Date: Tue, 16 Jan 2024 04:29:38 -0300	[thread overview]
Message-ID: <CANeycqpk77REoVvmdM-Lbb=rW0kyW7kNFfj_wRYto9G+qzaAmA@mail.gmail.com> (raw)
In-Reply-To: <20240116022823.64058-1-antoniohickey99@gmail.com>

On Mon, 15 Jan 2024 at 23:29, Antonio Hickey <antoniohickey99@gmail.com> wrote:
> +    /// Returns a raw pointer to the underlying C task struct.
> +    pub fn as_raw(&self) -> *mut bindings::task_struct {
> +        self.0.get()
> +    }
> +

Note that the wrapped `bindings::task_struct` in `Task` was
`pub(crate)`, but you're making `as_raw` fully public.

We don't want  modules to use the definitions in `bindings` (only
subsystems). So I'd suggest limiting `as_raw` to `pub(crate)`.

>      /// Wakes up the task.
>      pub fn wake_up(&self) {
> -        // SAFETY: By the type invariant, we know that `self.0.get()` is non-null and valid.
> +        // SAFETY: By the type invariant, we know that `self.raw()` is non-null and valid.

Typo in the comment: `raw` vs `as_raw`?

  parent reply	other threads:[~2024-01-16  7:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16  2:28 [PATCH] rust: task: add `as_raw()` to `Task` Antonio Hickey
2024-01-16  2:28 ` [PATCH] rust: task: use safe `current!` macro Antonio Hickey
2024-01-16  8:57   ` Alice Ryhl
2024-01-16  7:20 ` [PATCH] rust: task: add `as_raw()` to `Task` Greg KH
2024-01-16  7:29 ` Wedson Almeida Filho [this message]
2024-01-16  8:53   ` Alice Ryhl
2024-01-16 18:24 ` Boqun Feng
2024-01-16 19:03   ` Miguel Ojeda

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='CANeycqpk77REoVvmdM-Lbb=rW0kyW7kNFfj_wRYto9G+qzaAmA@mail.gmail.com' \
    --to=wedsonaf@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=antoniohickey99@gmail.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /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).