diff options
author | David Howells <dhowells@redhat.com> | 2008-04-29 04:01:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:17 -0400 |
commit | 7249db2c281ac688977ecc6862cdee9969d310e2 (patch) | |
tree | 7d0c42af5c2cb3724fd18aa3aff8de3c827bfe77 /include/linux/key.h | |
parent | fdb89bce6c9ccb17dae13ec43a25d2fdd405233f (diff) |
keys: make key_serial() a function if CONFIG_KEYS=y
Make key_serial() an inline function rather than a macro if CONFIG_KEYS=y.
This prevents double evaluation of the key pointer and also provides better
type checking.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/key.h')
-rw-r--r-- | include/linux/key.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index ad02d9cfe170..c45c962d1cc5 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -264,7 +264,10 @@ extern int keyring_add_key(struct key *keyring, | |||
264 | 264 | ||
265 | extern struct key *key_lookup(key_serial_t id); | 265 | extern struct key *key_lookup(key_serial_t id); |
266 | 266 | ||
267 | #define key_serial(key) ((key) ? (key)->serial : 0) | 267 | static inline key_serial_t key_serial(struct key *key) |
268 | { | ||
269 | return key ? key->serial : 0; | ||
270 | } | ||
268 | 271 | ||
269 | #ifdef CONFIG_SYSCTL | 272 | #ifdef CONFIG_SYSCTL |
270 | extern ctl_table key_sysctls[]; | 273 | extern ctl_table key_sysctls[]; |