diff options
author | David Howells <dhowells@redhat.com> | 2011-03-07 10:05:51 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-03-07 19:17:11 -0500 |
commit | 633e804e89464d3875e59de1959a53f9041d3094 (patch) | |
tree | 0a2464267c5f7a4e8166771fdc88e181a5b6219a /include/linux/key.h | |
parent | 1cc26bada9f6807814806db2f0d78792eecdac71 (diff) |
KEYS: Add an RCU payload dereference macro
Add an RCU payload dereference macro as this seems to be a common piece of code
amongst key types that use RCU referenced payloads.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'include/linux/key.h')
-rw-r--r-- | include/linux/key.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index 3db0adce1fda..a6b1edcffc34 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -275,6 +275,10 @@ static inline key_serial_t key_serial(struct key *key) | |||
275 | return key ? key->serial : 0; | 275 | return key ? key->serial : 0; |
276 | } | 276 | } |
277 | 277 | ||
278 | #define rcu_dereference_key(KEY) \ | ||
279 | (rcu_dereference_protected((KEY)->payload.rcudata, \ | ||
280 | rwsem_is_locked(&((struct key *)(KEY))->sem))) | ||
281 | |||
278 | #ifdef CONFIG_SYSCTL | 282 | #ifdef CONFIG_SYSCTL |
279 | extern ctl_table key_sysctls[]; | 283 | extern ctl_table key_sysctls[]; |
280 | #endif | 284 | #endif |