libceph: drop CEPH_DEFINE_SHOW_FUNC
authorIlya Dryomov <idryomov@gmail.com>
Tue, 28 Jan 2020 19:12:22 +0000 (20:12 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 30 Mar 2020 10:42:40 +0000 (12:42 +0200)
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>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/debugfs.c
include/linux/ceph/debugfs.h
net/ceph/debugfs.c

index fb7cabd..481ac97 100644 (file)
@@ -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);
 }
 
 
index cf5e840..8b3a1a7 100644 (file)
@@ -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);
index 7cb992e..1344f23 100644 (file)
@@ -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)