On 05.02.20 20:56, Murilo Opsfelder Araújo wrote: > Hello, David. > > On 2/3/20 3:31 PM, David Hildenbrand wrote: >> We want to populate memory within a reserved memory region. Let's factor >> that out. >> >> Cc: "Michael S. Tsirkin" <[email protected]> >> Cc: Greg Kurz <[email protected]> >> Cc: Murilo Opsfelder Araujo <[email protected]> >> Cc: Eduardo Habkost <[email protected]> >> Cc: "Dr. David Alan Gilbert" <[email protected]> >> Signed-off-by: David Hildenbrand <[email protected]> >> --- > > Acked-by: Murilo Opsfelder Araujo <[email protected]> > > A minor comment below. > >> util/mmap-alloc.c | 89 +++++++++++++++++++++++++---------------------- >> 1 file changed, 47 insertions(+), 42 deletions(-) >> >> diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c >> index 43a26f38a8..f043ccb0ab 100644 >> --- a/util/mmap-alloc.c >> +++ b/util/mmap-alloc.c >> @@ -114,6 +114,50 @@ static void *mmap_reserve(size_t size, int fd) >> return mmap(0, size, PROT_NONE, flags, fd, 0); >> } >> >> +/* >> + * Populate memory in a reserved region from the given fd (if any). >> + */ >> +static void *mmap_populate(void *ptr, size_t size, int fd, bool shared, >> + bool is_pmem) >> +{ >> + int map_sync_flags = 0; >> + int flags = MAP_FIXED; >> + void *new_ptr; > > Do you think another name would be welcome here, e.g.: "populated_ptr" or > "populated_memptr" or just "populated"?
I'll go with populated_ptr - thanks! -- Thanks, David / dhildenb
