Messages in this thread Patch in this message | | | Date | Thu, 10 Apr 2008 15:48:12 +0200 | From | Johannes Berg <> | Subject | [RFC 2/3] rcu: allow functions to declare they need RCU locking |
| |
Often enough, subsystems have a lookup function that goes from some sort of key to an RCU-protected structure. They can then declare the function as such:
struct mystruct *get_mystruct(...) __requires_rcu;
and sparse will automatically be able to check that the function is invoked under rcu_read_lock().
Not-yet-signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- include/linux/rcupdate.h | 4 ++++ 1 file changed, 4 insertions(+)
--- everything.orig/include/linux/rcupdate.h 2008-04-10 15:36:18.000000000 +0200 +++ everything/include/linux/rcupdate.h 2008-04-10 15:36:43.000000000 +0200 @@ -65,6 +65,10 @@ struct rcu_head { (ptr)->next = NULL; (ptr)->func = NULL; \ } while (0) + +#define __requires_rcu __requires(RCU) +#define __macro_requires_rcu __macro_requires(RCU) + /** * rcu_read_lock - mark the beginning of an RCU read-side critical section. * --
| |