From: David Howells Subject: [PATCH 07/45] KEYS: Make key_serial() a function if CONFIG_KEYS=y [ver #35] Date: Fri, 28 Mar 2008 14:30:46 +0000 Message-ID: <20080328143046.3483.46994.stgit@warthog.procyon.org.uk> References: <20080328143010.3483.99079.stgit@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org To: torvalds@osdl.org, akpm@linux-foundation.org, trond.myklebust@fys.uio.no, chuck.lever@oracle.com Return-path: In-Reply-To: <20080328143010.3483.99079.stgit@warthog.procyon.org.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfsv4-bounces@linux-nfs.org Errors-To: nfsv4-bounces@linux-nfs.org List-Id: linux-fsdevel.vger.kernel.org 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 --- 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[];