Re: [GIT PULL] vfs mount

From: Leon Romanovsky
Date: Fri Apr 04 2025 - 02:16:47 EST


On Thu, Apr 03, 2025 at 12:18:45PM -0700, Linus Torvalds wrote:
> On Thu, 3 Apr 2025 at 11:25, Leon Romanovsky <leon@xxxxxxxxxx> wrote:
> > >
> > > - scoped_guard(rwsem_read, &namespace_sem)
> > > + guard(rwsem_read, &namespace_sem);
> >
> > I'm looking at Linus's master commit a2cc6ff5ec8f ("Merge tag
> > 'firewire-updates-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394")
> > and guard is declared as macro which gets only one argument: include/linux/cleanup.h
> > 318 #define guard(_name) \
> > 319 CLASS(_name, __UNIQUE_ID(guard))
>
> Christian didn't test his patch, obviously.
>
> It should be
>
> guard(rwsem_read)(&namespace_sem);
>
> the guard() macro is kind of odd, but the oddity relates to how it
> kind of takes a "class" thing as it's argument, and that then expands
> to the constructor that may or may not take arguments itself.

Thanks, fixed.

Regarding syntax, in my opinion it is too odd and not intuitive.

>
> That made some of the macros simpler, although in retrospect the odd
> syntax probably wasn't worth it.
>
> Linus