Re: [GIT PULL] vfs mount

From: Linus Torvalds
Date: Thu Apr 03 2025 - 16:42:28 EST


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.

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

Linus