extern const struct __ctx_lock_##ctx *name
/*
- * Common keywords for static context analysis. Both Clang's "capability
- * analysis" and Sparse's "context tracking" are currently supported.
- */
-#ifdef __CHECKER__
-
-/* Sparse context/lock checking support. */
-# define __must_hold(x) __attribute__((context(x,1,1)))
-# define __must_not_hold(x)
-# define __acquires(x) __attribute__((context(x,0,1)))
-# define __cond_acquires(ret, x) __attribute__((context(x,0,-1)))
-# define __releases(x) __attribute__((context(x,1,0)))
-# define __acquire(x) __context__(x,1)
-# define __release(x) __context__(x,-1)
-# define __cond_lock(x, c) ((c) ? ({ __acquire(x); 1; }) : 0)
-/* For Sparse, there's no distinction between exclusive and shared locks. */
-# define __must_hold_shared __must_hold
-# define __acquires_shared __acquires
-# define __cond_acquires_shared __cond_acquires
-# define __releases_shared __releases
-# define __acquire_shared __acquire
-# define __release_shared __release
-# define __cond_lock_shared __cond_acquire
-
-#else /* !__CHECKER__ */
+ * Common keywords for static context analysis.
+ */
/**
* __must_hold() - function attribute, caller must hold exclusive context lock
- * @x: context lock instance pointer
*
* Function attribute declaring that the caller must hold the given context
- * lock instance @x exclusively.
+ * lock instance(s) exclusively.
*/
-# define __must_hold(x) __requires_ctx_lock(x)
+#define __must_hold(...) __requires_ctx_lock(__VA_ARGS__)
/**
* __must_not_hold() - function attribute, caller must not hold context lock
- * @x: context lock instance pointer
*
* Function attribute declaring that the caller must not hold the given context
- * lock instance @x.
+ * lock instance(s).
*/
-# define __must_not_hold(x) __excludes_ctx_lock(x)
+#define __must_not_hold(...) __excludes_ctx_lock(__VA_ARGS__)
/**
* __acquires() - function attribute, function acquires context lock exclusively
- * @x: context lock instance pointer
*
* Function attribute declaring that the function acquires the given context
- * lock instance @x exclusively, but does not release it.
+ * lock instance(s) exclusively, but does not release them.
*/
-# define __acquires(x) __acquires_ctx_lock(x)
+#define __acquires(...) __acquires_ctx_lock(__VA_ARGS__)
/*
* Clang's analysis does not care precisely about the value, only that it is
*
* @ret may be one of: true, false, nonzero, 0, nonnull, NULL.
*/
-# define __cond_acquires(ret, x) __cond_acquires_impl_##ret(x)
+#define __cond_acquires(ret, x) __cond_acquires_impl_##ret(x)
/**
* __releases() - function attribute, function releases a context lock exclusively
- * @x: context lock instance pointer
*
* Function attribute declaring that the function releases the given context
- * lock instance @x exclusively. The associated context must be active on
+ * lock instance(s) exclusively. The associated context(s) must be active on
* entry.
*/
-# define __releases(x) __releases_ctx_lock(x)
+#define __releases(...) __releases_ctx_lock(__VA_ARGS__)
/**
* __acquire() - function to acquire context lock exclusively
*
* No-op function that acquires the given context lock instance @x exclusively.
*/
-# define __acquire(x) __acquire_ctx_lock(x)
+#define __acquire(x) __acquire_ctx_lock(x)
/**
* __release() - function to release context lock exclusively
*
* No-op function that releases the given context lock instance @x.
*/
-# define __release(x) __release_ctx_lock(x)
+#define __release(x) __release_ctx_lock(x)
/**
* __cond_lock() - function that conditionally acquires a context lock
*
* #define spin_trylock(l) __cond_lock(&lock, _spin_trylock(&lock))
*/
-# define __cond_lock(x, c) __try_acquire_ctx_lock(x, c)
+#define __cond_lock(x, c) __try_acquire_ctx_lock(x, c)
/**
* __must_hold_shared() - function attribute, caller must hold shared context lock
- * @x: context lock instance pointer
*
* Function attribute declaring that the caller must hold the given context
- * lock instance @x with shared access.
+ * lock instance(s) with shared access.
*/
-# define __must_hold_shared(x) __requires_shared_ctx_lock(x)
+#define __must_hold_shared(...) __requires_shared_ctx_lock(__VA_ARGS__)
/**
* __acquires_shared() - function attribute, function acquires context lock shared
- * @x: context lock instance pointer
*
* Function attribute declaring that the function acquires the given
- * context lock instance @x with shared access, but does not release it.
+ * context lock instance(s) with shared access, but does not release them.
*/
-# define __acquires_shared(x) __acquires_shared_ctx_lock(x)
+#define __acquires_shared(...) __acquires_shared_ctx_lock(__VA_ARGS__)
/**
* __cond_acquires_shared() - function attribute, function conditionally
* @x: context lock instance pointer
*
* Function attribute declaring that the function conditionally acquires the
- * given context lock instance @x with shared access, but does not release it. The
- * function return value @ret denotes when the context lock is acquired.
+ * given context lock instance @x with shared access, but does not release it.
+ * The function return value @ret denotes when the context lock is acquired.
*
* @ret may be one of: true, false, nonzero, 0, nonnull, NULL.
*/
-# define __cond_acquires_shared(ret, x) __cond_acquires_impl_##ret(x, _shared)
+#define __cond_acquires_shared(ret, x) __cond_acquires_impl_##ret(x, _shared)
/**
* __releases_shared() - function attribute, function releases a
* context lock shared
- * @x: context lock instance pointer
*
* Function attribute declaring that the function releases the given context
- * lock instance @x with shared access. The associated context must be active
- * on entry.
+ * lock instance(s) with shared access. The associated context(s) must be
+ * active on entry.
*/
-# define __releases_shared(x) __releases_shared_ctx_lock(x)
+#define __releases_shared(...) __releases_shared_ctx_lock(__VA_ARGS__)
/**
* __acquire_shared() - function to acquire context lock shared
* No-op function that acquires the given context lock instance @x with shared
* access.
*/
-# define __acquire_shared(x) __acquire_shared_ctx_lock(x)
+#define __acquire_shared(x) __acquire_shared_ctx_lock(x)
/**
* __release_shared() - function to release context lock shared
* No-op function that releases the given context lock instance @x with shared
* access.
*/
-# define __release_shared(x) __release_shared_ctx_lock(x)
+#define __release_shared(x) __release_shared_ctx_lock(x)
/**
* __cond_lock_shared() - function that conditionally acquires a context lock shared
* shared access, if the boolean expression @c is true. The result of @c is the
* return value.
*/
-# define __cond_lock_shared(x, c) __try_acquire_shared_ctx_lock(x, c)
-
-#endif /* __CHECKER__ */
+#define __cond_lock_shared(x, c) __try_acquire_shared_ctx_lock(x, c)
/**
* __acquire_ret() - helper to acquire context lock of return value