[PATCH 01/10] rust: kernel: move `allocator` module under `alloc`

Wedson Almeida Filho posted 10 patches 1 year, 10 months ago
There is a newer version of this series
[PATCH 01/10] rust: kernel: move `allocator` module under `alloc`
Posted by Wedson Almeida Filho 1 year, 10 months ago
From: Wedson Almeida Filho <walmeida@microsoft.com>

We will add more to the `alloc` module in subsequent patches (e.g.,
allocation flags and extension traits).

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 rust/kernel/alloc.rs                 | 7 +++++++
 rust/kernel/{ => alloc}/allocator.rs | 0
 rust/kernel/lib.rs                   | 4 +---
 3 files changed, 8 insertions(+), 3 deletions(-)
 create mode 100644 rust/kernel/alloc.rs
 rename rust/kernel/{ => alloc}/allocator.rs (100%)

diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
new file mode 100644
index 000000000000..ccd4149932c3
--- /dev/null
+++ b/rust/kernel/alloc.rs
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! Allocation support.
+
+#[cfg(not(test))]
+#[cfg(not(testlib))]
+mod allocator;
diff --git a/rust/kernel/allocator.rs b/rust/kernel/alloc/allocator.rs
similarity index 100%
rename from rust/kernel/allocator.rs
rename to rust/kernel/alloc/allocator.rs
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index be68d5e567b1..51f30e55bd00 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -28,9 +28,7 @@
 // Allow proc-macros to refer to `::kernel` inside the `kernel` crate (this crate).
 extern crate self as kernel;
 
-#[cfg(not(test))]
-#[cfg(not(testlib))]
-mod allocator;
+pub mod alloc;
 mod build_assert;
 pub mod error;
 pub mod init;
-- 
2.34.1
Re: [PATCH 01/10] rust: kernel: move `allocator` module under `alloc`
Posted by Benno Lossin 1 year, 10 months ago
On 25.03.24 20:54, Wedson Almeida Filho wrote:> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> We will add more to the `alloc` module in subsequent patches (e.g.,
> allocation flags and extension traits).
> 
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

One nit below, but feel free to add:

Reviewed-by: Benno Lossin <benno.lossin@proton.me>

> ---
>   rust/kernel/alloc.rs                 | 7 +++++++
>   rust/kernel/{ => alloc}/allocator.rs | 0
>   rust/kernel/lib.rs                   | 4 +---
>   3 files changed, 8 insertions(+), 3 deletions(-)
>   create mode 100644 rust/kernel/alloc.rs
>   rename rust/kernel/{ => alloc}/allocator.rs (100%)
> 
> diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
> new file mode 100644
> index 000000000000..ccd4149932c3
> --- /dev/null
> +++ b/rust/kernel/alloc.rs
> @@ -0,0 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +//! Allocation support.

I think 'Extensions to the `alloc` crate.' fits better.

-- 
Cheers,
Benno

> +
> +#[cfg(not(test))]
> +#[cfg(not(testlib))]
> +mod allocator;
> diff --git a/rust/kernel/allocator.rs b/rust/kernel/alloc/allocator.rs
> similarity index 100%
> rename from rust/kernel/allocator.rs
> rename to rust/kernel/alloc/allocator.rs
> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
> index be68d5e567b1..51f30e55bd00 100644
> --- a/rust/kernel/lib.rs
> +++ b/rust/kernel/lib.rs
> @@ -28,9 +28,7 @@
>   // Allow proc-macros to refer to `::kernel` inside the `kernel` crate (this crate).
>   extern crate self as kernel;
> 
> -#[cfg(not(test))]
> -#[cfg(not(testlib))]
> -mod allocator;
> +pub mod alloc;
>   mod build_assert;
>   pub mod error;
>   pub mod init;
> --
> 2.34.1
>
Re: [PATCH 01/10] rust: kernel: move `allocator` module under `alloc`
Posted by Wedson Almeida Filho 1 year, 10 months ago
On Mon, 25 Mar 2024 at 18:56, Benno Lossin <benno.lossin@proton.me> wrote:
>
> On 25.03.24 20:54, Wedson Almeida Filho wrote:> From: Wedson Almeida Filho <walmeida@microsoft.com>
> >
> > We will add more to the `alloc` module in subsequent patches (e.g.,
> > allocation flags and extension traits).
> >
> > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
>
> One nit below, but feel free to add:
>
> Reviewed-by: Benno Lossin <benno.lossin@proton.me>
>
> > ---
> >   rust/kernel/alloc.rs                 | 7 +++++++
> >   rust/kernel/{ => alloc}/allocator.rs | 0
> >   rust/kernel/lib.rs                   | 4 +---
> >   3 files changed, 8 insertions(+), 3 deletions(-)
> >   create mode 100644 rust/kernel/alloc.rs
> >   rename rust/kernel/{ => alloc}/allocator.rs (100%)
> >
> > diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
> > new file mode 100644
> > index 000000000000..ccd4149932c3
> > --- /dev/null
> > +++ b/rust/kernel/alloc.rs
> > @@ -0,0 +1,7 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +//! Allocation support.
>
> I think 'Extensions to the `alloc` crate.' fits better.

SGTM. I will update for v2.

>
> --
> Cheers,
> Benno
>
> > +
> > +#[cfg(not(test))]
> > +#[cfg(not(testlib))]
> > +mod allocator;
> > diff --git a/rust/kernel/allocator.rs b/rust/kernel/alloc/allocator.rs
> > similarity index 100%
> > rename from rust/kernel/allocator.rs
> > rename to rust/kernel/alloc/allocator.rs
> > diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
> > index be68d5e567b1..51f30e55bd00 100644
> > --- a/rust/kernel/lib.rs
> > +++ b/rust/kernel/lib.rs
> > @@ -28,9 +28,7 @@
> >   // Allow proc-macros to refer to `::kernel` inside the `kernel` crate (this crate).
> >   extern crate self as kernel;
> >
> > -#[cfg(not(test))]
> > -#[cfg(not(testlib))]
> > -mod allocator;
> > +pub mod alloc;
> >   mod build_assert;
> >   pub mod error;
> >   pub mod init;
> > --
> > 2.34.1
> >