From patchwork Mon Dec 3 20:24:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 1835031 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B565D40E42 for ; Mon, 3 Dec 2012 20:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444Ab2LCU3Q (ORCPT ); Mon, 3 Dec 2012 15:29:16 -0500 Received: from 183.141.211.66.inaddr.G4.NET ([66.211.141.183]:47984 "EHLO Dobby.4dicksons.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752443Ab2LCU3O (ORCPT ); Mon, 3 Dec 2012 15:29:14 -0500 Received: from tophat.home.4dicksons.org ([192.168.62.20]) by Dobby.4dicksons.org with esmtp (Exim 4.63) (envelope-from ) id 1Tfcdb-00046S-Pk; Mon, 03 Dec 2012 15:29:12 -0500 From: Steve Dickson To: David Quigley Cc: Linux NFS Mailing List Subject: [PATCH] lnfs: Cleaned up compile warnings when NFS_V4_SECURITY_LABEL is not set. Date: Mon, 3 Dec 2012 15:24:14 -0500 Message-Id: <1354566254-546-1-git-send-email-steved@redhat.com> X-Mailer: git-send-email 1.7.11.7 X-Spam-Score: -2.9 (--) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This patch cleans up a number compile warnings when the label NFS code exists but is not configured to compile. Signed-off-by: Steve Dickson --- fs/nfs/nfs4proc.c | 36 ++++++++++++++++++++++++------------ include/linux/nfs_fs.h | 4 ++-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 2c8dd55..02e3303 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -926,8 +926,8 @@ err_free_label: #ifdef CONFIG_NFS_V4_SECURITY_LABEL if (server->caps & NFS_CAP_SECURITY_LABEL) nfs4_label_free(p->f_label); -#endif err_free_p: +#endif kfree(p); err: dput(parent); @@ -2438,9 +2438,10 @@ static struct inode * nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags, struct iattr *attr) { struct nfs4_state *state; - struct nfs4_label l, *label = NULL; - + struct nfs4_label *label = NULL; #ifdef CONFIG_NFS_V4_SECURITY_LABEL + struct nfs4_label l; + if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL)) { struct dentry *dentry = ctx->dentry; int error; @@ -3026,8 +3027,8 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry #ifdef CONFIG_NFS_V4_SECURITY_LABEL if (server->caps & NFS_CAP_SECURITY_LABEL) nfs4_label_free(res.label); -#endif out: +#endif nfs_free_fattr(res.fattr); return status; } @@ -3105,7 +3106,10 @@ static int nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, int flags) { - struct nfs4_label l, *ilabel = NULL; + struct nfs4_label *ilabel = NULL; +#ifdef CONFIG_NFS_V4_SECURITY_LABEL + struct nfs4_label l; +#endif struct nfs_open_context *ctx; struct nfs4_state *state; int status = 0; @@ -3298,8 +3302,8 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, nfs4_label_free(res.old_label); nfs4_label_free(res.new_label); } -#endif out: +#endif return status; } @@ -3418,7 +3422,9 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, nfs_fattr_init(data->res.fattr); } return data; +#ifdef CONFIG_NFS_V4_SECURITY_LABEL out_free: +#endif kfree(data); return NULL; } @@ -3474,11 +3480,11 @@ static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, unsigned int len, struct iattr *sattr) { struct nfs4_exception exception = { }; - struct nfs4_label l, *label = NULL; int err; - - + struct nfs4_label *label = NULL; #ifdef CONFIG_NFS_V4_SECURITY_LABEL + struct nfs4_label l; + if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL)) { err = security_dentry_init_security(dentry, sattr->ia_mode, &dentry->d_name, &l.label, &l.len); @@ -3522,7 +3528,10 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) { struct nfs4_exception exception = { }; - struct nfs4_label l, *label = NULL; + struct nfs4_label *label = NULL; +#ifdef CONFIG_NFS_V4_SECURITY_LABEL + struct nfs4_label l; +#endif int err; #ifdef CONFIG_NFS_V4_SECURITY_LABEL @@ -3640,9 +3649,12 @@ out: static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, dev_t rdev) { - struct nfs4_exception exception = { }; - struct nfs4_label l, *label = NULL; int err; + struct nfs4_exception exception = { }; + struct nfs4_label *label = NULL; +#ifdef CONFIG_NFS_V4_SECURITY_LABEL + struct nfs4_label l; +#endif #ifdef CONFIG_NFS_V4_SECURITY_LABEL if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL)) { diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 2ef01f8..f4bb5c4 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -502,8 +502,8 @@ extern void nfs4_label_init(struct nfs4_label *); extern void nfs4_label_free(struct nfs4_label *); #else static inline struct nfs4_label *nfs4_label_alloc(gfp_t flags) { return NULL; } -static inline void nfs4_label_init(struct nfs4_label *) {} -static inline void nfs4_label_free(struct nfs4_label *label) {} +static inline void nfs4_label_init(void *label) {} +static inline void nfs4_label_free(void *label) {} #endif /*