diff mbox series

libceph: drop CEPH_DEFINE_SHOW_FUNC

Message ID 20200128201303.16352-1-idryomov@gmail.com (mailing list archive)
State New, archived
Headers show
Series libceph: drop CEPH_DEFINE_SHOW_FUNC | expand

Commit Message

Ilya Dryomov Jan. 28, 2020, 8:13 p.m. UTC
Although CEPH_DEFINE_SHOW_FUNC is much older, it now duplicates
DEFINE_SHOW_ATTRIBUTE from linux/seq_file.h.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 fs/ceph/debugfs.c            | 16 ++++++++--------
 include/linux/ceph/debugfs.h | 14 --------------
 net/ceph/debugfs.c           | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 32 deletions(-)

Comments

Jeff Layton Jan. 29, 2020, 3:22 p.m. UTC | #1
On Tue, 2020-01-28 at 21:13 +0100, Ilya Dryomov wrote:
> Although CEPH_DEFINE_SHOW_FUNC is much older, it now duplicates
> DEFINE_SHOW_ATTRIBUTE from linux/seq_file.h.
> 
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
>  fs/ceph/debugfs.c            | 16 ++++++++--------
>  include/linux/ceph/debugfs.h | 14 --------------
>  net/ceph/debugfs.c           | 20 ++++++++++----------
>  3 files changed, 18 insertions(+), 32 deletions(-)
> 
> diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
> index fb7cabd98e7b..481ac97b4d25 100644
> --- a/fs/ceph/debugfs.c
> +++ b/fs/ceph/debugfs.c
> @@ -218,10 +218,10 @@ static int mds_sessions_show(struct seq_file *s, void *ptr)
>  	return 0;
>  }
>  
> -CEPH_DEFINE_SHOW_FUNC(mdsmap_show)
> -CEPH_DEFINE_SHOW_FUNC(mdsc_show)
> -CEPH_DEFINE_SHOW_FUNC(caps_show)
> -CEPH_DEFINE_SHOW_FUNC(mds_sessions_show)
> +DEFINE_SHOW_ATTRIBUTE(mdsmap);
> +DEFINE_SHOW_ATTRIBUTE(mdsc);
> +DEFINE_SHOW_ATTRIBUTE(caps);
> +DEFINE_SHOW_ATTRIBUTE(mds_sessions);
>  
>  
>  /*
> @@ -281,25 +281,25 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
>  					0400,
>  					fsc->client->debugfs_dir,
>  					fsc,
> -					&mdsmap_show_fops);
> +					&mdsmap_fops);
>  
>  	fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions",
>  					0400,
>  					fsc->client->debugfs_dir,
>  					fsc,
> -					&mds_sessions_show_fops);
> +					&mds_sessions_fops);
>  
>  	fsc->debugfs_mdsc = debugfs_create_file("mdsc",
>  						0400,
>  						fsc->client->debugfs_dir,
>  						fsc,
> -						&mdsc_show_fops);
> +						&mdsc_fops);
>  
>  	fsc->debugfs_caps = debugfs_create_file("caps",
>  						   0400,
>  						   fsc->client->debugfs_dir,
>  						   fsc,
> -						   &caps_show_fops);
> +						   &caps_fops);
>  }
>  
>  
> diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
> index cf5e840eec71..8b3a1a7a953a 100644
> --- a/include/linux/ceph/debugfs.h
> +++ b/include/linux/ceph/debugfs.h
> @@ -2,22 +2,8 @@
>  #ifndef _FS_CEPH_DEBUGFS_H
>  #define _FS_CEPH_DEBUGFS_H
>  
> -#include <linux/ceph/ceph_debug.h>
>  #include <linux/ceph/types.h>
>  
> -#define CEPH_DEFINE_SHOW_FUNC(name)					\
> -static int name##_open(struct inode *inode, struct file *file)		\
> -{									\
> -	return single_open(file, name, inode->i_private);		\
> -}									\
> -									\
> -static const struct file_operations name##_fops = {			\
> -	.open		= name##_open,					\
> -	.read		= seq_read,					\
> -	.llseek		= seq_lseek,					\
> -	.release	= single_release,				\
> -};
> -
>  /* debugfs.c */
>  extern void ceph_debugfs_init(void);
>  extern void ceph_debugfs_cleanup(void);
> diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
> index 7cb992e55475..1344f232ecc5 100644
> --- a/net/ceph/debugfs.c
> +++ b/net/ceph/debugfs.c
> @@ -383,11 +383,11 @@ static int client_options_show(struct seq_file *s, void *p)
>  	return 0;
>  }
>  
> -CEPH_DEFINE_SHOW_FUNC(monmap_show)
> -CEPH_DEFINE_SHOW_FUNC(osdmap_show)
> -CEPH_DEFINE_SHOW_FUNC(monc_show)
> -CEPH_DEFINE_SHOW_FUNC(osdc_show)
> -CEPH_DEFINE_SHOW_FUNC(client_options_show)
> +DEFINE_SHOW_ATTRIBUTE(monmap);
> +DEFINE_SHOW_ATTRIBUTE(osdmap);
> +DEFINE_SHOW_ATTRIBUTE(monc);
> +DEFINE_SHOW_ATTRIBUTE(osdc);
> +DEFINE_SHOW_ATTRIBUTE(client_options);
>  
>  void __init ceph_debugfs_init(void)
>  {
> @@ -414,31 +414,31 @@ void ceph_debugfs_client_init(struct ceph_client *client)
>  						      0400,
>  						      client->debugfs_dir,
>  						      client,
> -						      &monc_show_fops);
> +						      &monc_fops);
>  
>  	client->osdc.debugfs_file = debugfs_create_file("osdc",
>  						      0400,
>  						      client->debugfs_dir,
>  						      client,
> -						      &osdc_show_fops);
> +						      &osdc_fops);
>  
>  	client->debugfs_monmap = debugfs_create_file("monmap",
>  					0400,
>  					client->debugfs_dir,
>  					client,
> -					&monmap_show_fops);
> +					&monmap_fops);
>  
>  	client->debugfs_osdmap = debugfs_create_file("osdmap",
>  					0400,
>  					client->debugfs_dir,
>  					client,
> -					&osdmap_show_fops);
> +					&osdmap_fops);
>  
>  	client->debugfs_options = debugfs_create_file("client_options",
>  					0400,
>  					client->debugfs_dir,
>  					client,
> -					&client_options_show_fops);
> +					&client_options_fops);
>  }
>  
>  void ceph_debugfs_client_cleanup(struct ceph_client *client)


Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index fb7cabd98e7b..481ac97b4d25 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -218,10 +218,10 @@  static int mds_sessions_show(struct seq_file *s, void *ptr)
 	return 0;
 }
 
