From: Alice Ryhl <aliceryhl@google.com>
To: Burak Emir <bqe@google.com>
Cc: "Yury Norov" <yury.norov@gmail.com>,
"Kees Cook" <kees@kernel.org>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@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>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Gustavo A . R . Silva" <gustavoars@kernel.org>,
"Carlos LLama" <cmllamas@google.com>,
"Pekka Ristola" <pekkarr@protonmail.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v12 3/5] rust: add bitmap API.
Date: Thu, 12 Jun 2025 10:49:45 +0200 [thread overview]
Message-ID: <CAH5fLghV4gYWMyscY2y+TwwqMW_497Sg0sj_HuzNH4nB_5u6Bg@mail.gmail.com> (raw)
In-Reply-To: <CACQBu=W4PziG3Fsnzqu_wu-vgBThktD7FcEJ-vOhOMhNDz8h3g@mail.gmail.com>
On Thu, Jun 12, 2025 at 10:47 AM Burak Emir <bqe@google.com> wrote:
>
> On Wed, Jun 11, 2025 at 11:58 PM Alice Ryhl <aliceryhl@google.com> wrote:
> >
> > On Wed, Jun 11, 2025 at 9:48 PM Burak Emir <bqe@google.com> wrote:
> [...]
> > > diff --git a/rust/kernel/bitmap.rs b/rust/kernel/bitmap.rs
> > > new file mode 100644
> > > index 000000000000..1fe72ca980ac
> > > --- /dev/null
> > > +++ b/rust/kernel/bitmap.rs
> > > @@ -0,0 +1,582 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +
> > > +// Copyright (C) 2025 Google LLC.
> > > +
> > > +//! Rust API for bitmap.
> > > +//!
> > > +//! C headers: [`include/linux/bitmap.h`](srctree/include/linux/bitmap.h).
> > > +
> > > +use crate::alloc::{AllocError, Flags};
> > > +use crate::bindings;
> > > +#[cfg(not(CONFIG_RUST_BITMAP_HARDENED))]
> > > +use crate::pr_err;
> > > +use core::ptr::NonNull;
> > > +
> > > +/// Represents a C bitmap. Wraps underlying C bitmap API.
> > > +///
> > > +/// # Invariants
> > > +///
> > > +/// Must reference a `[c_ulong]` long enough to fit `data.len()` bits.
> > > +#[cfg_attr(CONFIG_64BIT, repr(align(8)))]
> > > +#[cfg_attr(not(CONFIG_64BIT), repr(align(4)))]
> > > +pub struct CBitmap {
> > > + data: [()],
> > > +}
> >
> > I wonder if we should just call this type Bitmap?
> >
>
> OK. I am renaming the other type to OwnedBitmap then.
Just thinking a bit more about naming ... how about calling it
BitmapVec? Rust generally uses the terminology "Vec" to refer to
arrays whose size is not known at compile-time, and "Array" when the
size is known. Then, if we eventually add another type for declaring
fixed-size bitmaps in Rust, that type can be BitmapArray (that's the
type you'll want in a global).
Alice
next prev parent reply other threads:[~2025-06-12 8:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 19:48 [PATCH v12 0/5] rust: adds Bitmap API, ID pool and bindings Burak Emir
2025-06-11 19:48 ` [PATCH v12 1/5] rust: add bindings for bitmap.h Burak Emir
2025-06-11 19:48 ` [PATCH v12 2/5] rust: add bindings for bitops.h Burak Emir
2025-06-11 19:48 ` [PATCH v12 3/5] rust: add bitmap API Burak Emir
2025-06-11 21:58 ` Alice Ryhl
2025-06-12 8:46 ` Burak Emir
2025-06-12 8:49 ` Alice Ryhl [this message]
2025-06-12 9:04 ` Burak Emir
2025-06-12 9:52 ` Miguel Ojeda
2025-06-19 9:32 ` Burak Emir
2025-06-16 10:49 ` Alice Ryhl
2025-06-19 9:49 ` Burak Emir
2025-06-19 10:50 ` Alice Ryhl
2025-06-11 19:48 ` [PATCH v12 4/5] rust: add find_bit_benchmark_rust module Burak Emir
2025-06-12 8:58 ` Alice Ryhl
2025-06-11 19:48 ` [PATCH v12 5/5] rust: add dynamic ID pool abstraction for bitmap Burak Emir
2025-06-12 9:09 ` Alice Ryhl
2025-06-20 8:27 ` Burak Emir
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=CAH5fLghV4gYWMyscY2y+TwwqMW_497Sg0sj_HuzNH4nB_5u6Bg@mail.gmail.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=bqe@google.com \
--cc=cmllamas@google.com \
--cc=gary@garyguo.net \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=ojeda@kernel.org \
--cc=pekkarr@protonmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=viresh.kumar@linaro.org \
--cc=yury.norov@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).