Whamcloud - gitweb
LU-8829 mgs: fix default secure RPC rule display
[fs/lustre-release.git] / lustre / mgs / lproc_mgs.c
index 20289cf..ef22f46 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -43,7 +39,7 @@
 #include <lustre_param.h>
 #include "mgs_internal.h"
 
-#ifdef LPROCFS
+#ifdef CONFIG_PROC_FS
 
 static int mgs_fs_seq_show(struct seq_file *seq, void *v)
 {
@@ -85,21 +81,23 @@ out:
 LPROC_SEQ_FOPS_RO(mgs_fs);
 
 static void seq_show_srpc_rules(struct seq_file *seq, const char *tgtname,
-                                struct sptlrpc_rule_set *rset)
+                               struct sptlrpc_rule_set *rset)
 {
-        struct sptlrpc_rule    *r;
-        char                    dirbuf[10];
-        char                    flvrbuf[40];
-        char                   *net;
-        int                     i;
+       struct sptlrpc_rule *r;
+       char dirbuf[10];
+       char flvrbuf[40];
+       char net_buf[LNET_NIDSTR_SIZE];
+       const char *net;
+       int i;
 
-        for (i = 0; i < rset->srs_nrule; i++) {
-                r = &rset->srs_rules[i];
+       for (i = 0; i < rset->srs_nrule; i++) {
+               r = &rset->srs_rules[i];
 
-                if (r->sr_netid == LNET_NIDNET(LNET_NID_ANY))
-                        net = "default";
-                else
-                        net = libcfs_net2str(r->sr_netid);
+               if (r->sr_netid == LNET_NIDNET(LNET_NID_ANY))
+                       net = "default";
+               else
+                       net = libcfs_net2str_r(r->sr_netid, net_buf,
+                                              sizeof(net_buf));
 
                 if (r->sr_from == LUSTRE_SP_ANY && r->sr_to == LUSTRE_SP_ANY)
                         dirbuf[0] = '\0';
@@ -164,7 +162,7 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static ssize_t mgs_live_seq_write(struct file *file, const char *buf,
+static ssize_t mgs_live_seq_write(struct file *file, const char __user *buf,
                                  size_t len, loff_t *off)
 {
        struct seq_file *seq  = file->private_data;
@@ -180,14 +178,10 @@ LPROC_SEQ_FOPS(mgs_live);
 
 int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
 {
-       int rc;
-
        if (!mgs->mgs_proc_live)
                return 0;
-       rc = lprocfs_seq_create(mgs->mgs_proc_live, fsdb->fsdb_name, 0644,
-                               &mgs_live_fops, fsdb);
-
-       return 0;
+       return lprocfs_seq_create(mgs->mgs_proc_live, fsdb->fsdb_name, 0644,
+                                 &mgs_live_fops, fsdb);
 }
 
 int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
@@ -207,7 +201,7 @@ LPROC_SEQ_FOPS_RO_TYPE(mgs, hash);
 LPROC_SEQ_FOPS_WO_TYPE(mgs, evict_client);
 LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout);
 
-struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = {
+static struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
        { .name =       "uuid",
          .fops =       &mgs_uuid_fops          },
        { .name =       "num_exports",
@@ -218,7 +212,7 @@ struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = {
          .fops =       &mgs_evict_client_fops  },
        { .name =       "ir_timeout",
          .fops =       &mgs_ir_timeout_fops    },
-       { 0 }
+       { NULL }
 };
 
 int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
@@ -229,7 +223,7 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
        int                rc;
 
        obd->obd_vars = lprocfs_mgs_obd_vars;
-       rc = lprocfs_seq_obd_setup(obd);
+       rc = lprocfs_obd_setup(obd);
        if (rc != 0)
                GOTO(out, rc);
 
@@ -243,17 +237,17 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
        if (rc != 0)
                GOTO(out, rc);
 
-       mgs->mgs_proc_live = lprocfs_seq_register("live", obd->obd_proc_entry,
-                                                 NULL, NULL);
+       mgs->mgs_proc_live = lprocfs_register("live", obd->obd_proc_entry,
+                                             NULL, NULL);
         if (IS_ERR(mgs->mgs_proc_live)) {
                 rc = PTR_ERR(mgs->mgs_proc_live);
                 mgs->mgs_proc_live = NULL;
                GOTO(out, rc);
         }
 
-       obd->obd_proc_exports_entry = lprocfs_seq_register("exports",
-                                                          obd->obd_proc_entry,
-                                                          NULL, NULL);
+       obd->obd_proc_exports_entry = lprocfs_register("exports",
+                                                      obd->obd_proc_entry,
+                                                      NULL, NULL);
         if (IS_ERR(obd->obd_proc_exports_entry)) {
                 rc = PTR_ERR(obd->obd_proc_exports_entry);
                 obd->obd_proc_exports_entry = NULL;