From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
To: Qingsong Chen <changxian.cqs@antgroup.com>, linux-kernel@vger.kernel.org
Cc: 田洪亮 <tate.thl@antgroup.com>, "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v2 2/3] rust: kernel: implement iterators for ScatterList
Date: Fri, 2 Jun 2023 16:59:47 -0300 [thread overview]
Message-ID: <b792c9d8-3250-4dd6-19ba-06bb7cb9bc51@gmail.com> (raw)
In-Reply-To: <20230602101819.2134194-3-changxian.cqs@antgroup.com>
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@antgroup.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.
> +}
> +
> [...]
next prev parent reply other threads:[~2023-06-02 20:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 10:18 [PATCH v2 0/3] Rust scatterlist abstractions Qingsong Chen
2023-06-02 10:18 ` [PATCH v2 1/3] rust: kernel: add ScatterList abstraction Qingsong Chen
2023-06-02 19:54 ` Martin Rodriguez Reboredo
2023-06-05 8:12 ` Qingsong Chen
2023-06-05 11:36 ` Miguel Ojeda
2023-06-05 15:26 ` Boqun Feng
2023-06-06 7:01 ` Qingsong Chen
2023-06-07 17:18 ` Boqun Feng
2023-06-07 18:42 ` Gary Guo
2023-06-07 19:40 ` Boqun Feng
2023-06-02 10:18 ` [PATCH v2 2/3] rust: kernel: implement iterators for ScatterList Qingsong Chen
2023-06-02 19:59 ` Martin Rodriguez Reboredo [this message]
2023-06-02 10:18 ` [PATCH v2 3/3] rust: kernel: add SgTable abstraction Qingsong Chen
2023-06-02 20:47 ` Martin Rodriguez Reboredo
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=b792c9d8-3250-4dd6-19ba-06bb7cb9bc51@gmail.com \
--to=yakoyoku@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=changxian.cqs@antgroup.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tate.thl@antgroup.com \
--cc=wedsonaf@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).