lkml.org 
[lkml]   [2008]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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.
*
--



\
 
 \ /
  Last update: 2008-04-10 16:45    [W:0.086 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site