Re: [PATCH 1/3] cleanup: add conditional guard helper
From: Dan Williams
Date: Fri Oct 04 2024 - 13:35:06 EST
[ add Fabio ]
David Lechner wrote:
> Add a new if_not_cond_guard() macro to cleanup.h for handling
> conditional guards such as mutext_trylock().
>
> This is more ergonomic than scoped_cond_guard() for most use cases.
> Instead of hiding the error handling statement in the macro args, it
> works like a normal if statement and allow the error path to be indented
> while the normal code flow path is not indented. And it avoid unwanted
> side-effect from hidden for loop in scoped_cond_guard().
>
> Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
Hi David,
When you update this to the if_not_guard() name can you also add Fabio as a
co-developer? His work [1] contributed to eliciting the response from Linus,
and then this patch takes the novel additional step to create an "if ()" macro.
Thanks for pushing this forward!
[1]: http://lore.kernel.org/20240130164059.25130-1-fabio.maria.de.francesco@xxxxxxxxxxxxxxx