Re: [PATCH 1/2] rust: mm: add VmaRef range query helpers
"Alexandre Courbot" <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Tue Aug 11, 2026 at 12:26 PM JST, liujinlong wrote: > From: liujinlong <[email protected]> > > Add helpers on VmaRef to query the virtual address span and test > address membership: > > len(), is_empty() - byte span and zero-length check > contains() - single-address membership in > [vm_start, vm_end) > contains_range() - sub-range membership, returns false > on overflow > is_page_aligned() - PAGE_SIZE alignment for one address > is_page_aligned_range() - PAGE_SIZE alignment for addr and size > > is_page_aligned() and is_page_aligned_range() are associated > functions rather than methods, since they do not reference any VMA > state. They live here instead of a separate utility module to > keep the page-alignment helpers close to the range-checking code > that often uses them. > > Signed-off-by: liujinlong <[email protected]> I guess a more useful implementation would be to just return a `Range` of `start..end` and benefit from all its methods, which cover most of those defined in this patch.