Re: [PATCH v2 4/4] rust: add abstraction for `struct page`

From: Andreas Hindborg
Date: Tue Feb 27 2024 - 03:36:39 EST



Hi Alice,

Alice Ryhl <aliceryhl@xxxxxxxxxx> writes:

> Adds a new struct called `Page` that wraps a pointer to `struct page`.
> This struct is assumed to hold ownership over the page, so that Rust
> code can allocate and manage pages directly.

<cut>

> +/// A bitwise shift for the page size.
> +pub const PAGE_SHIFT: usize = bindings::PAGE_SHIFT as usize;
> +/// The number of bytes in a page.
> +pub const PAGE_SIZE: usize = 1 << PAGE_SHIFT;

For consistency, could we get page size from bindings as well? The folio
patches already do this [1].

BR Andreas


[1] https://lore.kernel.org/rust-for-linux/20231018122518.128049-10-wedsonaf@xxxxxxxxx/