* 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/
#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)
{
- struct obd_device *obd = seq->private;
- struct mgs_device *mgs;
- cfs_list_t list;
- struct mgs_direntry *dirent, *n;
- struct lu_env env;
- int rc, len;
- ENTRY;
-
- LASSERT(obd != NULL);
+ struct obd_device *obd = seq->private;
+ struct mgs_device *mgs;
+ struct list_head list;
+ struct mgs_direntry *dirent, *n;
+ struct lu_env env;
+ int rc, len;
+
+ ENTRY;
+
+ LASSERT(obd != NULL);
LASSERT(obd->obd_lu_dev != NULL);
mgs = lu2mgs_dev(obd->obd_lu_dev);
RETURN(rc);
rc = class_dentry_readdir(&env, mgs, &list);
- if (rc) {
- CERROR("Can't read config dir\n");
+ if (rc)
GOTO(out, rc);
- }
- cfs_list_for_each_entry_safe(dirent, n, &list, list) {
- cfs_list_del(&dirent->list);
- len = strlen(dirent->name);
+
+ list_for_each_entry_safe(dirent, n, &list, mde_list) {
+ list_del_init(&dirent->mde_list);
+ len = strlen(dirent->mde_name);
if (len > 7 &&
- strncmp(dirent->name + len - 7, "-client", len) == 0)
- seq_printf(seq, "%.*s\n", len - 7, dirent->name);
+ strncmp(dirent->mde_name + len - 7, "-client", len) == 0)
+ seq_printf(seq, "%.*s\n", len - 7, dirent->mde_name);
mgs_direntry_free(dirent);
- }
+ }
out:
lu_env_fini(&env);
- RETURN(0);
+ RETURN(0);
}
LPROC_SEQ_FOPS_RO(mgs_fs);
struct sptlrpc_rule *r;
char dirbuf[10];
char flvrbuf[40];
- char *net;
+ char net[LNET_NIDSTR_SIZE] = "default";
int 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))
+ libcfs_net2str_r(r->sr_netid, net, sizeof(net));
if (r->sr_from == LUSTRE_SP_ANY && r->sr_to == LUSTRE_SP_ANY)
dirbuf[0] = '\0';
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;
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",
.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)
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);
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;