[PATCH 1/5] Cygwin: mmap: refactor mmap_record::match
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu Jan 9 17:17:51 GMT 2025
Hi Ken,
On Jan 8 18:03, Ken Brown wrote:
> From 4387a73d5593ddad4cf7592865b5b257e6a9d6de Mon Sep 17 00:00:00 2001
> From: Ken Brown <kbrown@cornell.edu>
> Date: Fri, 27 Dec 2024 15:30:12 -0500
> Subject: [PATCH 1/5] Cygwin: mmap: refactor mmap_record::match
>
> Slightly simplify the code and add comments to explain what the
> function does. Add a new reference parameter "contains" that is set
> to true if the chunk of this mmap_record contains the given address
> range.
>
> Signed-off-by: Ken Brown <kbrown@cornell.edu>
> ---
> winsup/cygwin/mm/mmap.cc | 37 ++++++++++++++++++++++++++-----------
> 1 file changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc
> index 0224779458ef..acab85d19cf0 100644
> --- a/winsup/cygwin/mm/mmap.cc
> +++ b/winsup/cygwin/mm/mmap.cc
> @@ -338,7 +338,8 @@ class mmap_record
> void init_page_map (mmap_record &r);
>
> SIZE_T find_unused_pages (SIZE_T pages) const;
> - bool match (caddr_t addr, SIZE_T len, caddr_t &m_addr, SIZE_T &m_len);
> + bool match (caddr_t addr, SIZE_T len, caddr_t &m_addr, SIZE_T &m_len,
> + bool &contains);
What about keeping
bool match (caddr_t addr, SIZE_T len, caddr_t &m_addr, SIZE_T &m_len);
available as inline method just calling the new match() method with
a local "contains" variable? This way, you don't have to define dummy
"contains" where the value is unused...
Other than that, LGTM.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list