[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b792c9d8-3250-4dd6-19ba-06bb7cb9bc51@gmail.com>
Date: Fri, 2 Jun 2023 16:59:47 -0300
From: Martin Rodriguez Reboredo <yakoyoku@...il.com>
To: Qingsong Chen <changxian.cqs@...group.com>,
linux-kernel@...r.kernel.org
Cc: 田洪亮 <tate.thl@...group.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 2/3] rust: kernel: implement iterators for ScatterList
On 6/2/23 07:18, Qingsong Chen wrote:
> ScatterList could be transmuted from raw pointers of a valid
> `sg_table`. Then we can use those iterators to access the
> following normal entries.
>
> Signed-off-by: Qingsong Chen <changxian.cqs@...group.com>
> ---
> [...]
> + /// Get an iterator for immutable references.
> + pub fn iter(&self) -> Iter<'_> {
> + Iter(ScatterList::as_ref(self.opaque.get()))
> + }
> +
> + /// Get an iterator for mutable references.
> + pub fn iter_mut(&mut self) -> IterMut<'_> {
> + IterMut(ScatterList::as_mut(self.opaque.get()))
> + }
Per the previous commit, because both methods are unsafe you should put
the `SAFETY` comment on them.
> +}
> +
> [...]
Powered by blists - more mailing lists