-CEPH_DEFINE_SHOW_FUNC(mdsmap_show)
-CEPH_DEFINE_SHOW_FUNC(mdsc_show)
-CEPH_DEFINE_SHOW_FUNC(caps_show)
-CEPH_DEFINE_SHOW_FUNC(mds_sessions_show)
+DEFINE_SHOW_ATTRIBUTE(mdsmap);
+DEFINE_SHOW_ATTRIBUTE(mdsc);
+DEFINE_SHOW_ATTRIBUTE(caps);
+DEFINE_SHOW_ATTRIBUTE(mds_sessions);
 
 
 /*
@@ -281,25 +281,25 @@  void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
 					0400,
 					fsc->client->debugfs_dir,
 					fsc,
-					&mdsmap_show_fops);
+					&mdsmap_fops);
 
 	fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions",
 					0400,
 					fsc->client->debugfs_dir,
 					fsc,
-					&mds_sessions_show_fops);
+					&mds_sessions_fops);
 
 	fsc->debugfs_mdsc = debugfs_create_file("mdsc",
 						0400,
 						fsc->client->debugfs_dir,
 						fsc,
-						&mdsc_show_fops);
+						&mdsc_fops);
 
 	fsc->debugfs_caps = debugfs_create_file("caps",
 						   0400,
 						   fsc->client->debugfs_dir,
 						   fsc,
-						   &caps_show_fops);
+						   &caps_fops);
 }
 
 
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
index cf5e840eec71..8b3a1a7a953a 100644
--- a/include/linux/ceph/debugfs.h
+++ b/include/linux/ceph/debugfs.h
@@ -2,22 +2,8 @@ 
 #ifndef _FS_CEPH_DEBUGFS_H
 #define _FS_CEPH_DEBUGFS_H
 
-#include <linux/ceph/ceph_debug.h>
 #include <linux/ceph/types.h>
 
-#define CEPH_DEFINE_SHOW_FUNC(name)					\
-static int name##_open(struct inode *inode, struct file *file)		\
-{									\
-	return single_open(file, name, inode->i_private);		\
-}									\
-									\
-static const struct file_operations name##_fops = {			\
-	.open		= name##_open,					\
-	.read		= seq_read,					\
-	.llseek		= seq_lseek,					\
-	.release	= single_release,				\
-};
-
 /* debugfs.c */
 extern void ceph_debugfs_init(void);
 extern void ceph_debugfs_cleanup(void);
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index 7cb992e55475..1344f232ecc5 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -383,11 +383,11 @@  static int client_options_show(struct seq_file *s, void *p)
 	return 0;
 }
 
-CEPH_DEFINE_SHOW_FUNC(monmap_show)
-CEPH_DEFINE_SHOW_FUNC(osdmap_show)
-CEPH_DEFINE_SHOW_FUNC(monc_show)
-CEPH_DEFINE_SHOW_FUNC(osdc_show)
-CEPH_DEFINE_SHOW_FUNC(client_options_show)
+DEFINE_SHOW_ATTRIBUTE(monmap);
+DEFINE_SHOW_ATTRIBUTE(osdmap);
+DEFINE_SHOW_ATTRIBUTE(monc);
+DEFINE_SHOW_ATTRIBUTE(osdc);
+DEFINE_SHOW_ATTRIBUTE(client_options);
 
 void __init ceph_debugfs_init(void)
 {
@@ -414,31 +414,31 @@  void ceph_debugfs_client_init(struct ceph_client *client)
 						      0400,
 						      client->debugfs_dir,
 						      client,
-						      &monc_show_fops);
+						      &monc_fops);
 
 	client->osdc.debugfs_file = debugfs_create_file("osdc",
 						      0400,
 						      client->debugfs_dir,
 						      client,
-						      &osdc_show_fops);
+						      &osdc_fops);
 
 	client->debugfs_monmap = debugfs_create_file("monmap",
 					0400,
 					client->debugfs_dir,
 					client,
-					&monmap_show_fops);
+					&monmap_fops);
 
 	client->debugfs_osdmap = debugfs_create_file("osdmap",
 					0400,
 					client->debugfs_dir,
 					client,
-					&osdmap_show_fops);
+					&osdmap_fops);
 
 	client->debugfs_options = debugfs_create_file("client_options",
 					0400,
 					client->debugfs_dir,
 					client,
-					&client_options_show_fops);
+					&client_options_fops);
 }
 
 void ceph_debugfs_client_cleanup(struct ceph_client *client)