+static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
+{
+ struct obd_device *obd = seq->private;
+ struct fs_db *fsdb;
+ int rc;
+
+ rc = mgs_find_or_make_fsdb(obd, MGSSELF_NAME, &fsdb);
+ if (rc)
+ return rc;
+
+ cfs_mutex_lock(&fsdb->fsdb_mutex);
+ seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
+ cfs_mutex_unlock(&fsdb->fsdb_mutex);
+ return 0;
+}
+
+LPROC_SEQ_FOPS_RO(mgsself_srpc);
+
+int lproc_mgs_setup(struct obd_device *obd)
+{
+ struct mgs_obd *mgs = &obd->u.mgs;
+ int rc;
+
+ rc = lprocfs_obd_seq_create(obd, "filesystems", 0444,
+ &mgs_fs_fops, obd);
+ rc = lprocfs_obd_seq_create(obd, "srpc_rules", 0600,
+ &mgsself_srpc_fops, obd);
+
+ 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);
+ CERROR("error %d setting up lprocfs for %s\n", rc, "live");
+ mgs->mgs_proc_live = 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);
+ CERROR("error %d setting up lprocfs for %s\n", rc, "exports");
+ obd->obd_proc_exports_entry = NULL;
+ }
+
+ return rc;
+}
+
+int lproc_mgs_cleanup(struct obd_device *obd)
+{
+ struct mgs_obd *mgs;
+
+ if (!obd)
+ return -EINVAL;
+
+ mgs = &obd->u.mgs;
+ if (mgs->mgs_proc_live) {
+ /* Should be no live entries */
+ LASSERT(mgs->mgs_proc_live->subdir == NULL);
+ lprocfs_remove(&mgs->mgs_proc_live);
+ mgs->mgs_proc_live = NULL;
+ }
+ lprocfs_free_per_client_stats(obd);
+ lprocfs_free_obd_stats(obd);
+ lprocfs_free_md_stats(obd);
+
+ return lprocfs_obd_cleanup(obd);
+}
+
+static int mgs_live_seq_show(struct seq_file *seq, void *v)