Re: [PATCH 7/8] mmap locking API: add MMAP_LOCK_INITIALIZER

From: Michel Lespinasse
Date: Mon Apr 06 2020 - 09:04:35 EST


On Mon, Apr 6, 2020 at 2:46 AM Laurent Dufour <ldufour@xxxxxxxxxxxxx> wrote:
>
> Le 26/03/2020 Ã 08:02, Michel Lespinasse a Ãcrit :
> > Define a new initializer for the mmap locking api.
> > Initially this just evaluates to __RWSEM_INITIALIZER as the API
> > is defined as wrappers around rwsem.
>
> I can't see the benefit of this change.
> The overall idea is to hide the mmap_sem name. Here the macro
> MMAP_LOCK_INITIALIZER() doesn't hide the name.

The idea for the initializer is that it makes it easier to change the
underlying implementation - if we do, we can change the initializer
without having to change every place where it is used. I actually do
that in my other patch series converting the mmap_sem to a range lock.

But you are correct that it does not help with renaming the mmap_sem
field - my next commit in this series still has to do that in every
place this initializer is used.