* [PATCH] nfsd: define exports_proc_ops with CONFIG_PROC_FS
@ 2023-05-02 17:11 Tom Rix
2023-05-02 17:42 ` Chuck Lever III
2023-05-02 18:16 ` Jeff Layton
0 siblings, 2 replies; 3+ messages in thread
From: Tom Rix @ 2023-05-02 17:11 UTC (permalink / raw)
To: chuck.lever, jlayton; +Cc: linux-nfs, linux-kernel, Tom Rix
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>
---
fs/nfsd/nfsctl.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7b8f17ee5224..c159817d1282 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -153,18 +153,6 @@ static int exports_net_open(struct net *net, struct file *file)
return 0;
}
-static int exports_proc_open(struct inode *inode, struct file *file)
-{
- return exports_net_open(current->nsproxy->net_ns, file);
-}
-
-static const struct proc_ops exports_proc_ops = {
- .proc_open = exports_proc_open,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
- .proc_release = seq_release,
-};
-
static int exports_nfsd_open(struct inode *inode, struct file *file)
{
return exports_net_open(inode->i_sb->s_fs_info, file);
@@ -1458,6 +1446,19 @@ static struct file_system_type nfsd_fs_type = {
MODULE_ALIAS_FS("nfsd");
#ifdef CONFIG_PROC_FS
+
+static int exports_proc_open(struct inode *inode, struct file *file)
+{
+ return exports_net_open(current->nsproxy->net_ns, file);
+}
+
+static const struct proc_ops exports_proc_ops = {
+ .proc_open = exports_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+};
+
static int create_proc_exports_entry(void)
{
struct proc_dir_entry *entry;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: define exports_proc_ops with CONFIG_PROC_FS
2023-05-02 17:11 [PATCH] nfsd: define exports_proc_ops with CONFIG_PROC_FS Tom Rix
@ 2023-05-02 17:42 ` Chuck Lever III
2023-05-02 18:16 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever III @ 2023-05-02 17:42 UTC (permalink / raw)
To: Tom Rix; +Cc: Jeff Layton, Linux NFS Mailing List, linux-kernel@vger.kernel.org
> On May 2, 2023, at 1:11 PM, Tom Rix <trix@redhat.com> wrote:
>
> 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>
Provisionally applied to nfsd-fixes. Thanks!
> ---
> fs/nfsd/nfsctl.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 7b8f17ee5224..c159817d1282 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -153,18 +153,6 @@ static int exports_net_open(struct net *net, struct file *file)
> return 0;
> }
>
> -static int exports_proc_open(struct inode *inode, struct file *file)
> -{
> - return exports_net_open(current->nsproxy->net_ns, file);
> -}
> -
> -static const struct proc_ops exports_proc_ops = {
> - .proc_open = exports_proc_open,
> - .proc_read = seq_read,
> - .proc_lseek = seq_lseek,
> - .proc_release = seq_release,
> -};
> -
> static int exports_nfsd_open(struct inode *inode, struct file *file)
> {
> return exports_net_open(inode->i_sb->s_fs_info, file);
> @@ -1458,6 +1446,19 @@ static struct file_system_type nfsd_fs_type = {
> MODULE_ALIAS_FS("nfsd");
>
> #ifdef CONFIG_PROC_FS
> +
> +static int exports_proc_open(struct inode *inode, struct file *file)
> +{
> + return exports_net_open(current->nsproxy->net_ns, file);
> +}
> +
> +static const struct proc_ops exports_proc_ops = {
> + .proc_open = exports_proc_open,
> + .proc_read = seq_read,
> + .proc_lseek = seq_lseek,
> + .proc_release = seq_release,
> +};
> +
> static int create_proc_exports_entry(void)
> {
> struct proc_dir_entry *entry;
> --
> 2.27.0
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: define exports_proc_ops with CONFIG_PROC_FS
2023-05-02 17:11 [PATCH] nfsd: define exports_proc_ops with CONFIG_PROC_FS Tom Rix
2023-05-02 17:42 ` Chuck Lever III
@ 2023-05-02 18:16 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2023-05-02 18:16 UTC (permalink / raw)
To: Tom Rix, chuck.lever; +Cc: linux-nfs, linux-kernel
On Tue, 2023-05-02 at 13:11 -0400, Tom Rix wrote:
> 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>
> ---
> fs/nfsd/nfsctl.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 7b8f17ee5224..c159817d1282 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -153,18 +153,6 @@ static int exports_net_open(struct net *net, struct file *file)
> return 0;
> }
>
> -static int exports_proc_open(struct inode *inode, struct file *file)
> -{
> - return exports_net_open(current->nsproxy->net_ns, file);
> -}
> -
> -static const struct proc_ops exports_proc_ops = {
> - .proc_open = exports_proc_open,
> - .proc_read = seq_read,
> - .proc_lseek = seq_lseek,
> - .proc_release = seq_release,
> -};
> -
> static int exports_nfsd_open(struct inode *inode, struct file *file)
> {
> return exports_net_open(inode->i_sb->s_fs_info, file);
> @@ -1458,6 +1446,19 @@ static struct file_system_type nfsd_fs_type = {
> MODULE_ALIAS_FS("nfsd");
>
> #ifdef CONFIG_PROC_FS
> +
> +static int exports_proc_open(struct inode *inode, struct file *file)
> +{
> + return exports_net_open(current->nsproxy->net_ns, file);
> +}
> +
> +static const struct proc_ops exports_proc_ops = {
> + .proc_open = exports_proc_open,
> + .proc_read = seq_read,
> + .proc_lseek = seq_lseek,
> + .proc_release = seq_release,
> +};
> +
> static int create_proc_exports_entry(void)
> {
> struct proc_dir_entry *entry;
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-02 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-02 17:11 [PATCH] nfsd: define exports_proc_ops with CONFIG_PROC_FS Tom Rix
2023-05-02 17:42 ` Chuck Lever III
2023-05-02 18:16 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox