staging/lustre/fid: move all files from procfs to debugfs
authorDmitry Eremin <dmitry4ever@gmail.com>
Thu, 21 May 2015 19:32:25 +0000 (15:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 02:19:57 +0000 (11:19 +0900)
Signed-off-by: Dmitry Eremin <dmiter4ever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/fid/fid_internal.h
drivers/staging/lustre/lustre/fid/fid_request.c
drivers/staging/lustre/lustre/fid/lproc_fid.c
drivers/staging/lustre/lustre/include/lustre_fid.h

index b5e8da8..84daee1 100644 (file)
 int seq_client_alloc_super(struct lu_client_seq *seq,
                           const struct lu_env *env);
 
-#if defined(CONFIG_PROC_FS)
-extern struct lprocfs_vars seq_client_proc_list[];
-#endif
-
-extern struct proc_dir_entry *seq_type_proc_dir;
+extern struct lprocfs_vars seq_client_debugfs_list[];
 
 #endif /* __FID_INTERNAL_H */
index 7aee393..7b4e3c6 100644 (file)
@@ -53,6 +53,8 @@
 #include "../include/lustre_mdc.h"
 #include "fid_internal.h"
 
+static struct dentry *seq_debugfs_dir;
+
 static int seq_client_rpc(struct lu_client_seq *seq,
                          struct lu_seq_range *output, __u32 opc,
                          const char *opcname)
@@ -400,37 +402,32 @@ void seq_client_flush(struct lu_client_seq *seq)
 }
 EXPORT_SYMBOL(seq_client_flush);
 
-static void seq_client_proc_fini(struct lu_client_seq *seq)
+static void seq_client_debugfs_fini(struct lu_client_seq *seq)
 {
-#if defined(CONFIG_PROC_FS)
-       if (seq->lcs_proc_dir) {
-               if (!IS_ERR(seq->lcs_proc_dir))
-                       lprocfs_remove(&seq->lcs_proc_dir);
-               seq->lcs_proc_dir = NULL;
-       }
-#endif /* CONFIG_PROC_FS */
+       if (!IS_ERR_OR_NULL(seq->lcs_debugfs_entry))
+               ldebugfs_remove(&seq->lcs_debugfs_entry);
 }
 
-static int seq_client_proc_init(struct lu_client_seq *seq)
+static int seq_client_debugfs_init(struct lu_client_seq *seq)
 {
-#if defined(CONFIG_PROC_FS)
        int rc;
 
-       seq->lcs_proc_dir = lprocfs_register(seq->lcs_name,
-                                            seq_type_proc_dir,
-                                            NULL, NULL);
+       seq->lcs_debugfs_entry = ldebugfs_register(seq->lcs_name,
+                                                  seq_debugfs_dir,
+                                                  NULL, NULL);
 
-       if (IS_ERR(seq->lcs_proc_dir)) {
-               CERROR("%s: LProcFS failed in seq-init\n",
-                      seq->lcs_name);
-               rc = PTR_ERR(seq->lcs_proc_dir);
+       if (IS_ERR_OR_NULL(seq->lcs_debugfs_entry)) {
+               CERROR("%s: LdebugFS failed in seq-init\n", seq->lcs_name);
+               rc = seq->lcs_debugfs_entry ? PTR_ERR(seq->lcs_debugfs_entry)
+                                           : -ENOMEM;
+               seq->lcs_debugfs_entry = NULL;
                return rc;
        }
 
-       rc = lprocfs_add_vars(seq->lcs_proc_dir,
-                             seq_client_proc_list, seq);
+       rc = ldebugfs_add_vars(seq->lcs_debugfs_entry,
+                              seq_client_debugfs_list, seq);
        if (rc) {
-               CERROR("%s: Can't init sequence manager proc, rc %d\n",
+               CERROR("%s: Can't init sequence manager debugfs, rc %d\n",
                       seq->lcs_name, rc);
                goto out_cleanup;
        }
@@ -438,12 +435,8 @@ static int seq_client_proc_init(struct lu_client_seq *seq)
        return 0;
 
 out_cleanup:
-       seq_client_proc_fini(seq);
+       seq_client_debugfs_fini(seq);
        return rc;
-
-#else /* CONFIG_PROC_FS */
-       return 0;
-#endif
 }
 
 int seq_client_init(struct lu_client_seq *seq,
@@ -478,7 +471,7 @@ int seq_client_init(struct lu_client_seq *seq,
        snprintf(seq->lcs_name, sizeof(seq->lcs_name),
                 "cli-%s", prefix);
 
-       rc = seq_client_proc_init(seq);
+       rc = seq_client_debugfs_init(seq);
        if (rc)
                seq_client_fini(seq);
        return rc;
@@ -487,7 +480,7 @@ EXPORT_SYMBOL(seq_client_init);
 
 void seq_client_fini(struct lu_client_seq *seq)
 {
-       seq_client_proc_fini(seq);
+       seq_client_debugfs_fini(seq);
 
        if (seq->lcs_exp != NULL) {
                class_export_put(seq->lcs_exp);
@@ -545,22 +538,18 @@ int client_fid_fini(struct obd_device *obd)
 }
 EXPORT_SYMBOL(client_fid_fini);
 
-struct proc_dir_entry *seq_type_proc_dir;
-
 static int __init fid_mod_init(void)
 {
-       seq_type_proc_dir = lprocfs_register(LUSTRE_SEQ_NAME,
-                                            proc_lustre_root,
-                                            NULL, NULL);
-       return PTR_ERR_OR_ZERO(seq_type_proc_dir);
+       seq_debugfs_dir = ldebugfs_register(LUSTRE_SEQ_NAME,
+                                           debugfs_lustre_root,
+                                           NULL, NULL);
+       return PTR_ERR_OR_ZERO(seq_debugfs_dir);
 }
 
 static void __exit fid_mod_exit(void)
 {
-       if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) {
-               lprocfs_remove(&seq_type_proc_dir);
-               seq_type_proc_dir = NULL;
-       }
+       if (!IS_ERR_OR_NULL(seq_debugfs_dir))
+               ldebugfs_remove(&seq_debugfs_dir);
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
index 783939d..41ab2ee 100644 (file)
@@ -59,8 +59,9 @@
  * Note: this function is only used for testing, it is no safe for production
  * use.
  */
-static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
-                                   struct lu_seq_range *range)
+static int
+ldebugfs_fid_write_common(const char __user *buffer, size_t count,
+                         struct lu_seq_range *range)
 {
        struct lu_seq_range tmp;
        int rc;
@@ -92,10 +93,11 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
        return count;
 }
 
-/* Client side procfs stuff */
-static ssize_t lprocfs_fid_space_seq_write(struct file *file,
-                                          const char __user *buffer,
-                                          size_t count, loff_t *off)
+/* Client side debugfs stuff */
+static ssize_t
+ldebugfs_fid_space_seq_write(struct file *file,
+                            const char __user *buffer,
+                            size_t count, loff_t *off)
 {
        struct lu_client_seq *seq;
        int rc;
@@ -104,7 +106,7 @@ static ssize_t lprocfs_fid_space_seq_write(struct file *file,
        LASSERT(seq != NULL);
 
        mutex_lock(&seq->lcs_mutex);
-       rc = lprocfs_fid_write_common(buffer, count, &seq->lcs_space);
+       rc = ldebugfs_fid_write_common(buffer, count, &seq->lcs_space);
 
        if (rc == 0) {
                CDEBUG(D_INFO, "%s: Space: "DRANGE"\n",
@@ -117,7 +119,7 @@ static ssize_t lprocfs_fid_space_seq_write(struct file *file,
 }
 
 static int
-lprocfs_fid_space_seq_show(struct seq_file *m, void *unused)
+ldebugfs_fid_space_seq_show(struct seq_file *m, void *unused)
 {
        struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
 
@@ -130,9 +132,10 @@ lprocfs_fid_space_seq_show(struct seq_file *m, void *unused)
        return 0;
 }
 
-static ssize_t lprocfs_fid_width_seq_write(struct file *file,
-                                          const char __user *buffer,
-                                          size_t count, loff_t *off)
+static ssize_t
+ldebugfs_fid_width_seq_write(struct file *file,
+                            const char __user *buffer,
+                            size_t count, loff_t *off)
 {
        struct lu_client_seq *seq;
        __u64  max;
@@ -166,7 +169,7 @@ static ssize_t lprocfs_fid_width_seq_write(struct file *file,
 }
 
 static int
-lprocfs_fid_width_seq_show(struct seq_file *m, void *unused)
+ldebugfs_fid_width_seq_show(struct seq_file *m, void *unused)
 {
        struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
 
@@ -180,7 +183,7 @@ lprocfs_fid_width_seq_show(struct seq_file *m, void *unused)
 }
 
 static int
-lprocfs_fid_fid_seq_show(struct seq_file *m, void *unused)
+ldebugfs_fid_fid_seq_show(struct seq_file *m, void *unused)
 {
        struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
 
@@ -194,7 +197,7 @@ lprocfs_fid_fid_seq_show(struct seq_file *m, void *unused)
 }
 
 static int
-lprocfs_fid_server_seq_show(struct seq_file *m, void *unused)
+ldebugfs_fid_server_seq_show(struct seq_file *m, void *unused)
 {
        struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
        struct client_obd *cli;
@@ -211,15 +214,15 @@ lprocfs_fid_server_seq_show(struct seq_file *m, void *unused)
        return 0;
 }
 
-LPROC_SEQ_FOPS(lprocfs_fid_space);
-LPROC_SEQ_FOPS(lprocfs_fid_width);
-LPROC_SEQ_FOPS_RO(lprocfs_fid_server);
-LPROC_SEQ_FOPS_RO(lprocfs_fid_fid);
+LPROC_SEQ_FOPS(ldebugfs_fid_space);
+LPROC_SEQ_FOPS(ldebugfs_fid_width);
+LPROC_SEQ_FOPS_RO(ldebugfs_fid_server);
+LPROC_SEQ_FOPS_RO(ldebugfs_fid_fid);
 
-struct lprocfs_vars seq_client_proc_list[] = {
-       { "space", &lprocfs_fid_space_fops },
-       { "width", &lprocfs_fid_width_fops },
-       { "server", &lprocfs_fid_server_fops },
-       { "fid", &lprocfs_fid_fid_fops },
+struct lprocfs_vars seq_client_debugfs_list[] = {
+       { "space", &ldebugfs_fid_space_fops },
+       { "width", &ldebugfs_fid_width_fops },
+       { "server", &ldebugfs_fid_server_fops },
+       { "fid", &ldebugfs_fid_fid_fops },
        { NULL }
 };
index 0a0929f..0592f2b 100644 (file)
@@ -346,7 +346,7 @@ struct lu_client_seq {
        struct lu_seq_range      lcs_space;
 
        /* Seq related proc */
-       struct proc_dir_entry   *lcs_proc_dir;
+       struct dentry           *lcs_debugfs_entry;
 
        /* This holds last allocated fid in last obtained seq */
        struct lu_fid      lcs_fid;