static int sptlrpc_info_lprocfs_seq_show(struct seq_file *seq, void *v)
{
- struct obd_device *dev = seq->private;
- struct client_obd *cli = &dev->u.cli;
- struct ptlrpc_sec *sec = NULL;
- char str[32];
+ struct obd_device *obd = seq->private;
+ struct client_obd *cli = &obd->u.cli;
+ struct ptlrpc_sec *sec = NULL;
+ char str[32];
- LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_LWP_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_OSP_NAME) == 0);
+ LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_LWP_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_OSP_NAME) == 0);
if (cli->cl_import)
sec = sptlrpc_import_sec_ref(cli->cl_import);
static int sptlrpc_ctxs_lprocfs_seq_show(struct seq_file *seq, void *v)
{
- struct obd_device *dev = seq->private;
- struct client_obd *cli = &dev->u.cli;
- struct ptlrpc_sec *sec = NULL;
+ struct obd_device *obd = seq->private;
+ struct client_obd *cli = &obd->u.cli;
+ struct ptlrpc_sec *sec = NULL;
- LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_LWP_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_OSP_NAME) == 0);
+ LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_LWP_NAME) == 0 ||
+ strcmp(obd->obd_type->typ_name, LUSTRE_OSP_NAME) == 0);
if (cli->cl_import)
sec = sptlrpc_import_sec_ref(cli->cl_import);
size_t count, void *data)
{
struct seq_file *seq = file->private_data;
- struct obd_device *dev = seq->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = seq->private;
+ struct client_obd *cli = &obd->u.cli;
struct obd_import *imp = cli->cl_import;
struct sepol_downcall_data *param;
int size = sizeof(*param);
if (count < size) {
CERROR("%s: invalid data count = %lu, size = %d\n",
- dev->obd_name, (unsigned long) count, size);
+ obd->obd_name, (unsigned long) count, size);
return -EINVAL;
}
return -ENOMEM;
if (copy_from_user(param, buffer, size)) {
- CERROR("%s: bad sepol data\n", dev->obd_name);
+ CERROR("%s: bad sepol data\n", obd->obd_name);
GOTO(out, rc = -EFAULT);
}
if (param->sdd_magic != SEPOL_DOWNCALL_MAGIC) {
CERROR("%s: sepol downcall bad params\n",
- dev->obd_name);
+ obd->obd_name);
GOTO(out, rc = -EINVAL);
}
if (param->sdd_sepol_len == 0 ||
param->sdd_sepol_len >= sizeof(imp->imp_sec->ps_sepol)) {
CERROR("%s: invalid sepol data returned\n",
- dev->obd_name);
+ obd->obd_name);
GOTO(out, rc = -EINVAL);
}
rc = param->sdd_sepol_len; /* save sdd_sepol_len */
return -ENOMEM;
if (copy_from_user(param, buffer, size)) {
- CERROR("%s: bad sepol data\n", dev->obd_name);
+ CERROR("%s: bad sepol data\n", obd->obd_name);
GOTO(out, rc = -EFAULT);
}
spin_lock(&imp->imp_sec->ps_lock);
snprintf(imp->imp_sec->ps_sepol, param->sdd_sepol_len + 1, "%s",
param->sdd_sepol);
- imp->imp_sec->ps_sepol_mtime = param->sdd_sepol_mtime;
+ imp->imp_sec->ps_sepol_mtime = ktime_set(param->sdd_sepol_mtime, 0);
spin_unlock(&imp->imp_sec->ps_lock);
out:
}
LPROC_SEQ_FOPS_WR_ONLY(srpc, sptlrpc_sepol);
-int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
+int sptlrpc_lprocfs_cliobd_attach(struct obd_device *obd)
{
- int rc;
-
- if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
- strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
- strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) != 0 &&
- strcmp(dev->obd_type->typ_name, LUSTRE_LWP_NAME) != 0 &&
- strcmp(dev->obd_type->typ_name, LUSTRE_OSP_NAME) != 0) {
+ if (strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME) != 0 &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_LWP_NAME) != 0 &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_OSP_NAME) != 0) {
CERROR("can't register lproc for obd type %s\n",
- dev->obd_type->typ_name);
+ obd->obd_type->typ_name);
return -EINVAL;
}
- rc = ldebugfs_seq_create(dev->obd_debugfs_entry, "srpc_info", 0444,
- &sptlrpc_info_lprocfs_fops, dev);
- if (rc) {
- CERROR("create proc entry srpc_info for %s: %d\n",
- dev->obd_name, rc);
- return rc;
- }
+ debugfs_create_file("srpc_info", 0444, obd->obd_debugfs_entry, obd,
+ &sptlrpc_info_lprocfs_fops);
- rc = ldebugfs_seq_create(dev->obd_debugfs_entry, "srpc_contexts",
- 0444, &sptlrpc_ctxs_lprocfs_fops, dev);
- if (rc) {
- CERROR("create proc entry srpc_contexts for %s: %d\n",
- dev->obd_name, rc);
- return rc;
- }
+ debugfs_create_file("srpc_contexts", 0444, obd->obd_debugfs_entry, obd,
+ &sptlrpc_ctxs_lprocfs_fops);
- rc = ldebugfs_seq_create(dev->obd_debugfs_entry, "srpc_sepol",
- 0200, &srpc_sptlrpc_sepol_fops, dev);
- if (rc) {
- CERROR("create proc entry srpc_sepol for %s: %d\n",
- dev->obd_name, rc);
- return rc;
- }
+ debugfs_create_file("srpc_sepol", 0200, obd->obd_debugfs_entry, obd,
+ &srpc_sptlrpc_sepol_fops);
return 0;
}
struct dentry *sptlrpc_debugfs_dir;
EXPORT_SYMBOL(sptlrpc_debugfs_dir);
+struct proc_dir_entry *sptlrpc_lprocfs_dir;
+EXPORT_SYMBOL(sptlrpc_lprocfs_dir);
+
int sptlrpc_lproc_init(void)
{
int rc;
LASSERT(sptlrpc_debugfs_dir == NULL);
- sptlrpc_debugfs_dir = ldebugfs_register("sptlrpc", debugfs_lustre_root,
- sptlrpc_lprocfs_vars, NULL);
- if (IS_ERR_OR_NULL(sptlrpc_debugfs_dir)) {
- rc = sptlrpc_debugfs_dir ? PTR_ERR(sptlrpc_debugfs_dir)
- : -ENOMEM;
- sptlrpc_debugfs_dir = NULL;
- return rc;
+ sptlrpc_debugfs_dir = debugfs_create_dir("sptlrpc",
+ debugfs_lustre_root);
+ ldebugfs_add_vars(sptlrpc_debugfs_dir, sptlrpc_lprocfs_vars, NULL);
+
+ sptlrpc_lprocfs_dir = lprocfs_register("sptlrpc", proc_lustre_root,
+ NULL, NULL);
+ if (IS_ERR_OR_NULL(sptlrpc_lprocfs_dir)) {
+ rc = PTR_ERR(sptlrpc_lprocfs_dir);
+ rc = sptlrpc_lprocfs_dir ? PTR_ERR(sptlrpc_lprocfs_dir)
+ : -ENOMEM;
+ sptlrpc_lprocfs_dir = NULL;
}
return 0;
}
void sptlrpc_lproc_fini(void)
{
- if (!IS_ERR_OR_NULL(sptlrpc_debugfs_dir))
- ldebugfs_remove(&sptlrpc_debugfs_dir);
+ debugfs_remove_recursive(sptlrpc_debugfs_dir);
+ sptlrpc_debugfs_dir = NULL;
+
+ if (!IS_ERR_OR_NULL(sptlrpc_lprocfs_dir))
+ lprocfs_remove(&sptlrpc_lprocfs_dir);
}