Re: [PATCH RFC 07/24] cleanup: Basic compatibility with capability analysis

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/6/25 10:10 AM, Marco Elver wrote:
@@ -243,15 +243,18 @@ const volatile void * __must_check_fn(const volatile void *val)
  #define DEFINE_CLASS(_name, _type, _exit, _init, _init_args...)		\
  typedef _type class_##_name##_t;					\
  static inline void class_##_name##_destructor(_type *p)			\
+	__no_capability_analysis					\
  { _type _T = *p; _exit; }						\
  static inline _type class_##_name##_constructor(_init_args)		\
+	__no_capability_analysis					\
  { _type t = _init; return t; }

guard() uses the constructor and destructor functions defined by
DEFINE_GUARD(). The DEFINE_GUARD() implementation uses DEFINE_CLASS().
Here is an example that I found in <linux/mutex.h>:

DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))

For this example, how is the compiler told that mutex _T is held around
the code protected by guard()?

Thanks,

Bart.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux