[PATCH 07/45] KEYS: Make key_serial() a function if CONFIG_KEYS=y [ver #35]

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Howells
Date: Friday, March 28, 2008 - 7:30 am

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>
---

 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 ad02d9c..c45c962 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -264,7 +264,10 @@ extern int keyring_add_key(struct key *keyring,
 
 extern struct key *key_lookup(key_serial_t id);
 
-#define key_serial(key) ((key) ? (key)->serial : 0)
+static inline key_serial_t key_serial(struct key *key)
+{
+	return key ? key->serial : 0;
+}
 
 #ifdef CONFIG_SYSCTL
 extern ctl_table key_sysctls[];

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/45] Permit filesystem local caching [ver #35], David Howells, (Fri Mar 28, 7:30 am)
[PATCH 07/45] KEYS: Make key_serial() a function if CONFIG ..., David Howells, (Fri Mar 28, 7:30 am)
[PATCH 28/45] FS-Cache: Make kAFS use FS-Cache [ver #35], David Howells, (Fri Mar 28, 7:32 am)
[PATCH 36/45] NFS: Use local disk inode cache [ver #35], David Howells, (Fri Mar 28, 7:33 am)
[PATCH 39/45] NFS: FS-Cache page management [ver #35], David Howells, (Fri Mar 28, 7:33 am)
[PATCH 44/45] NFS: Display local caching state [ver #35], David Howells, (Fri Mar 28, 7:33 am)