mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
locking: Introduce __cleanup() based infrastructure
Use __attribute__((__cleanup__(func))) to build: - simple auto-release pointers using __free() - 'classes' with constructor and destructor semantics for scope-based resource management. - lock guards based on the above classes. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org
This commit is contained in:
parent
9a1f37ebcf
commit
54da6a0924
16 changed files with 272 additions and 1 deletions
|
@ -69,6 +69,12 @@
|
|||
*/
|
||||
#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-cleanup-variable-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#cleanup
|
||||
*/
|
||||
#define __cleanup(func) __attribute__((__cleanup__(func)))
|
||||
|
||||
/*
|
||||
* Note the long name.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue