Skip to content

Commit 340086d

Browse files
Tom Rixchucklever
authored andcommitted
nfsd: define exports_proc_ops with CONFIG_PROC_FS
gcc with W=1 and ! CONFIG_PROC_FS fs/nfsd/nfsctl.c:161:30: error: ‘exports_proc_ops’ defined but not used [-Werror=unused-const-variable=] 161 | static const struct proc_ops exports_proc_ops = { | ^~~~~~~~~~~~~~~~ The only use of exports_proc_ops is when CONFIG_PROC_FS is defined, so its definition should be likewise conditional. Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent af97b7d commit 340086d

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

fs/nfsd/nfsctl.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,6 @@ static int exports_net_open(struct net *net, struct file *file)
153153
return 0;
154154
}
155155

156-
static int exports_proc_open(struct inode *inode, struct file *file)
157-
{
158-
return exports_net_open(current->nsproxy->net_ns, file);
159-
}
160-
161-
static const struct proc_ops exports_proc_ops = {
162-
.proc_open = exports_proc_open,
163-
.proc_read = seq_read,
164-
.proc_lseek = seq_lseek,
165-
.proc_release = seq_release,
166-
};
167-
168156
static int exports_nfsd_open(struct inode *inode, struct file *file)
169157
{
170158
return exports_net_open(inode->i_sb->s_fs_info, file);
@@ -1458,6 +1446,19 @@ static struct file_system_type nfsd_fs_type = {
14581446
MODULE_ALIAS_FS("nfsd");
14591447

14601448
#ifdef CONFIG_PROC_FS
1449+
1450+
static int exports_proc_open(struct inode *inode, struct file *file)
1451+
{
1452+
return exports_net_open(current->nsproxy->net_ns, file);
1453+
}
1454+
1455+
static const struct proc_ops exports_proc_ops = {
1456+
.proc_open = exports_proc_open,
1457+
.proc_read = seq_read,
1458+
.proc_lseek = seq_lseek,
1459+
.proc_release = seq_release,
1460+
};
1461+
14611462
static int create_proc_exports_entry(void)
14621463
{
14631464
struct proc_dir_entry *entry;

0 commit comments

Comments
 (0)